diff options
-rw-r--r-- | drivers/mmc/host/omap.c | 53 | ||||
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 36 |
2 files changed, 3 insertions, 86 deletions
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index b94f38ec2a83..0b10a9030f4e 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -128,7 +128,6 @@ struct mmc_omap_slot { | |||
128 | 128 | ||
129 | struct mmc_omap_host { | 129 | struct mmc_omap_host { |
130 | int initialized; | 130 | int initialized; |
131 | int suspended; | ||
132 | struct mmc_request * mrq; | 131 | struct mmc_request * mrq; |
133 | struct mmc_command * cmd; | 132 | struct mmc_command * cmd; |
134 | struct mmc_data * data; | 133 | struct mmc_data * data; |
@@ -1513,61 +1512,9 @@ static int mmc_omap_remove(struct platform_device *pdev) | |||
1513 | return 0; | 1512 | return 0; |
1514 | } | 1513 | } |
1515 | 1514 | ||
1516 | #ifdef CONFIG_PM | ||
1517 | static int mmc_omap_suspend(struct platform_device *pdev, pm_message_t mesg) | ||
1518 | { | ||
1519 | int i, ret = 0; | ||
1520 | struct mmc_omap_host *host = platform_get_drvdata(pdev); | ||
1521 | |||
1522 | if (host == NULL || host->suspended) | ||
1523 | return 0; | ||
1524 | |||
1525 | for (i = 0; i < host->nr_slots; i++) { | ||
1526 | struct mmc_omap_slot *slot; | ||
1527 | |||
1528 | slot = host->slots[i]; | ||
1529 | ret = mmc_suspend_host(slot->mmc); | ||
1530 | if (ret < 0) { | ||
1531 | while (--i >= 0) { | ||
1532 | slot = host->slots[i]; | ||
1533 | mmc_resume_host(slot->mmc); | ||
1534 | } | ||
1535 | return ret; | ||
1536 | } | ||
1537 | } | ||
1538 | host->suspended = 1; | ||
1539 | return 0; | ||
1540 | } | ||
1541 | |||
1542 | static int mmc_omap_resume(struct platform_device *pdev) | ||
1543 | { | ||
1544 | int i, ret = 0; | ||
1545 | struct mmc_omap_host *host = platform_get_drvdata(pdev); | ||
1546 | |||
1547 | if (host == NULL || !host->suspended) | ||
1548 | return 0; | ||
1549 | |||
1550 | for (i = 0; i < host->nr_slots; i++) { | ||
1551 | struct mmc_omap_slot *slot; | ||
1552 | slot = host->slots[i]; | ||
1553 | ret = mmc_resume_host(slot->mmc); | ||
1554 | if (ret < 0) | ||
1555 | return ret; | ||
1556 | |||
1557 | host->suspended = 0; | ||
1558 | } | ||
1559 | return 0; | ||
1560 | } | ||
1561 | #else | ||
1562 | #define mmc_omap_suspend NULL | ||
1563 | #define mmc_omap_resume NULL | ||
1564 | #endif | ||
1565 | |||
1566 | static struct platform_driver mmc_omap_driver = { | 1515 | static struct platform_driver mmc_omap_driver = { |
1567 | .probe = mmc_omap_probe, | 1516 | .probe = mmc_omap_probe, |
1568 | .remove = mmc_omap_remove, | 1517 | .remove = mmc_omap_remove, |
1569 | .suspend = mmc_omap_suspend, | ||
1570 | .resume = mmc_omap_resume, | ||
1571 | .driver = { | 1518 | .driver = { |
1572 | .name = DRIVER_NAME, | 1519 | .name = DRIVER_NAME, |
1573 | .owner = THIS_MODULE, | 1520 | .owner = THIS_MODULE, |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 540dead767b9..dbd32ad3b749 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -1171,9 +1171,6 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) | |||
1171 | struct omap_mmc_slot_data *slot = &mmc_slot(host); | 1171 | struct omap_mmc_slot_data *slot = &mmc_slot(host); |
1172 | int carddetect; | 1172 | int carddetect; |
1173 | 1173 | ||
1174 | if (host->suspended) | ||
1175 | return IRQ_HANDLED; | ||
1176 | |||
1177 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); | 1174 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); |
1178 | 1175 | ||
1179 | if (slot->card_detect) | 1176 | if (slot->card_detect) |
@@ -1632,11 +1629,6 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data) | |||
1632 | seq_printf(s, "mmc%d:\n ctx_loss:\t%d\n\nregs:\n", | 1629 | seq_printf(s, "mmc%d:\n ctx_loss:\t%d\n\nregs:\n", |
1633 | mmc->index, host->context_loss); | 1630 | mmc->index, host->context_loss); |
1634 | 1631 | ||
1635 | if (host->suspended) { | ||
1636 | seq_printf(s, "host suspended, can't read registers\n"); | ||
1637 | return 0; | ||
1638 | } | ||
1639 | |||
1640 | pm_runtime_get_sync(host->dev); | 1632 | pm_runtime_get_sync(host->dev); |
1641 | 1633 | ||
1642 | seq_printf(s, "CON:\t\t0x%08x\n", | 1634 | seq_printf(s, "CON:\t\t0x%08x\n", |
@@ -2101,23 +2093,12 @@ static void omap_hsmmc_complete(struct device *dev) | |||
2101 | 2093 | ||
2102 | static int omap_hsmmc_suspend(struct device *dev) | 2094 | static int omap_hsmmc_suspend(struct device *dev) |
2103 | { | 2095 | { |
2104 | int ret = 0; | ||
2105 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); | 2096 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
2106 | 2097 | ||
2107 | if (!host) | 2098 | if (!host) |
2108 | return 0; | 2099 | return 0; |
2109 | 2100 | ||
2110 | if (host && host->suspended) | ||
2111 | return 0; | ||
2112 | |||
2113 | pm_runtime_get_sync(host->dev); | 2101 | pm_runtime_get_sync(host->dev); |
2114 | host->suspended = 1; | ||
2115 | ret = mmc_suspend_host(host->mmc); | ||
2116 | |||
2117 | if (ret) { | ||
2118 | host->suspended = 0; | ||
2119 | goto err; | ||
2120 | } | ||
2121 | 2102 | ||
2122 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { | 2103 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { |
2123 | omap_hsmmc_disable_irq(host); | 2104 | omap_hsmmc_disable_irq(host); |
@@ -2127,23 +2108,19 @@ static int omap_hsmmc_suspend(struct device *dev) | |||
2127 | 2108 | ||
2128 | if (host->dbclk) | 2109 | if (host->dbclk) |
2129 | clk_disable_unprepare(host->dbclk); | 2110 | clk_disable_unprepare(host->dbclk); |
2130 | err: | 2111 | |
2131 | pm_runtime_put_sync(host->dev); | 2112 | pm_runtime_put_sync(host->dev); |
2132 | return ret; | 2113 | return 0; |
2133 | } | 2114 | } |
2134 | 2115 | ||
2135 | /* Routine to resume the MMC device */ | 2116 | /* Routine to resume the MMC device */ |
2136 | static int omap_hsmmc_resume(struct device *dev) | 2117 | static int omap_hsmmc_resume(struct device *dev) |
2137 | { | 2118 | { |
2138 | int ret = 0; | ||
2139 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); | 2119 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
2140 | 2120 | ||
2141 | if (!host) | 2121 | if (!host) |
2142 | return 0; | 2122 | return 0; |
2143 | 2123 | ||
2144 | if (host && !host->suspended) | ||
2145 | return 0; | ||
2146 | |||
2147 | pm_runtime_get_sync(host->dev); | 2124 | pm_runtime_get_sync(host->dev); |
2148 | 2125 | ||
2149 | if (host->dbclk) | 2126 | if (host->dbclk) |
@@ -2154,16 +2131,9 @@ static int omap_hsmmc_resume(struct device *dev) | |||
2154 | 2131 | ||
2155 | omap_hsmmc_protect_card(host); | 2132 | omap_hsmmc_protect_card(host); |
2156 | 2133 | ||
2157 | /* Notify the core to resume the host */ | ||
2158 | ret = mmc_resume_host(host->mmc); | ||
2159 | if (ret == 0) | ||
2160 | host->suspended = 0; | ||
2161 | |||
2162 | pm_runtime_mark_last_busy(host->dev); | 2134 | pm_runtime_mark_last_busy(host->dev); |
2163 | pm_runtime_put_autosuspend(host->dev); | 2135 | pm_runtime_put_autosuspend(host->dev); |
2164 | 2136 | return 0; | |
2165 | return ret; | ||
2166 | |||
2167 | } | 2137 | } |
2168 | 2138 | ||
2169 | #else | 2139 | #else |