sdhci : handle busy timeout irq
PATCH 1/2 sdhci : handle busy timeout irq
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.
--- drivers/mmc/host/sdhci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/host/sdhci.c +5 -0
@@ -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 ;
Signature · 1 line
2.1.0.rc1
PATCH 2/2 sdhci : recompute timeout_clk when needed
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, ...).
--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +6 -1
@@ -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 )
Signature · 1 line
2.1.0.rc1
Ulf Hansson
AppliedRe: [PATCH 2/2] sdhci : recompute timeout_clk when needed
Quoted 6 lines · Matthieu CASTET
when
SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLKis set,timeout_clkis sdclk. We need to update it when we change sdclk insdhci_set_clock. This allow to have a more precisse timeout andmax_busy_timeout. This can help for command that need a big busy wait (erase, ...).Signed-off-by Matthieu CASTET <[email protected]>
Thanks! Applied for next.
This one didn't pass checkpatch, but I fixed it this time.
Kind regards
Uffe
Quoted 26 lines
--- drivers/mmc/host/sdhci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +6
-2@@ -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
Ulf Hansson
AppliedQuoted 7 lines · Matthieu CASTET
When we wait for busy after sending a command, if there is
a timeout, we gotSDHCI_INT_DATA_TIMEOUTflags.
Before this commit we got the message :
"Got data interrupt0x00100000even though no data operation was in progress." and we need to wait 10s thatsdhci_timeout_timerexpires.Signed-off-by Matthieu CASTET <[email protected]>
Thanks! Applied for next.
Kind regards
Uffe
Quoted 23 lines
--- drivers/mmc/host/sdhci.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mmc/host/sdhci.c +5
-1@@ -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