Skip to contentSkip to conversation

MMC: OMAP: Fix timeout calculation for MMC multislot support

PATCH In review Carlos Aguiar 1 participant 1 message Jan 28, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 8/18 MMC: OMAP: Fix timeout calculation for MMC multislot support

From: Juha Yrjola <[email protected]>

Fix the data timeout calculation for MMC multislot support.

---
 drivers/mmc/host/omap.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/mmc/host/omap.c +4 -5
index 4f98bef..784d40d 100644
@@ -881,13 +881,12 @@ static inline void set_cmd_timeout(struct mmc_omap_host *host, struct mmc_reques
 
 static inline void set_data_timeout(struct mmc_omap_host *host, struct mmc_request *req)
 {
-	int timeout;
+	unsigned int timeout, cycle_ns;
 	u16 reg;
 
-	/* Convert ns to clock cycles by assuming 20MHz frequency
-	 * 1 cycle at 20MHz = 500 ns
-	 */
-	timeout = req->data->timeout_clks + req->data->timeout_ns / 500;
+	cycle_ns = 1000000000 / host->current_slot->fclk_freq;
+	timeout = req->data->timeout_ns / cycle_ns;
+	timeout += req->data->timeout_clks;
 
 	/* Check if we need to use timeout multiplier register */
 	reg = OMAP_MMC_READ(host, SDIO);

-- 1.5.3.GIT