moko nand blocksize is 128k
[openwrt/staging/dedeckeh.git] / target / linux / s3c24xx / patches-2.6.26 / 0082-fix-glamo-mci-defeat-ops-during-suspend.patch.patch
1 From adeb466de3bb306dc68468c64be3ebc61960d788 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:01 +0100
4 Subject: [PATCH] fix-glamo-mci-defeat-ops-during-suspend.patch
5
6 We need to be able to use the config option CONFIG_MMC_UNSAFE_RESUME that allows the rootfs
7 to live on SD. But when we use this, it tries to send a reset command to the SD card during
8 suspend -- and unfortunately many things like Power have suspended by then.
9
10 This patch again rejects IO on the MMC device during suspend of the MMC device, and it
11 gives the result the rootfs on SD card works okay.
12
13 Signed-off-by: Andy Green <andy@openmoko.com>
14 ---
15 drivers/mfd/glamo/glamo-mci.c | 14 ++++++++++++++
16 drivers/mfd/glamo/glamo-mci.h | 2 ++
17 2 files changed, 16 insertions(+), 0 deletions(-)
18
19 diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
20 index f559e5e..bbbbe4d 100644
21 --- a/drivers/mfd/glamo/glamo-mci.c
22 +++ b/drivers/mfd/glamo/glamo-mci.c
23 @@ -406,6 +406,14 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
24 u16 status;
25 int n;
26
27 + if (host->suspending) {
28 + cmd->error = -EIO;
29 + if (cmd->data)
30 + cmd->data->error = -EIO;
31 + mmc_request_done(mmc, mrq);
32 + return;
33 + }
34 +
35 host->ccnt++;
36 /*
37 * somehow 2.6.24 MCI manages to issue MMC_WRITE_BLOCK *without* the
38 @@ -792,6 +800,9 @@ static int glamo_mci_remove(struct platform_device *pdev)
39 static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
40 {
41 struct mmc_host *mmc = platform_get_drvdata(dev);
42 + struct glamo_mci_host *host = mmc_priv(mmc);
43 +
44 + host->suspending++;
45
46 return mmc_suspend_host(mmc, state);
47 }
48 @@ -799,6 +810,9 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
49 static int glamo_mci_resume(struct platform_device *dev)
50 {
51 struct mmc_host *mmc = platform_get_drvdata(dev);
52 + struct glamo_mci_host *host = mmc_priv(mmc);
53 +
54 + host->suspending--;
55
56 return mmc_resume_host(mmc);
57 }
58 diff --git a/drivers/mfd/glamo/glamo-mci.h b/drivers/mfd/glamo/glamo-mci.h
59 index 40c3e24..55852e7 100644
60 --- a/drivers/mfd/glamo/glamo-mci.h
61 +++ b/drivers/mfd/glamo/glamo-mci.h
62 @@ -34,6 +34,8 @@ struct glamo_mci_host {
63 int dma;
64 int data_max_size;
65
66 + int suspending;
67 +
68 int power_mode_current;
69 unsigned int vdd_current;
70
71 --
72 1.5.6.3
73