Skip to content

Commit 0ea6055

Browse files
Luke Wangstorulf
authored andcommitted
mmc: sdhci-esdhc-imx: calculate data timeout value based on clock
Calculate data timeout value based on clock instead of using max value. Signed-off-by: Luke Wang <[email protected]> Reviewed-by: Haibo Chen <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 2e1a26e commit 0ea6055

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,11 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
873873

874874
esdhc_clrset_le(host, mask, new_val, reg);
875875
return;
876+
case SDHCI_TIMEOUT_CONTROL:
877+
esdhc_clrset_le(host, ESDHC_SYS_CTRL_DTOCV_MASK,
878+
FIELD_PREP(ESDHC_SYS_CTRL_DTOCV_MASK, val),
879+
ESDHC_SYSTEM_CONTROL);
880+
return;
876881
case SDHCI_SOFTWARE_RESET:
877882
if (val & SDHCI_RESET_DATA)
878883
new_val = readl(host->ioaddr + SDHCI_HOST_CONTROL);
@@ -1399,17 +1404,6 @@ static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
13991404
return esdhc_is_usdhc(imx_data) ? 1 << 29 : 1 << 27;
14001405
}
14011406

1402-
static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
1403-
{
1404-
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1405-
struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
1406-
1407-
/* use maximum timeout counter */
1408-
esdhc_clrset_le(host, ESDHC_SYS_CTRL_DTOCV_MASK,
1409-
esdhc_is_usdhc(imx_data) ? 0xF0000 : 0xE0000,
1410-
ESDHC_SYSTEM_CONTROL);
1411-
}
1412-
14131407
static u32 esdhc_cqhci_irq(struct sdhci_host *host, u32 intmask)
14141408
{
14151409
int cmd_error = 0;
@@ -1446,7 +1440,6 @@ static struct sdhci_ops sdhci_esdhc_ops = {
14461440
.get_min_clock = esdhc_pltfm_get_min_clock,
14471441
.get_max_timeout_count = esdhc_get_max_timeout_count,
14481442
.get_ro = esdhc_pltfm_get_ro,
1449-
.set_timeout = esdhc_set_timeout,
14501443
.set_bus_width = esdhc_pltfm_set_bus_width,
14511444
.set_uhs_signaling = esdhc_set_uhs_signaling,
14521445
.reset = esdhc_reset,
@@ -1842,6 +1835,8 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
18421835
* to distinguish the card type.
18431836
*/
18441837
host->mmc_host_ops.init_card = usdhc_init_card;
1838+
1839+
host->max_timeout_count = 0xF;
18451840
}
18461841

18471842
if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)

0 commit comments

Comments
 (0)