diff options
author | Cliff Cai <cliff.cai@analog.com> | 2010-03-05 16:43:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:36 -0500 |
commit | 729adf1b5f4562f67fe8bf6c1df97edc1128fac7 (patch) | |
tree | ab22de5d498c5ee960b72b046ee73dc1c56bea01 /drivers/mmc | |
parent | 05dabcc4a51eab7342b2220f0121b4f4a5109386 (diff) |
mmc: bfin_sdh: set timeout based on actual card data
The hardcoded value doesn't really work for all cards.
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/bfin_sdh.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index f218a9964552..56f7b448b911 100644 --- a/drivers/mmc/host/bfin_sdh.c +++ b/drivers/mmc/host/bfin_sdh.c | |||
@@ -115,6 +115,7 @@ static int sdh_setup_data(struct sdh_host *host, struct mmc_data *data) | |||
115 | unsigned int length; | 115 | unsigned int length; |
116 | unsigned int data_ctl; | 116 | unsigned int data_ctl; |
117 | unsigned int dma_cfg; | 117 | unsigned int dma_cfg; |
118 | unsigned int cycle_ns, timeout; | ||
118 | 119 | ||
119 | dev_dbg(mmc_dev(host->mmc), "%s enter flags: 0x%x\n", __func__, data->flags); | 120 | dev_dbg(mmc_dev(host->mmc), "%s enter flags: 0x%x\n", __func__, data->flags); |
120 | host->data = data; | 121 | host->data = data; |
@@ -135,8 +136,11 @@ static int sdh_setup_data(struct sdh_host *host, struct mmc_data *data) | |||
135 | data_ctl |= ((ffs(data->blksz) - 1) << 4); | 136 | data_ctl |= ((ffs(data->blksz) - 1) << 4); |
136 | 137 | ||
137 | bfin_write_SDH_DATA_CTL(data_ctl); | 138 | bfin_write_SDH_DATA_CTL(data_ctl); |
138 | 139 | /* the time of a host clock period in ns */ | |
139 | bfin_write_SDH_DATA_TIMER(0xFFFF); | 140 | cycle_ns = 1000000000 / (get_sclk() / (2 * (host->clk_div + 1))); |
141 | timeout = data->timeout_ns / cycle_ns; | ||
142 | timeout += data->timeout_clks; | ||
143 | bfin_write_SDH_DATA_TIMER(timeout); | ||
140 | SSYNC(); | 144 | SSYNC(); |
141 | 145 | ||
142 | if (data->flags & MMC_DATA_READ) { | 146 | if (data->flags & MMC_DATA_READ) { |