All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91
@ 2021-09-24  8:28 ` Claudiu Beznea
  0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2021-09-24  8:28 UTC (permalink / raw)
  To: eugen.hristev, adrian.hunter, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, Claudiu Beznea

Hi,

This series adds a fix for sdhci-of-at91 driver (patch 1/2). Along with
it patch 2/2 replaces a while loop + timeout with read_poll_timeout().

Changes in v2:
- use read_poll_timeout() in patch 1/2
- add patch 2/2

Claudiu Beznea (2):
  mmc: sdhci-of-at91: wait for calibration done before proceed
  mmc: sdhci-of-at91: replace while loop with read_poll_timeout

 drivers/mmc/host/sdhci-of-at91.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91
@ 2021-09-24  8:28 ` Claudiu Beznea
  0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2021-09-24  8:28 UTC (permalink / raw)
  To: eugen.hristev, adrian.hunter, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, Claudiu Beznea

Hi,

This series adds a fix for sdhci-of-at91 driver (patch 1/2). Along with
it patch 2/2 replaces a while loop + timeout with read_poll_timeout().

Changes in v2:
- use read_poll_timeout() in patch 1/2
- add patch 2/2

Claudiu Beznea (2):
  mmc: sdhci-of-at91: wait for calibration done before proceed
  mmc: sdhci-of-at91: replace while loop with read_poll_timeout

 drivers/mmc/host/sdhci-of-at91.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] mmc: sdhci-of-at91: wait for calibration done before proceed
  2021-09-24  8:28 ` Claudiu Beznea
@ 2021-09-24  8:28   ` Claudiu Beznea
  -1 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2021-09-24  8:28 UTC (permalink / raw)
  To: eugen.hristev, adrian.hunter, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, Claudiu Beznea

Datasheet specifies that at the end of calibration the SDMMC_CALCR_EN
bit will be cleared. No commands should be send before calibration is
done.

Fixes: dbdea70f71d67 ("mmc: sdhci-of-at91: fix CALCR register being rewritten")
Fixes: 727d836a375ad ("mmc: sdhci-of-at91: add DT property to enable calibration on full reset")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---

Hi Nicolas,

I haven't added your tag from previous version as I changed the
implementation to use read_poll_timeout().

Thank you,
Claudiu Beznea

 drivers/mmc/host/sdhci-of-at91.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 5564d7b23e7c..134ba01d3063 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -11,6 +11,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
@@ -114,6 +115,7 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
+	unsigned int tmp;
 
 	sdhci_reset(host, mask);
 
@@ -126,6 +128,10 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
 
 		sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
 			     SDMMC_CALCR);
+
+		if (read_poll_timeout(sdhci_readl, tmp, !(tmp & SDMMC_CALCR_EN),
+				      10, 20000, false, host, SDMMC_CALCR))
+			dev_err(mmc_dev(host->mmc), "Failed to calibrate\n");
 	}
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] mmc: sdhci-of-at91: wait for calibration done before proceed
@ 2021-09-24  8:28   ` Claudiu Beznea
  0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2021-09-24  8:28 UTC (permalink / raw)
  To: eugen.hristev, adrian.hunter, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, Claudiu Beznea

Datasheet specifies that at the end of calibration the SDMMC_CALCR_EN
bit will be cleared. No commands should be send before calibration is
done.

Fixes: dbdea70f71d67 ("mmc: sdhci-of-at91: fix CALCR register being rewritten")
Fixes: 727d836a375ad ("mmc: sdhci-of-at91: add DT property to enable calibration on full reset")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---

Hi Nicolas,

I haven't added your tag from previous version as I changed the
implementation to use read_poll_timeout().

Thank you,
Claudiu Beznea

 drivers/mmc/host/sdhci-of-at91.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 5564d7b23e7c..134ba01d3063 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -11,6 +11,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
@@ -114,6 +115,7 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
+	unsigned int tmp;
 
 	sdhci_reset(host, mask);
 
@@ -126,6 +128,10 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
 
 		sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
 			     SDMMC_CALCR);
+
+		if (read_poll_timeout(sdhci_readl, tmp, !(tmp & SDMMC_CALCR_EN),
+				      10, 20000, false, host, SDMMC_CALCR))
+			dev_err(mmc_dev(host->mmc), "Failed to calibrate\n");
 	}
 }
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout
  2021-09-24  8:28 ` Claudiu Beznea
@ 2021-09-24  8:28   ` Claudiu Beznea
  -1 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2021-09-24  8:28 UTC (permalink / raw)
  To: eugen.hristev, adrian.hunter, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, Claudiu Beznea

Replace while loop with read_poll_timeout().

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/mmc/host/sdhci-of-at91.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 134ba01d3063..d1a1c548c515 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
 static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
 {
 	u16 clk;
-	unsigned long timeout;
 
 	host->mmc->actual_clock = 0;
 
@@ -87,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
 	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
 
 	/* Wait max 20 ms */
-	timeout = 20;
-	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
-		& SDHCI_CLOCK_INT_STABLE)) {
-		if (timeout == 0) {
-			pr_err("%s: Internal clock never stabilised.\n",
-			       mmc_hostname(host->mmc));
-			return;
-		}
-		timeout--;
-		mdelay(1);
+	if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
+			      1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
+		pr_err("%s: Internal clock never stabilised.\n",
+		       mmc_hostname(host->mmc));
+		return;
 	}
 
 	clk |= SDHCI_CLOCK_CARD_EN;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout
@ 2021-09-24  8:28   ` Claudiu Beznea
  0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2021-09-24  8:28 UTC (permalink / raw)
  To: eugen.hristev, adrian.hunter, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, Claudiu Beznea

Replace while loop with read_poll_timeout().

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/mmc/host/sdhci-of-at91.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 134ba01d3063..d1a1c548c515 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
 static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
 {
 	u16 clk;
-	unsigned long timeout;
 
 	host->mmc->actual_clock = 0;
 
@@ -87,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
 	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
 
 	/* Wait max 20 ms */
-	timeout = 20;
-	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
-		& SDHCI_CLOCK_INT_STABLE)) {
-		if (timeout == 0) {
-			pr_err("%s: Internal clock never stabilised.\n",
-			       mmc_hostname(host->mmc));
-			return;
-		}
-		timeout--;
-		mdelay(1);
+	if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
+			      1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
+		pr_err("%s: Internal clock never stabilised.\n",
+		       mmc_hostname(host->mmc));
+		return;
 	}
 
 	clk |= SDHCI_CLOCK_CARD_EN;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] mmc: sdhci-of-at91: wait for calibration done before proceed
  2021-09-24  8:28   ` Claudiu Beznea
@ 2021-09-24 11:34     ` Adrian Hunter
  -1 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2021-09-24 11:34 UTC (permalink / raw)
  To: Claudiu Beznea, eugen.hristev, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel

On 24/09/21 11:28 am, Claudiu Beznea wrote:
> Datasheet specifies that at the end of calibration the SDMMC_CALCR_EN
> bit will be cleared. No commands should be send before calibration is
> done.
> 
> Fixes: dbdea70f71d67 ("mmc: sdhci-of-at91: fix CALCR register being rewritten")
> Fixes: 727d836a375ad ("mmc: sdhci-of-at91: add DT property to enable calibration on full reset")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> Hi Nicolas,
> 
> I haven't added your tag from previous version as I changed the
> implementation to use read_poll_timeout().
> 
> Thank you,
> Claudiu Beznea
> 
>  drivers/mmc/host/sdhci-of-at91.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 5564d7b23e7c..134ba01d3063 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -11,6 +11,7 @@
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/kernel.h>
>  #include <linux/mmc/host.h>
>  #include <linux/mmc/slot-gpio.h>
> @@ -114,6 +115,7 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
>  {
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
> +	unsigned int tmp;
>  
>  	sdhci_reset(host, mask);
>  
> @@ -126,6 +128,10 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
>  
>  		sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
>  			     SDMMC_CALCR);
> +
> +		if (read_poll_timeout(sdhci_readl, tmp, !(tmp & SDMMC_CALCR_EN),
> +				      10, 20000, false, host, SDMMC_CALCR))
> +			dev_err(mmc_dev(host->mmc), "Failed to calibrate\n");
>  	}
>  }
>  
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] mmc: sdhci-of-at91: wait for calibration done before proceed
@ 2021-09-24 11:34     ` Adrian Hunter
  0 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2021-09-24 11:34 UTC (permalink / raw)
  To: Claudiu Beznea, eugen.hristev, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel

On 24/09/21 11:28 am, Claudiu Beznea wrote:
> Datasheet specifies that at the end of calibration the SDMMC_CALCR_EN
> bit will be cleared. No commands should be send before calibration is
> done.
> 
> Fixes: dbdea70f71d67 ("mmc: sdhci-of-at91: fix CALCR register being rewritten")
> Fixes: 727d836a375ad ("mmc: sdhci-of-at91: add DT property to enable calibration on full reset")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> Hi Nicolas,
> 
> I haven't added your tag from previous version as I changed the
> implementation to use read_poll_timeout().
> 
> Thank you,
> Claudiu Beznea
> 
>  drivers/mmc/host/sdhci-of-at91.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 5564d7b23e7c..134ba01d3063 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -11,6 +11,7 @@
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/kernel.h>
>  #include <linux/mmc/host.h>
>  #include <linux/mmc/slot-gpio.h>
> @@ -114,6 +115,7 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
>  {
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
> +	unsigned int tmp;
>  
>  	sdhci_reset(host, mask);
>  
> @@ -126,6 +128,10 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
>  
>  		sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
>  			     SDMMC_CALCR);
> +
> +		if (read_poll_timeout(sdhci_readl, tmp, !(tmp & SDMMC_CALCR_EN),
> +				      10, 20000, false, host, SDMMC_CALCR))
> +			dev_err(mmc_dev(host->mmc), "Failed to calibrate\n");
>  	}
>  }
>  
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout
  2021-09-24  8:28   ` Claudiu Beznea
@ 2021-09-24 11:34     ` Adrian Hunter
  -1 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2021-09-24 11:34 UTC (permalink / raw)
  To: Claudiu Beznea, eugen.hristev, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel

On 24/09/21 11:28 am, Claudiu Beznea wrote:
> Replace while loop with read_poll_timeout().
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-of-at91.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 134ba01d3063..d1a1c548c515 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
>  static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
>  {
>  	u16 clk;
> -	unsigned long timeout;
>  
>  	host->mmc->actual_clock = 0;
>  
> @@ -87,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
>  	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
>  
>  	/* Wait max 20 ms */
> -	timeout = 20;
> -	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> -		& SDHCI_CLOCK_INT_STABLE)) {
> -		if (timeout == 0) {
> -			pr_err("%s: Internal clock never stabilised.\n",
> -			       mmc_hostname(host->mmc));
> -			return;
> -		}
> -		timeout--;
> -		mdelay(1);
> +	if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
> +			      1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
> +		pr_err("%s: Internal clock never stabilised.\n",
> +		       mmc_hostname(host->mmc));
> +		return;
>  	}
>  
>  	clk |= SDHCI_CLOCK_CARD_EN;
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout
@ 2021-09-24 11:34     ` Adrian Hunter
  0 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2021-09-24 11:34 UTC (permalink / raw)
  To: Claudiu Beznea, eugen.hristev, ulf.hansson, nicolas.ferre,
	alexandre.belloni, ludovic.desroches
  Cc: linux-mmc, linux-arm-kernel, linux-kernel

On 24/09/21 11:28 am, Claudiu Beznea wrote:
> Replace while loop with read_poll_timeout().
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-of-at91.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 134ba01d3063..d1a1c548c515 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
>  static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
>  {
>  	u16 clk;
> -	unsigned long timeout;
>  
>  	host->mmc->actual_clock = 0;
>  
> @@ -87,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
>  	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
>  
>  	/* Wait max 20 ms */
> -	timeout = 20;
> -	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> -		& SDHCI_CLOCK_INT_STABLE)) {
> -		if (timeout == 0) {
> -			pr_err("%s: Internal clock never stabilised.\n",
> -			       mmc_hostname(host->mmc));
> -			return;
> -		}
> -		timeout--;
> -		mdelay(1);
> +	if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
> +			      1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
> +		pr_err("%s: Internal clock never stabilised.\n",
> +		       mmc_hostname(host->mmc));
> +		return;
>  	}
>  
>  	clk |= SDHCI_CLOCK_CARD_EN;
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91
  2021-09-24  8:28 ` Claudiu Beznea
@ 2021-09-27 22:31   ` Ulf Hansson
  -1 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2021-09-27 22:31 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: Eugen Hristev, Adrian Hunter, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, linux-mmc, Linux ARM,
	Linux Kernel Mailing List

On Fri, 24 Sept 2021 at 10:29, Claudiu Beznea
<claudiu.beznea@microchip.com> wrote:
>
> Hi,
>
> This series adds a fix for sdhci-of-at91 driver (patch 1/2). Along with
> it patch 2/2 replaces a while loop + timeout with read_poll_timeout().
>
> Changes in v2:
> - use read_poll_timeout() in patch 1/2
> - add patch 2/2
>
> Claudiu Beznea (2):
>   mmc: sdhci-of-at91: wait for calibration done before proceed
>   mmc: sdhci-of-at91: replace while loop with read_poll_timeout
>
>  drivers/mmc/host/sdhci-of-at91.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>

Applied for fixes and by adding tags for stable, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91
@ 2021-09-27 22:31   ` Ulf Hansson
  0 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2021-09-27 22:31 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: Alexandre Belloni, Linux Kernel Mailing List, linux-mmc,
	Adrian Hunter, Ludovic Desroches, Eugen Hristev, Linux ARM

On Fri, 24 Sept 2021 at 10:29, Claudiu Beznea
<claudiu.beznea@microchip.com> wrote:
>
> Hi,
>
> This series adds a fix for sdhci-of-at91 driver (patch 1/2). Along with
> it patch 2/2 replaces a while loop + timeout with read_poll_timeout().
>
> Changes in v2:
> - use read_poll_timeout() in patch 1/2
> - add patch 2/2
>
> Claudiu Beznea (2):
>   mmc: sdhci-of-at91: wait for calibration done before proceed
>   mmc: sdhci-of-at91: replace while loop with read_poll_timeout
>
>  drivers/mmc/host/sdhci-of-at91.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>

Applied for fixes and by adding tags for stable, thanks!

Kind regards
Uffe

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-09-27 22:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  8:28 [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91 Claudiu Beznea
2021-09-24  8:28 ` Claudiu Beznea
2021-09-24  8:28 ` [PATCH v2 1/2] mmc: sdhci-of-at91: wait for calibration done before proceed Claudiu Beznea
2021-09-24  8:28   ` Claudiu Beznea
2021-09-24 11:34   ` Adrian Hunter
2021-09-24 11:34     ` Adrian Hunter
2021-09-24  8:28 ` [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout Claudiu Beznea
2021-09-24  8:28   ` Claudiu Beznea
2021-09-24 11:34   ` Adrian Hunter
2021-09-24 11:34     ` Adrian Hunter
2021-09-27 22:31 ` [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91 Ulf Hansson
2021-09-27 22:31   ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.