]> err.no Git - linux-2.6/commitdiff
MMC: OMAP: Fix timeout calculation for MMC multislot support
authorJuha Yrjola <juha.yrjola@solidboot.com>
Wed, 26 Mar 2008 20:09:16 +0000 (16:09 -0400)
committerPierre Ossman <drzeus@drzeus.cx>
Fri, 18 Apr 2008 18:05:29 +0000 (20:05 +0200)
Fix the data timeout calculation for MMC multislot support.

Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/omap.c

index 90e9d68e79987c5466f2a3dfa798249085aa05d3..0d3cd3c23f8fffb8c3923ced7230e142e4f7c00c 100644 (file)
@@ -861,13 +861,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);