aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/dw_mmc.c20
-rw-r--r--include/linux/mmc/dw_mmc.h1
2 files changed, 18 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
620static void dw_mci_setup_bus(struct dw_mci_slot *slot) 620static 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;
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index a5498dce1cb5..34be4f47293c 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -231,6 +231,7 @@ struct dw_mci_board {
231 231
232 u32 caps; /* Capabilities */ 232 u32 caps; /* Capabilities */
233 u32 caps2; /* More capabilities */ 233 u32 caps2; /* More capabilities */
234 u32 pm_caps; /* PM capabilities */
234 /* 235 /*
235 * Override fifo depth. If 0, autodetect it from the FIFOTH register, 236 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
236 * but note that this may not be reliable after a bootloader has used 237 * but note that this may not be reliable after a bootloader has used