All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sdhci : handle busy timeout irq
@ 2014-08-14 14:03 Matthieu CASTET
  2014-08-14 14:03 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Matthieu CASTET
  2014-08-18 11:13 ` [PATCH 1/2] sdhci : handle busy timeout irq Ulf Hansson
  0 siblings, 2 replies; 5+ messages in thread
From: Matthieu CASTET @ 2014-08-14 14:03 UTC (permalink / raw)
  To: linux-mmc; +Cc: Ulf Hansson, Chris Ball, Matthieu CASTET

When we wait for busy after sending a command, if there is
a timeout, we got SDHCI_INT_DATA_TIMEOUT flags.
Before this commit we got the message :
"Got data interrupt 0x00100000 even though no data  operation was in progress."
and we need to wait 10s that sdhci_timeout_timer expires.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mmc/host/sdhci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 47055f3..9df59a4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2301,6 +2301,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 		 * above in sdhci_cmd_irq().
 		 */
 		if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) {
+			if (intmask & SDHCI_INT_DATA_TIMEOUT) {
+				host->cmd->error = -ETIMEDOUT;
+				tasklet_schedule(&host->finish_tasklet);
+				return;
+			}
 			if (intmask & SDHCI_INT_DATA_END) {
 				sdhci_finish_command(host);
 				return;
-- 
2.1.0.rc1


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

* [PATCH 2/2] sdhci : recompute timeout_clk when needed
  2014-08-14 14:03 [PATCH 1/2] sdhci : handle busy timeout irq Matthieu CASTET
@ 2014-08-14 14:03 ` Matthieu CASTET
  2014-08-18 11:15   ` Ulf Hansson
  2014-08-18 11:13 ` [PATCH 1/2] sdhci : handle busy timeout irq Ulf Hansson
  1 sibling, 1 reply; 5+ messages in thread
From: Matthieu CASTET @ 2014-08-14 14:03 UTC (permalink / raw)
  To: linux-mmc; +Cc: Ulf Hansson, Chris Ball, Matthieu CASTET

when SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK is set, timeout_clk is sdclk.
We need to update it when we change sdclk in sdhci_set_clock.
This allow to have a more precisse timeout and max_busy_timeout. This
can help for command that need a big busy wait (erase, ...).

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mmc/host/sdhci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9df59a4..76b1aab 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1192,8 +1192,13 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 	}
 
 clock_set:
-	if (real_div)
+	if (real_div) {
 		host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div;
+		if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) {
+			host->timeout_clk = host->mmc->actual_clock / 1000;
+			host->mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
+		}
+	}
 
 	clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
 	clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
-- 
2.1.0.rc1


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

* Re: [PATCH 1/2] sdhci : handle busy timeout irq
  2014-08-14 14:03 [PATCH 1/2] sdhci : handle busy timeout irq Matthieu CASTET
  2014-08-14 14:03 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Matthieu CASTET
@ 2014-08-18 11:13 ` Ulf Hansson
  1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2014-08-18 11:13 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: linux-mmc, Chris Ball

On 14 August 2014 16:03, Matthieu CASTET <matthieu.castet@parrot.com> wrote:
> When we wait for busy after sending a command, if there is
> a timeout, we got SDHCI_INT_DATA_TIMEOUT flags.
> Before this commit we got the message :
> "Got data interrupt 0x00100000 even though no data  operation was in progress."
> and we need to wait 10s that sdhci_timeout_timer expires.
>
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 47055f3..9df59a4 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2301,6 +2301,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
>                  * above in sdhci_cmd_irq().
>                  */
>                 if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) {
> +                       if (intmask & SDHCI_INT_DATA_TIMEOUT) {
> +                               host->cmd->error = -ETIMEDOUT;
> +                               tasklet_schedule(&host->finish_tasklet);
> +                               return;
> +                       }
>                         if (intmask & SDHCI_INT_DATA_END) {
>                                 sdhci_finish_command(host);
>                                 return;
> --
> 2.1.0.rc1
>

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

* Re: [PATCH 2/2] sdhci : recompute timeout_clk when needed
  2014-08-14 14:03 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Matthieu CASTET
@ 2014-08-18 11:15   ` Ulf Hansson
  0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2014-08-18 11:15 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: linux-mmc, Chris Ball

On 14 August 2014 16:03, Matthieu CASTET <matthieu.castet@parrot.com> wrote:
> when SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK is set, timeout_clk is sdclk.
> We need to update it when we change sdclk in sdhci_set_clock.
> This allow to have a more precisse timeout and max_busy_timeout. This
> can help for command that need a big busy wait (erase, ...).
>
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>

Thanks! Applied for next.

This one didn't pass checkpatch, but I fixed it this time.

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 9df59a4..76b1aab 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1192,8 +1192,13 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
>         }
>
>  clock_set:
> -       if (real_div)
> +       if (real_div) {
>                 host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div;
> +               if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) {
> +                       host->timeout_clk = host->mmc->actual_clock / 1000;
> +                       host->mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
> +               }
> +       }
>
>         clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
>         clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
> --
> 2.1.0.rc1
>

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

* [PATCH 2/2] sdhci : recompute timeout_clk when needed
  2014-07-09 15:01 Matthieu CASTET
@ 2014-07-09 15:01 ` Matthieu CASTET
  0 siblings, 0 replies; 5+ messages in thread
From: Matthieu CASTET @ 2014-07-09 15:01 UTC (permalink / raw)
  To: linux-mmc; +Cc: Chris Ball, Matthieu CASTET

when SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK is set, timeout_clk is sdclk.
We need to update it when we change sdclk in sdhci_set_clock.
This allow to have a more precisse timeout and max_busy_timeout. This
can help for command that need a big busy wait (erase, ...).

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mmc/host/sdhci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9df59a4..76b1aab 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1192,8 +1192,13 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 	}
 
 clock_set:
-	if (real_div)
+	if (real_div) {
 		host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div;
+		if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) {
+			host->timeout_clk = host->mmc->actual_clock / 1000;
+			host->mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
+		}
+	}
 
 	clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
 	clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
-- 
2.0.1


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

end of thread, other threads:[~2014-08-18 11:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14 14:03 [PATCH 1/2] sdhci : handle busy timeout irq Matthieu CASTET
2014-08-14 14:03 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Matthieu CASTET
2014-08-18 11:15   ` Ulf Hansson
2014-08-18 11:13 ` [PATCH 1/2] sdhci : handle busy timeout irq Ulf Hansson
  -- strict thread matches above, loose matches on Subject: below --
2014-07-09 15:01 Matthieu CASTET
2014-07-09 15:01 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Matthieu CASTET

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.