1 From f26eee35ae154c2be8a6e23f3e6a45f01f50f7a7 Mon Sep 17 00:00:00 2001
2 From: warmcat <andy@warmcat.com>
3 Date: Fri, 25 Jul 2008 23:06:01 +0100
4 Subject: [PATCH] fix-glamo-mci-fake-reset-opcode-in-suspend.patch
7 arch/arm/mach-s3c2440/mach-gta02.c | 4 ++--
8 drivers/mfd/glamo/glamo-core.c | 16 +++++++++-------
9 drivers/mfd/glamo/glamo-mci.c | 29 +++++++++++++++++++++--------
10 3 files changed, 32 insertions(+), 17 deletions(-)
12 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
13 index 750fd97..f18c8fd 100644
14 --- a/arch/arm/mach-s3c2440/mach-gta02.c
15 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
16 @@ -1281,6 +1281,8 @@ static void __init gta02_machine_init(void)
17 s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 1);
20 + mangle_glamo_res_by_system_rev();
21 + platform_device_register(>a02_glamo_dev);
23 platform_device_register(&s3c_device_spi_acc);
24 platform_device_register(>a01_button_dev);
25 @@ -1291,8 +1293,6 @@ static void __init gta02_machine_init(void)
26 platform_device_register(>a01_led_dev);
27 platform_device_register(>a02_led_dev);
29 - mangle_glamo_res_by_system_rev();
30 - platform_device_register(>a02_glamo_dev);
32 platform_device_register(>a02_sdio_dev);
34 diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
35 index 2076e61..4d8e47f 100644
36 --- a/drivers/mfd/glamo/glamo-core.c
37 +++ b/drivers/mfd/glamo/glamo-core.c
38 @@ -822,6 +822,8 @@ static void glamo_power(struct glamo_core *glamo,
40 spin_lock(&glamo->lock);
42 + dev_dbg(&glamo->pdev->dev, "***** glamo_power -> %d\n", new_state);
46 /* power up PLL1 and PLL2 */
47 @@ -1026,13 +1028,6 @@ static int __init glamo_probe(struct platform_device *pdev)
48 glamo_mci_def_pdata.glamo_irq_is_wired =
49 glamo->pdata->glamo_irq_is_wired;
51 - glamo_mmc_dev.dev.parent = &pdev->dev;
52 - /* we need it later to give to the engine enable and disable */
53 - glamo_mci_def_pdata.pglamo = glamo;
54 - mangle_mem_resources(glamo_mmc_dev.resource,
55 - glamo_mmc_dev.num_resources, glamo->mem);
56 - platform_device_register(&glamo_mmc_dev);
58 glamo_2d_dev.dev.parent = &pdev->dev;
59 mangle_mem_resources(glamo_2d_dev.resource,
60 glamo_2d_dev.num_resources, glamo->mem);
61 @@ -1065,6 +1060,13 @@ static int __init glamo_probe(struct platform_device *pdev)
62 glamo_spigpio_dev.dev.platform_data = glamo->pdata->spigpio_info;
63 platform_device_register(&glamo_spigpio_dev);
65 + glamo_mmc_dev.dev.parent = &pdev->dev;
66 + /* we need it later to give to the engine enable and disable */
67 + glamo_mci_def_pdata.pglamo = glamo;
68 + mangle_mem_resources(glamo_mmc_dev.resource,
69 + glamo_mmc_dev.num_resources, glamo->mem);
70 + platform_device_register(&glamo_mmc_dev);
72 /* only request the generic, hostbus and memory controller MMIO */
73 glamo->mem = request_mem_region(glamo->mem->start,
74 GLAMO_REGOFS_VIDCAP, "glamo-core");
75 diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
76 index bbbbe4d..d8847c5 100644
77 --- a/drivers/mfd/glamo/glamo-mci.c
78 +++ b/drivers/mfd/glamo/glamo-mci.c
79 @@ -405,11 +405,11 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
80 u16 * reg_resp = (u16 *)(host->base + GLAMO_REG_MMC_CMD_RSP1);
83 + int timeout = 100000000;
85 if (host->suspending) {
88 - cmd->data->error = -EIO;
89 + dev_err(&host->pdev->dev, "faking cmd %d "
90 + "during suspend\n", cmd->opcode);
91 mmc_request_done(mmc, mrq);
94 @@ -502,10 +502,23 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
97 if (!glamo_mci_def_pdata.pglamo->irq_works) {
98 - /* we have faith we will get an "interrupt"... */
99 - while (!(readw_dly(glamo_mci_def_pdata.pglamo->base +
100 - GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC))
102 + * we have faith we will get an "interrupt"...
103 + * but something insane like suspend problems can mean
104 + * we spin here forever, so we timeout after a LONG time
106 + while ((!(readw_dly(glamo_mci_def_pdata.pglamo->base +
107 + GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC)) &&
112 + if (cmd->data->error)
113 + cmd->data->error = -ETIMEDOUT;
114 + dev_err(&host->pdev->dev, "Payload timeout\n");
118 /* yay we are an interrupt controller! -- call the ISR */
119 glamo_mci_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC),
120 irq_desc + IRQ_GLAMO(GLAMO_IRQIDX_MMC));
121 @@ -529,6 +542,7 @@ static void glamo_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
123 static void glamo_mci_reset(struct glamo_mci_host *host)
125 + dev_dbg(&host->pdev->dev, "******* glamo_mci_reset\n");
126 /* reset MMC controller */
127 writew_dly(GLAMO_CLOCK_MMC_RESET | GLAMO_CLOCK_MMC_DG_TCLK |
128 GLAMO_CLOCK_MMC_EN_TCLK | GLAMO_CLOCK_MMC_DG_M9CLK |
129 @@ -803,8 +817,7 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
130 struct glamo_mci_host *host = mmc_priv(mmc);
134 - return mmc_suspend_host(mmc, state);
135 + return mmc_suspend_host(mmc, state);
138 static int glamo_mci_resume(struct platform_device *dev)