Title: [7940] trunk/drivers/mmc/host/bfin_sdh.c: bug[#5729]set the actual timeout clocks according to csd
Revision
7940
Author
cliff
Date
2009-12-07 04:09:55 -0500 (Mon, 07 Dec 2009)

Log Message

bug[#5729]set the actual timeout clocks according to csd

Modified Paths

Diff

Modified: trunk/drivers/mmc/host/bfin_sdh.c (7939 => 7940)


--- trunk/drivers/mmc/host/bfin_sdh.c	2009-12-07 08:07:01 UTC (rev 7939)
+++ trunk/drivers/mmc/host/bfin_sdh.c	2009-12-07 09:09:55 UTC (rev 7940)
@@ -115,6 +115,7 @@
 	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 = ""
@@ -135,8 +136,11 @@
 	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) {
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to