Skip to content

Commit

Permalink
mmc: bfin_sdh: set timeout based on actual card data
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cliff Cai authored and Linus Torvalds committed Mar 6, 2010
1 parent 05dabcc commit 729adf1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/mmc/host/bfin_sdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ static int sdh_setup_data(struct sdh_host *host, struct mmc_data *data)
unsigned int length;
unsigned int data_ctl;
unsigned int dma_cfg;
unsigned int cycle_ns, timeout;

dev_dbg(mmc_dev(host->mmc), "%s enter flags: 0x%x\n", __func__, data->flags);
host->data = data;
Expand All @@ -135,8 +136,11 @@ static int sdh_setup_data(struct sdh_host *host, struct mmc_data *data)
data_ctl |= ((ffs(data->blksz) - 1) << 4);

bfin_write_SDH_DATA_CTL(data_ctl);

bfin_write_SDH_DATA_TIMER(0xFFFF);
/* the time of a host clock period in ns */
cycle_ns = 1000000000 / (get_sclk() / (2 * (host->clk_div + 1)));
timeout = data->timeout_ns / cycle_ns;
timeout += data->timeout_clks;
bfin_write_SDH_DATA_TIMER(timeout);
SSYNC();

if (data->flags & MMC_DATA_READ) {
Expand Down

0 comments on commit 729adf1

Please sign in to comment.