aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2011-03-17 07:32:33 -0400
committerChris Ball <cjb@laptop.org>2011-03-17 15:35:20 -0400
commite61cf1184d72e574460492fd6c6b6d8a3ace2089 (patch)
tree2a95d08ee1b19a7cbeadc7ca0622f93bbcc9e3f2 /drivers/mmc
parentfc3d7720541d4b70cbae25ac121d7e6343125090 (diff)
mmc: dw_mmc: fix suspend/resume operation
This patch is related to re-init processing on suspend/resume. When card is resuming, some register is reset. If card is removable, maybe controller should be rescan for card. But if assume card is non-removable, need to restore the old value at registers. We store the value of FIFOTH at probe time and then restore it in dw_mci_resume(). Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Will Newton <will.newton@imgtec.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/dw_mmc.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 94ec6502bdd..51ee2f5909d 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1639,8 +1639,9 @@ static int dw_mci_probe(struct platform_device *pdev)
1639 */ 1639 */
1640 fifo_size = mci_readl(host, FIFOTH); 1640 fifo_size = mci_readl(host, FIFOTH);
1641 fifo_size = (fifo_size >> 16) & 0x7ff; 1641 fifo_size = (fifo_size >> 16) & 0x7ff;
1642 mci_writel(host, FIFOTH, ((0x2 << 28) | ((fifo_size/2 - 1) << 16) | 1642 host->fifoth_val = ((0x2 << 28) | ((fifo_size/2 - 1) << 16) |
1643 ((fifo_size/2) << 0))); 1643 ((fifo_size/2) << 0));
1644 mci_writel(host, FIFOTH, host->fifoth_val);
1644 1645
1645 /* disable clock to CIU */ 1646 /* disable clock to CIU */
1646 mci_writel(host, CLKENA, 0); 1647 mci_writel(host, CLKENA, 0);
@@ -1772,6 +1773,23 @@ static int dw_mci_resume(struct platform_device *pdev)
1772 int i, ret; 1773 int i, ret;
1773 struct dw_mci *host = platform_get_drvdata(pdev); 1774 struct dw_mci *host = platform_get_drvdata(pdev);
1774 1775
1776 if (host->dma_ops->init)
1777 host->dma_ops->init(host);
1778
1779 if (!mci_wait_reset(&pdev->dev, host)) {
1780 ret = -ENODEV;
1781 return ret;
1782 }
1783
1784 /* Restore the old value at FIFOTH register */
1785 mci_writel(host, FIFOTH, host->fifoth_val);
1786
1787 mci_writel(host, RINTSTS, 0xFFFFFFFF);
1788 mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
1789 SDMMC_INT_TXDR | SDMMC_INT_RXDR |
1790 DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
1791 mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
1792
1775 for (i = 0; i < host->num_slots; i++) { 1793 for (i = 0; i < host->num_slots; i++) {
1776 struct dw_mci_slot *slot = host->slot[i]; 1794 struct dw_mci_slot *slot = host->slot[i];
1777 if (!slot) 1795 if (!slot)