[ar71xx] preliminary support for the Ubiquiti RouterStation Pro
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1212-fix-gsm-resume-problems.patch.patch
1 From 2a1042fc56273fac721207597968af313751c17b Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 2 Jul 2008 22:43:53 +0100
4 Subject: [PATCH] fix-gsm-resume-problems.patch
5
6 Signed-off-by: Andy Green <andy@openmoko.com>
7 ---
8 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 32 ++++++++++++++++++++++++++++++++
9 drivers/serial/s3c2410.c | 17 +++++++++++++++++
10 2 files changed, 49 insertions(+), 0 deletions(-)
11
12 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
13 index 149b866..d70a481 100644
14 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
15 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
16 @@ -18,6 +18,7 @@
17 #include <linux/console.h>
18 #include <linux/errno.h>
19 #include <linux/interrupt.h>
20 +#include <linux/resume-dependency.h>
21
22 #include <asm/gpio.h>
23 #include <asm/mach-types.h>
24 @@ -33,9 +34,12 @@
25 struct gta01pm_priv {
26 int gpio_ngsm_en;
27 int gpio_ndl_gsm;
28 +
29 struct console *con;
30 };
31
32 +struct resume_dependency resume_dep_gsm_uart;
33 +
34 static struct gta01pm_priv gta01_gsm;
35
36 static struct console *find_s3c24xx_console(void)
37 @@ -179,6 +183,21 @@ static DEVICE_ATTR(reset, 0644, gsm_read, gsm_write);
38 static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
39
40 #ifdef CONFIG_PM
41 +static void gsm_resume_work(struct work_struct *w)
42 +{
43 + printk(KERN_INFO "%s: waiting...\n", __FUNCTION__);
44 + if (gsm_autounlock_delay)
45 + msleep(gsm_autounlock_delay);
46 + if (gsm_auto_flowcontrolled) {
47 + if (machine_is_neo1973_gta01())
48 + s3c24xx_fake_rx_interrupt(10000);
49 + s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
50 + gsm_auto_flowcontrolled = 0;
51 + }
52 + printk(KERN_INFO "%s: done.\n", __FUNCTION__);
53 +}
54 +
55 +static int gta01_gsm_resume(struct platform_device *pdev);
56 static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
57 {
58 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
59 @@ -189,11 +208,22 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
60 if (machine_is_neo1973_gta02())
61 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
62
63 + /* register our resume dependency on the appropriate UART being up */
64 + resume_dep_gsm_uart.callback = gta01_gsm_resume;
65 + resume_dep_gsm_uart.context = (void *)pdev;
66 +
67 + s3c24xx_serial_register_resume_dependency(&resume_dep_gsm_uart, 0);
68 +
69 return 0;
70 }
71
72 static int gta01_gsm_resume(struct platform_device *pdev)
73 {
74 + if (resume_dep_gsm_uart.called_flag != 1)
75 + return 0;
76 +
77 + resume_dep_gsm_uart.called_flag++; /* only run once */
78 +
79 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
80 * don't need to do much here. */
81
82 @@ -279,6 +309,8 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
83 if (machine_is_neo1973_gta02())
84 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
85
86 + init_resume_dependency_list(&resume_dep_gsm_uart);
87 +
88 return sysfs_create_group(&pdev->dev.kobj, &gta01_gsm_attr_group);
89 }
90
91 diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
92 index b566f42..bc6736d 100644
93 --- a/drivers/serial/s3c2410.c
94 +++ b/drivers/serial/s3c2410.c
95 @@ -72,6 +72,7 @@
96 #include <linux/serial.h>
97 #include <linux/delay.h>
98 #include <linux/clk.h>
99 +#include <linux/resume-dependency.h>
100
101 #include <asm/io.h>
102 #include <asm/irq.h>
103 @@ -112,6 +113,8 @@ struct s3c24xx_uart_port {
104 struct clk *clk;
105 struct clk *baudclk;
106 struct uart_port port;
107 +
108 + struct resume_dependency resume_dependency;
109 };
110
111
112 @@ -1085,6 +1088,8 @@ static int s3c24xx_serial_probe(struct platform_device *dev,
113 ourport = &s3c24xx_serial_ports[probe_index];
114 probe_index++;
115
116 + init_resume_dependency_list(&ourport->resume_dependency);
117 +
118 dbg("%s: initialising port %p...\n", __FUNCTION__, ourport);
119
120 ret = s3c24xx_serial_init_port(ourport, info, dev);
121 @@ -1125,6 +1130,16 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat
122 return 0;
123 }
124
125 +void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
126 + resume_dependency, int uart_index)
127 +{
128 + struct s3c24xx_uart_port *ourport = &s3c24xx_serial_ports[uart_index];
129 +
130 + register_resume_dependency(&ourport->resume_dependency,
131 + resume_dependency);
132 +}
133 +EXPORT_SYMBOL(s3c24xx_serial_register_resume_dependency);
134 +
135 static int s3c24xx_serial_resume(struct platform_device *dev)
136 {
137 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
138 @@ -1138,6 +1153,8 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
139 uart_resume_port(&s3c24xx_uart_drv, port);
140 }
141
142 + callback_all_resume_dependencies(&ourport->resume_dependency);
143 +
144 return 0;
145 }
146
147 --
148 1.5.6.5
149
This page took 0.051407 seconds and 5 git commands to generate.