Commit 83d420ba authored by Alex Dubov's avatar Alex Dubov Committed by Pierre Ossman

tifm_sd: fix hardware timeout setup

The register access order when setting hardware timeout was incorrect and
causing problems (wrong timeout intervals). This is now fixed.
Signed-off-by: default avatarAlex Dubov <oakad@yahoo.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 0803dd0c
...@@ -442,22 +442,21 @@ static void tifm_sd_set_data_timeout(struct tifm_sd *host, ...@@ -442,22 +442,21 @@ static void tifm_sd_set_data_timeout(struct tifm_sd *host,
return; return;
data_timeout += data->timeout_ns / data_timeout += data->timeout_ns /
((1000000000 / host->clk_freq) * host->clk_div); ((1000000000UL / host->clk_freq) * host->clk_div);
data_timeout *= 10; // call it fudge factor for now
if (data_timeout < 0xffff) { if (data_timeout < 0xffff) {
writel((~TIFM_MMCSD_DPE) &
readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
writel((~TIFM_MMCSD_DPE)
& readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
} else { } else {
writel(TIFM_MMCSD_DPE |
readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
data_timeout = (data_timeout >> 10) + 1; data_timeout = (data_timeout >> 10) + 1;
if(data_timeout > 0xffff) if(data_timeout > 0xffff)
data_timeout = 0; /* set to unlimited */ data_timeout = 0; /* set to unlimited */
writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
writel(TIFM_MMCSD_DPE
| readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment