diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2013-09-12 08:36:53 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-10-30 20:26:25 -0400 |
commit | 4a065193c46a16f1ddf20622c7011c8f327e0478 (patch) | |
tree | 24636463147a37372ef5ebdc01aa7b32093b8c66 /drivers/mmc/core/core.c | |
parent | 878e200bbb1fbde9f21582decab95b178e5a3b83 (diff) |
mmc: core: Let mmc_power_up|cycle take ocr as parameter
As a step to fixup the setup of the negotiated ocr mask, we need the
mmc_power_up|cycle functions to take the ocr as a parameter.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r-- | drivers/mmc/core/core.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0292ad448b07..b66e7ab2ad43 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1479,7 +1479,7 @@ power_cycle: | |||
1479 | if (err) { | 1479 | if (err) { |
1480 | pr_debug("%s: Signal voltage switch failed, " | 1480 | pr_debug("%s: Signal voltage switch failed, " |
1481 | "power cycling card\n", mmc_hostname(host)); | 1481 | "power cycling card\n", mmc_hostname(host)); |
1482 | mmc_power_cycle(host); | 1482 | mmc_power_cycle(host, host->ocr); |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | mmc_host_clk_release(host); | 1485 | mmc_host_clk_release(host); |
@@ -1520,22 +1520,14 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) | |||
1520 | * If a host does all the power sequencing itself, ignore the | 1520 | * If a host does all the power sequencing itself, ignore the |
1521 | * initial MMC_POWER_UP stage. | 1521 | * initial MMC_POWER_UP stage. |
1522 | */ | 1522 | */ |
1523 | void mmc_power_up(struct mmc_host *host) | 1523 | void mmc_power_up(struct mmc_host *host, u32 ocr) |
1524 | { | 1524 | { |
1525 | int bit; | ||
1526 | |||
1527 | if (host->ios.power_mode == MMC_POWER_ON) | 1525 | if (host->ios.power_mode == MMC_POWER_ON) |
1528 | return; | 1526 | return; |
1529 | 1527 | ||
1530 | mmc_host_clk_hold(host); | 1528 | mmc_host_clk_hold(host); |
1531 | 1529 | ||
1532 | /* If ocr is set, we use it */ | 1530 | host->ios.vdd = fls(ocr) - 1; |
1533 | if (host->ocr) | ||
1534 | bit = ffs(host->ocr) - 1; | ||
1535 | else | ||
1536 | bit = fls(host->ocr_avail) - 1; | ||
1537 | |||
1538 | host->ios.vdd = bit; | ||
1539 | if (mmc_host_is_spi(host)) | 1531 | if (mmc_host_is_spi(host)) |
1540 | host->ios.chip_select = MMC_CS_HIGH; | 1532 | host->ios.chip_select = MMC_CS_HIGH; |
1541 | else | 1533 | else |
@@ -1605,12 +1597,12 @@ void mmc_power_off(struct mmc_host *host) | |||
1605 | mmc_host_clk_release(host); | 1597 | mmc_host_clk_release(host); |
1606 | } | 1598 | } |
1607 | 1599 | ||
1608 | void mmc_power_cycle(struct mmc_host *host) | 1600 | void mmc_power_cycle(struct mmc_host *host, u32 ocr) |
1609 | { | 1601 | { |
1610 | mmc_power_off(host); | 1602 | mmc_power_off(host); |
1611 | /* Wait at least 1 ms according to SD spec */ | 1603 | /* Wait at least 1 ms according to SD spec */ |
1612 | mmc_delay(1); | 1604 | mmc_delay(1); |
1613 | mmc_power_up(host); | 1605 | mmc_power_up(host, ocr); |
1614 | } | 1606 | } |
1615 | 1607 | ||
1616 | /* | 1608 | /* |
@@ -2309,7 +2301,7 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) | |||
2309 | pr_info("%s: %s: trying to init card at %u Hz\n", | 2301 | pr_info("%s: %s: trying to init card at %u Hz\n", |
2310 | mmc_hostname(host), __func__, host->f_init); | 2302 | mmc_hostname(host), __func__, host->f_init); |
2311 | #endif | 2303 | #endif |
2312 | mmc_power_up(host); | 2304 | mmc_power_up(host, host->ocr_avail); |
2313 | 2305 | ||
2314 | /* | 2306 | /* |
2315 | * Some eMMCs (with VCCQ always on) may not be reset after power up, so | 2307 | * Some eMMCs (with VCCQ always on) may not be reset after power up, so |
@@ -2479,7 +2471,7 @@ void mmc_start_host(struct mmc_host *host) | |||
2479 | if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP) | 2471 | if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP) |
2480 | mmc_power_off(host); | 2472 | mmc_power_off(host); |
2481 | else | 2473 | else |
2482 | mmc_power_up(host); | 2474 | mmc_power_up(host, host->ocr_avail); |
2483 | mmc_detect_change(host, 0); | 2475 | mmc_detect_change(host, 0); |
2484 | } | 2476 | } |
2485 | 2477 | ||
@@ -2558,7 +2550,7 @@ int mmc_power_restore_host(struct mmc_host *host) | |||
2558 | return -EINVAL; | 2550 | return -EINVAL; |
2559 | } | 2551 | } |
2560 | 2552 | ||
2561 | mmc_power_up(host); | 2553 | mmc_power_up(host, host->ocr); |
2562 | ret = host->bus_ops->power_restore(host); | 2554 | ret = host->bus_ops->power_restore(host); |
2563 | 2555 | ||
2564 | mmc_bus_put(host); | 2556 | mmc_bus_put(host); |