diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-04-24 06:27:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-04-24 06:27:02 -0400 |
commit | 3d63abe56be2147891b3438cb3bd37a9be72bda7 (patch) | |
tree | eec5568c93a8616888c2b66c8d8d17f10ee9e9fd /drivers/mmc | |
parent | 6b426e785cb81e53dc2fc4dcf997661472b470ef (diff) |
[MMC] pxamci: fix data timeout calculation
The MMC layer gives us two parts for the timeout calculation - a fixed
timeout in nanoseconds, and a card clock-speed dependent part.
The PXA MMC hardware allows for a timeout based on the fixed host clock
speed only. This resulted in some cards being given a short timeout,
and therefore failing to work.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/pxamci.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index eb9a8826e9b5..eb42cb349420 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -65,11 +65,6 @@ struct pxamci_host { | |||
65 | unsigned int dma_dir; | 65 | unsigned int dma_dir; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static inline unsigned int ns_to_clocks(unsigned int ns) | ||
69 | { | ||
70 | return (ns * (CLOCKRATE / 1000000) + 999) / 1000; | ||
71 | } | ||
72 | |||
73 | static void pxamci_stop_clock(struct pxamci_host *host) | 68 | static void pxamci_stop_clock(struct pxamci_host *host) |
74 | { | 69 | { |
75 | if (readl(host->base + MMC_STAT) & STAT_CLK_EN) { | 70 | if (readl(host->base + MMC_STAT) & STAT_CLK_EN) { |
@@ -113,6 +108,7 @@ static void pxamci_disable_irq(struct pxamci_host *host, unsigned int mask) | |||
113 | static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) | 108 | static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) |
114 | { | 109 | { |
115 | unsigned int nob = data->blocks; | 110 | unsigned int nob = data->blocks; |
111 | unsigned long long clks; | ||
116 | unsigned int timeout; | 112 | unsigned int timeout; |
117 | u32 dcmd; | 113 | u32 dcmd; |
118 | int i; | 114 | int i; |
@@ -125,7 +121,9 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) | |||
125 | writel(nob, host->base + MMC_NOB); | 121 | writel(nob, host->base + MMC_NOB); |
126 | writel(1 << data->blksz_bits, host->base + MMC_BLKLEN); | 122 | writel(1 << data->blksz_bits, host->base + MMC_BLKLEN); |
127 | 123 | ||
128 | timeout = ns_to_clocks(data->timeout_ns) + data->timeout_clks; | 124 | clks = (unsigned long long)data->timeout_ns * CLOCKRATE; |
125 | do_div(clks, 1000000000UL); | ||
126 | timeout = (unsigned int)clks + (data->timeout_clks << host->clkrt); | ||
129 | writel((timeout + 255) / 256, host->base + MMC_RDTO); | 127 | writel((timeout + 255) / 256, host->base + MMC_RDTO); |
130 | 128 | ||
131 | if (data->flags & MMC_DATA_READ) { | 129 | if (data->flags & MMC_DATA_READ) { |