The patch titled MMC: OMAP: Clean up omap set_ios and make MMC_POWER_ON work has been added to the -mm tree. Its filename is mmc-omap-clean-up-omap-set_ios-and-make-mmc_power_on.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: MMC: OMAP: Clean up omap set_ios and make MMC_POWER_ON work From: Carlos Aguiar <carlos.aguiar@xxxxxxxxxxx> Move divisor calculation into a separate function and re-arrange the init order to make MMC_POWER_ON work. Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx> Cc: Pierre Ossman <drzeus@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/mmc/host/omap.c | 47 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff -puN drivers/mmc/host/omap.c~mmc-omap-clean-up-omap-set_ios-and-make-mmc_power_on drivers/mmc/host/omap.c --- a/drivers/mmc/host/omap.c~mmc-omap-clean-up-omap-set_ios-and-make-mmc_power_on +++ a/drivers/mmc/host/omap.c @@ -936,33 +936,41 @@ static void mmc_omap_power(struct mmc_om } } -static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) +static int mmc_omap_calc_divisor(struct mmc_host *mmc, struct mmc_ios *ios) { struct mmc_omap_host *host = mmc_priv(mmc); + int func_clk_rate = clk_get_rate(host->fclk); int dsor; - int realclock, i; - - realclock = ios->clock; if (ios->clock == 0) - dsor = 0; - else { - int func_clk_rate = clk_get_rate(host->fclk); - - dsor = func_clk_rate / realclock; - if (dsor < 1) - dsor = 1; + return 0; - if (func_clk_rate / dsor > realclock) - dsor++; + dsor = func_clk_rate / ios->clock; + if (dsor < 1) + dsor = 1; - if (dsor > 250) - dsor = 250; + if (func_clk_rate / dsor > ios->clock) dsor++; - if (ios->bus_width == MMC_BUS_WIDTH_4) - dsor |= 1 << 15; - } + if (dsor > 250) + dsor = 250; + dsor++; + + if (ios->bus_width == MMC_BUS_WIDTH_4) + dsor |= 1 << 15; + + return dsor; +} + +static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) +{ + struct mmc_omap_host *host = mmc_priv(mmc); + int dsor; + int i; + + dsor = mmc_omap_calc_divisor(mmc, ios); + host->bus_mode = ios->bus_mode; + host->hw_bus_mode = host->bus_mode; switch (ios->power_mode) { case MMC_POWER_OFF: @@ -977,9 +985,6 @@ static void mmc_omap_set_ios(struct mmc_ break; } - host->bus_mode = ios->bus_mode; - host->hw_bus_mode = host->bus_mode; - clk_enable(host->fclk); /* On insanely high arm_per frequencies something sometimes _ Patches currently in -mm which might be from carlos.aguiar@xxxxxxxxxxx are mmc-omap-add-missing-newline.patch mmc-omap-fix-omap-to-use-mmc_power_on.patch mmc-omap-clean-up-omap-set_ios-and-make-mmc_power_on.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html