MMC: OMAP: Fix the data timeout calculation for MMC multislot support.
Subsystems (2)
PATCH 4/17 MMC: OMAP: Fix the data timeout calculation for MMC multislot support.
From: Juha Yrjola <[email protected]>
Fix the data timeout calculation for MMC multislot support.
Signed-off-by Juha Yrjola <[email protected]>
Signed-off-by Jarkko Lavinen <[email protected]>
Fix the data timeout calculation for MMC multislot support
Signed-off-by Juha Yrjola <[email protected]>
Signed-off-by Jarkko Lavinen <[email protected]>
drivers/mmc/host/omap.c +8 -6
@@ -875,13 +875,12 @@ static inline void set_cmd_timeout(strucstatic 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 );
@@ -1051,7 +1050,8 @@ static void mmc_omap_power(struct mmc_omstatic int mmc_omap_calc_divisor (struct mmc_host *mmc,struct mmc_ios *ios) { -struct mmc_omap_host *host =mmc_priv (mmc); +struct mmc_omap_slot *slot =mmc_priv (mmc); +struct mmc_omap_host *host = slot->host;int func_clk_rate =clk_get_rate (host->fclk);int dsor;
@@ -1068,6 +1068,8 @@ static int mmc_omap_calc_divisor(structif (dsor >250 ) dsor =250 ; + slot->fclk_freq = func_clk_rate / dsor; +if (ios->bus_width ==MMC_BUS_WIDTH_4 ) dsor |=1 <<15 ;