Skip to contentSkip to conversation

Powerpc/esdhc: Calculate the applicable timeout value for mmc erase

PATCH Anton Vorontsov 1 participant 1 message Nov 19, 2012 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · Haijun.Zhang

As large area erase needs long time usually a few minutes, which the host can't wait will bring about timeout error. So we need to split the large area to small sections which only need short erase time to avoid timeout error.

---

[...]

drivers/mmc/host/sdhci.c int sdhci_add_host(struct sdhci_host *host) · line 2564

Quoted 8 lines
drivers/mmc/host/sdhci.c +2 -0
@@ -2560,6 +2560,16 @@ int sdhci_add_host(struct sdhci_host *host)
 	} else
 		mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
 
+	/*
+	 * Calculate the max discard timeout  to limit the size one

Unneeded whitespace.

drivers/mmc/host/sdhci.c int sdhci_add_host(struct sdhci_host *host) · line 2565

Quoted 1 line
drivers/mmc/host/sdhci.c +1 -0
+	 * discard request can issue.Just subtract the minimum timeout

Missing whitespace after the dot.

drivers/mmc/host/sdhci.c int sdhci_add_host(struct sdhci_host *host) · line 2569

Quoted 4 lines
drivers/mmc/host/sdhci.c +4 -0
+	 * value to avoid the circumstance the timeout value just equal to 0xF.
+	 */
+	if (host->timeout_clk &&
+		!(host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK))

Wrong indentation on the second line (should be at least one more tab).

drivers/mmc/host/sdhci.c int sdhci_add_host(struct sdhci_host *host) · line 2571

Quoted 2 lines
drivers/mmc/host/sdhci.c +2 -0
+		mmc->max_discard_to = ((1 << 27) - (1 << 13) * 1000) /
+			host->timeout_clk;

Is this some kind of generic formula? If not, it's better to place the calculation into esdhc driver itself... Plus, where 27 and 13 came from?..

Otherwise, it looks good.

Thanks,
Anton.