aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndy Green <andy@openmoko.com>2008-11-19 17:10:52 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:10:52 +0000
commitc1bdeafc8af94d65f7b0a9a35a95c7a6ef0008d7 (patch)
tree98d0a14d9e1e37a449567cd2ea689906f4960d48 /drivers
parent89cea0c24a47772cc05b10c73b4ad6ceb309c914 (diff)
fix-glamo-idleclock-around-suspend.patch
Possible implementation of SD Card corruption workaround reported here https://docs.openmoko.org/trac/ticket/1802#comment:5 Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/glamo/glamo-mci.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
index 1dbc52ac61f..66cfd357459 100644
--- a/drivers/mfd/glamo/glamo-mci.c
+++ b/drivers/mfd/glamo/glamo-mci.c
@@ -99,6 +99,8 @@ module_param(sd_drive, int, 0644);
static int sd_idleclk = 0; /* disallow idle clock by default */
module_param(sd_idleclk, int, 0644);
+/* used to stash real idleclk state in suspend: we force it to run in there */
+static int suspend_sd_idleclk;
unsigned char CRC7(u8 * pu8, int cnt)
@@ -946,6 +948,27 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
struct glamo_mci_host *host = mmc_priv(mmc);
int ret;
+ /*
+ * possible workaround for SD corruption during suspend - resume
+ * make sure the clock was running during suspend and consequently
+ * resume
+ */
+ if (host->pdata->glamo_mci_use_slow)
+ if ((host->pdata->glamo_mci_use_slow)())
+ __glamo_mci_fix_card_div(host, host->clk_div *
+ sd_slow_ratio);
+ else
+ __glamo_mci_fix_card_div(host, host->clk_div);
+ else
+ __glamo_mci_fix_card_div(host, host->clk_div);
+
+ /* we are going to do more commands to override this in
+ * mmc_suspend_host(), so we need to change sd_idleclk for the
+ * duration as well
+ */
+ suspend_sd_idleclk = sd_idleclk;
+ sd_idleclk = 1;
+
host->suspending++;
if (host->pdata->mci_all_dependencies_resumed)
(host->pdata->mci_suspending)(dev);
@@ -962,6 +985,7 @@ int glamo_mci_resume(struct platform_device *dev)
{
struct mmc_host *mmc = platform_get_drvdata(dev);
struct glamo_mci_host *host = mmc_priv(mmc);
+ int ret;
if (host->pdata->mci_all_dependencies_resumed)
if (!(host->pdata->mci_all_dependencies_resumed)(dev))
@@ -969,7 +993,12 @@ int glamo_mci_resume(struct platform_device *dev)
host->suspending--;
- return mmc_resume_host(mmc);
+ ret = mmc_resume_host(mmc);
+
+ /* put sd_idleclk back to pre-suspend state */
+ sd_idleclk = suspend_sd_idleclk;
+
+ return ret;
}
EXPORT_SYMBOL_GPL(glamo_mci_resume);