summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2013-10-24 17:42:53 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2014-09-09 13:59:09 +0200
commit9ae4ed7d30f433873351d5ba14ae000d10e10430 (patch)
treedfef2b1c519818a9c833483767e2d14458559fa9 /drivers/mmc/host
parent0369483efc1719f47249fa94329aa94155edf69d (diff)
downloadlinux-stable-9ae4ed7d30f433873351d5ba14ae000d10e10430.tar.gz
linux-stable-9ae4ed7d30f433873351d5ba14ae000d10e10430.tar.bz2
linux-stable-9ae4ed7d30f433873351d5ba14ae000d10e10430.zip
mmc: tmio: Extract bus_width modifications to a separate function
Move code for bus_width modification, out of the ->set_ios() callback and into a separate function, to simplify code. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/tmio_mmc_pio.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index d63d292933b4..8f5b5ccc7a5f 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -831,6 +831,19 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host)
host->set_pwr(host->pdev, 0);
}
+static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
+ unsigned char bus_width)
+{
+ switch (bus_width) {
+ case MMC_BUS_WIDTH_1:
+ sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
+ break;
+ case MMC_BUS_WIDTH_4:
+ sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
+ break;
+ }
+}
+
/* Set MMC clock / power.
* Note: This controller uses a simple divider scheme therefore it cannot
* run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as
@@ -914,16 +927,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
}
}
- if (host->power != TMIO_MMC_OFF_STOP) {
- switch (ios->bus_width) {
- case MMC_BUS_WIDTH_1:
- sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
- break;
- case MMC_BUS_WIDTH_4:
- sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
- break;
- }
- }
+ if (host->power != TMIO_MMC_OFF_STOP)
+ tmio_mmc_set_bus_width(host, ios->bus_width);
/* Let things settle. delay taken from winCE driver */
udelay(140);