diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2009-10-10 20:37:42 +0200 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2009-12-06 08:46:43 +0100 |
commit | f80843a39a47066857363de4270f3c23495095f4 (patch) | |
tree | e0758c0456e62eaa88e4a675ac2bfb239431a6cd /drivers | |
parent | 0fd425a2d37c7d6f0dcd5403c0fde2b729026d61 (diff) |
glamo-mci: Reset if engine is stalled.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/glamo/glamo-mci.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c index a173bbaaea3..948e380700c 100644 --- a/drivers/mfd/glamo/glamo-mci.c +++ b/drivers/mfd/glamo/glamo-mci.c @@ -140,6 +140,22 @@ static void glamo_reg_set_bit_mask(struct glamo_mci_host *glamo, glamo_reg_write(glamo, reg, tmp); } +static void glamo_mci_reset(struct glamo_mci_host *host) +{ + glamo_engine_reset(host->core, GLAMO_ENGINE_MMC); + + glamo_reg_write(host, GLAMO_REG_MMC_WDATADS1, + (uint16_t)(host->data_mem->start)); + glamo_reg_write(host, GLAMO_REG_MMC_WDATADS2, + (uint16_t)(host->data_mem->start >> 16)); + + glamo_reg_write(host, GLAMO_REG_MMC_RDATADS1, + (uint16_t)(host->data_mem->start)); + glamo_reg_write(host, GLAMO_REG_MMC_RDATADS2, + (uint16_t)(host->data_mem->start >> 16)); + +} + static void glamo_mci_clock_disable(struct glamo_mci_host *host) { if (host->clk_enabled) { @@ -229,8 +245,10 @@ static int glamo_mci_wait_idle(struct glamo_mci_host *host, status = glamo_reg_read(host, GLAMO_REG_MMC_RB_STAT1); } while (!(status & GLAMO_STAT1_MMC_IDLE) && jiffies < timeout); - if (jiffies >= timeout) + if (jiffies >= timeout) { + glamo_mci_reset(host); return -ETIMEDOUT; + } return 0; } @@ -880,17 +898,8 @@ static int glamo_mci_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mmc); glamo_engine_enable(host->core, GLAMO_ENGINE_MMC); - glamo_engine_reset(host->core, GLAMO_ENGINE_MMC); - - glamo_reg_write(host, GLAMO_REG_MMC_WDATADS1, - (uint16_t)(host->data_mem->start)); - glamo_reg_write(host, GLAMO_REG_MMC_WDATADS2, - (uint16_t)(host->data_mem->start >> 16)); - - glamo_reg_write(host, GLAMO_REG_MMC_RDATADS1, - (uint16_t)(host->data_mem->start)); - glamo_reg_write(host, GLAMO_REG_MMC_RDATADS2, - (uint16_t)(host->data_mem->start >> 16)); + glamo_mci_reset(host); + glamo_engine_disable(host->core, GLAMO_ENGINE_MMC); setup_timer(&host->disable_timer, glamo_mci_disable_timer, (unsigned long)host); @@ -970,18 +979,10 @@ static int glamo_mci_resume(struct device *dev) struct glamo_mci_host *host = mmc_priv(mmc); int ret; - glamo_engine_enable(host->core, GLAMO_ENGINE_MMC); - glamo_engine_reset(host->core, GLAMO_ENGINE_MMC); - glamo_reg_write(host, GLAMO_REG_MMC_WDATADS1, - (uint16_t)(host->data_mem->start)); - glamo_reg_write(host, GLAMO_REG_MMC_WDATADS2, - (uint16_t)(host->data_mem->start >> 16)); + glamo_engine_enable(host->core, GLAMO_ENGINE_MMC); + glamo_mci_reset(host); - glamo_reg_write(host, GLAMO_REG_MMC_RDATADS1, - (uint16_t)(host->data_mem->start)); - glamo_reg_write(host, GLAMO_REG_MMC_RDATADS2, - (uint16_t)(host->data_mem->start >> 16)); mdelay(5); ret = mmc_resume_host(host->mmc); |