[kernel] generic-2.6/2.6.28: add missing Kconfig option
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1084-fix-glamo-mci-fake-reset-opcode-in-suspend.patch.patch
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
5
6 ---
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(-)
11
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);
18 break;
19 }
20 + mangle_glamo_res_by_system_rev();
21 + platform_device_register(&gta02_glamo_dev);
22
23 platform_device_register(&s3c_device_spi_acc);
24 platform_device_register(&gta01_button_dev);
25 @@ -1291,8 +1293,6 @@ static void __init gta02_machine_init(void)
26 platform_device_register(&gta01_led_dev);
27 platform_device_register(&gta02_led_dev);
28
29 - mangle_glamo_res_by_system_rev();
30 - platform_device_register(&gta02_glamo_dev);
31
32 platform_device_register(&gta02_sdio_dev);
33
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,
39 {
40 spin_lock(&glamo->lock);
41
42 + dev_dbg(&glamo->pdev->dev, "***** glamo_power -> %d\n", new_state);
43 +
44 switch (new_state) {
45 case GLAMO_POWER_ON:
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;
50
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);
57 -
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);
64
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);
71 +
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);
81 u16 status;
82 int n;
83 + int timeout = 100000000;
84
85 if (host->suspending) {
86 - cmd->error = -EIO;
87 - if (cmd->data)
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);
92 return;
93 }
94 @@ -502,10 +502,23 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
95 * our own INT# line"
96 */
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))
101 + /*
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
105 + */
106 + while ((!(readw_dly(glamo_mci_def_pdata.pglamo->base +
107 + GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC)) &&
108 + (timeout--))
109 ;
110 +
111 + if (timeout < 0) {
112 + if (cmd->data->error)
113 + cmd->data->error = -ETIMEDOUT;
114 + dev_err(&host->pdev->dev, "Payload timeout\n");
115 + return;
116 + }
117 +
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)
122
123 static void glamo_mci_reset(struct glamo_mci_host *host)
124 {
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);
131
132 host->suspending++;
133 -
134 - return mmc_suspend_host(mmc, state);
135 + return mmc_suspend_host(mmc, state);
136 }
137
138 static int glamo_mci_resume(struct platform_device *dev)
139 --
140 1.5.6.3
141
This page took 0.0445 seconds and 5 git commands to generate.