changed Makefile and profiles, added patches for kernel 2.6.24 (stable-branch of...
[openwrt/openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1285-fix-glamo-idleclock-around-suspend.patch.patch
1 From ca19d156400f817960efe0d14680324b2ea34171 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 3 Sep 2008 19:39:47 +0800
4 Subject: [PATCH] fix-glamo-idleclock-around-suspend.patch
5
6 Possible implementation of SD Card corruption workaround reported here
7
8 https://docs.openmoko.org/trac/ticket/1802#comment:5
9
10 Signed-off-by: Andy Green <andy@openmoko.com>
11 ---
12 drivers/mfd/glamo/glamo-mci.c | 31 ++++++++++++++++++++++++++++++-
13 1 files changed, 30 insertions(+), 1 deletions(-)
14
15 diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
16 index 577021e..3eece08 100644
17 --- a/drivers/mfd/glamo/glamo-mci.c
18 +++ b/drivers/mfd/glamo/glamo-mci.c
19 @@ -99,6 +99,8 @@ module_param(sd_drive, int, 0644);
20 static int sd_idleclk = 0; /* disallow idle clock by default */
21 module_param(sd_idleclk, int, 0644);
22
23 +/* used to stash real idleclk state in suspend: we force it to run in there */
24 +static int suspend_sd_idleclk;
25
26
27 unsigned char CRC7(u8 * pu8, int cnt)
28 @@ -947,6 +949,27 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
29 struct glamo_mci_host *host = mmc_priv(mmc);
30 int ret;
31
32 + /*
33 + * possible workaround for SD corruption during suspend - resume
34 + * make sure the clock was running during suspend and consequently
35 + * resume
36 + */
37 + if (host->pdata->glamo_mci_use_slow)
38 + if ((host->pdata->glamo_mci_use_slow)())
39 + __glamo_mci_fix_card_div(host, host->clk_div *
40 + sd_slow_ratio);
41 + else
42 + __glamo_mci_fix_card_div(host, host->clk_div);
43 + else
44 + __glamo_mci_fix_card_div(host, host->clk_div);
45 +
46 + /* we are going to do more commands to override this in
47 + * mmc_suspend_host(), so we need to change sd_idleclk for the
48 + * duration as well
49 + */
50 + suspend_sd_idleclk = sd_idleclk;
51 + sd_idleclk = 1;
52 +
53 host->suspending++;
54 if (host->pdata->mci_all_dependencies_resumed)
55 (host->pdata->mci_suspending)(dev);
56 @@ -963,6 +986,7 @@ int glamo_mci_resume(struct platform_device *dev)
57 {
58 struct mmc_host *mmc = platform_get_drvdata(dev);
59 struct glamo_mci_host *host = mmc_priv(mmc);
60 + int ret;
61
62 if (host->pdata->mci_all_dependencies_resumed)
63 if (!(host->pdata->mci_all_dependencies_resumed)(dev))
64 @@ -970,7 +994,12 @@ int glamo_mci_resume(struct platform_device *dev)
65
66 host->suspending--;
67
68 - return mmc_resume_host(mmc);
69 + ret = mmc_resume_host(mmc);
70 +
71 + /* put sd_idleclk back to pre-suspend state */
72 + sd_idleclk = suspend_sd_idleclk;
73 +
74 + return ret;
75 }
76 EXPORT_SYMBOL_GPL(glamo_mci_resume);
77
78 --
79 1.5.6.5
80