diff options
author | Abhilash Kesavan <a.kesavan@samsung.com> | 2012-11-18 23:56:21 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-12-06 13:54:54 -0500 |
commit | ab269128a2cff7abee06f023e6466fc29991738c (patch) | |
tree | b6b75ebec2cad581d36a0bfc0ed9ad7e19f9e711 /drivers/mmc | |
parent | f5ccfd4174639119664b6d76495ea1388f13b838 (diff) |
mmc: dw_mmc: Add sdio power bindings
Add dt-based retrieval of host sdio pm capabilities. Based on
the dt based discovery do a bus init in the resume function.
Signed-off-by: Olof Johansson <olofj@chromium.org>
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 5b4134811c90..73420296b268 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -617,13 +617,13 @@ static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg) | |||
617 | cmd, arg, cmd_status); | 617 | cmd, arg, cmd_status); |
618 | } | 618 | } |
619 | 619 | ||
620 | static void dw_mci_setup_bus(struct dw_mci_slot *slot) | 620 | static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) |
621 | { | 621 | { |
622 | struct dw_mci *host = slot->host; | 622 | struct dw_mci *host = slot->host; |
623 | u32 div; | 623 | u32 div; |
624 | u32 clk_en_a; | 624 | u32 clk_en_a; |
625 | 625 | ||
626 | if (slot->clock != host->current_speed) { | 626 | if (slot->clock != host->current_speed || force_clkinit) { |
627 | div = host->bus_hz / slot->clock; | 627 | div = host->bus_hz / slot->clock; |
628 | if (host->bus_hz % slot->clock && host->bus_hz > slot->clock) | 628 | if (host->bus_hz % slot->clock && host->bus_hz > slot->clock) |
629 | /* | 629 | /* |
@@ -684,7 +684,7 @@ static void __dw_mci_start_request(struct dw_mci *host, | |||
684 | host->pdata->select_slot(slot->id); | 684 | host->pdata->select_slot(slot->id); |
685 | 685 | ||
686 | /* Slot specific timing and width adjustment */ | 686 | /* Slot specific timing and width adjustment */ |
687 | dw_mci_setup_bus(slot); | 687 | dw_mci_setup_bus(slot, false); |
688 | 688 | ||
689 | host->cur_slot = slot; | 689 | host->cur_slot = slot; |
690 | host->mrq = mrq; | 690 | host->mrq = mrq; |
@@ -1850,6 +1850,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) | |||
1850 | if (host->pdata->caps) | 1850 | if (host->pdata->caps) |
1851 | mmc->caps = host->pdata->caps; | 1851 | mmc->caps = host->pdata->caps; |
1852 | 1852 | ||
1853 | if (host->pdata->pm_caps) | ||
1854 | mmc->pm_caps = host->pdata->pm_caps; | ||
1855 | |||
1853 | if (host->dev->of_node) { | 1856 | if (host->dev->of_node) { |
1854 | ctrl_id = of_alias_get_id(host->dev->of_node, "mshc"); | 1857 | ctrl_id = of_alias_get_id(host->dev->of_node, "mshc"); |
1855 | if (ctrl_id < 0) | 1858 | if (ctrl_id < 0) |
@@ -2072,6 +2075,12 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) | |||
2072 | return ERR_PTR(ret); | 2075 | return ERR_PTR(ret); |
2073 | } | 2076 | } |
2074 | 2077 | ||
2078 | if (of_find_property(np, "keep-power-in-suspend", NULL)) | ||
2079 | pdata->pm_caps |= MMC_PM_KEEP_POWER; | ||
2080 | |||
2081 | if (of_find_property(np, "enable-sdio-wakeup", NULL)) | ||
2082 | pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ; | ||
2083 | |||
2075 | return pdata; | 2084 | return pdata; |
2076 | } | 2085 | } |
2077 | 2086 | ||
@@ -2411,6 +2420,11 @@ int dw_mci_resume(struct dw_mci *host) | |||
2411 | struct dw_mci_slot *slot = host->slot[i]; | 2420 | struct dw_mci_slot *slot = host->slot[i]; |
2412 | if (!slot) | 2421 | if (!slot) |
2413 | continue; | 2422 | continue; |
2423 | if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) { | ||
2424 | dw_mci_set_ios(slot->mmc, &slot->mmc->ios); | ||
2425 | dw_mci_setup_bus(slot, true); | ||
2426 | } | ||
2427 | |||
2414 | ret = mmc_resume_host(host->slot[i]->mmc); | 2428 | ret = mmc_resume_host(host->slot[i]->mmc); |
2415 | if (ret < 0) | 2429 | if (ret < 0) |
2416 | return ret; | 2430 | return ret; |