add IXP4xx GPIOLIB support based on Chris' patch
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1191-fix-gsm-resume-problems.patch.patch
1 From 5bba01c998f5c88ab2337df915e135e0d950c7a9 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:16 +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 | 19 +++++++++++++++++++
9 drivers/serial/s3c2410.c | 19 ++++++++++++++++++-
10 2 files changed, 37 insertions(+), 1 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..6b6b2f4 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,8 @@ 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 +
42 +static int gta01_gsm_resume(struct platform_device *pdev);
43 static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
44 {
45 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
46 @@ -189,11 +195,22 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
47 if (machine_is_neo1973_gta02())
48 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
49
50 + /* register our resume dependency on the appropriate UART being up */
51 + resume_dep_gsm_uart.callback = gta01_gsm_resume;
52 + resume_dep_gsm_uart.context = (void *)pdev;
53 +
54 + s3c24xx_serial_register_resume_dependency(&resume_dep_gsm_uart, 0);
55 +
56 return 0;
57 }
58
59 static int gta01_gsm_resume(struct platform_device *pdev)
60 {
61 + if (resume_dep_gsm_uart.called_flag != 1)
62 + return 0;
63 +
64 + resume_dep_gsm_uart.called_flag++; /* only run once */
65 +
66 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
67 * don't need to do much here. */
68
69 @@ -279,6 +296,8 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
70 if (machine_is_neo1973_gta02())
71 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
72
73 + init_resume_dependency_list(&resume_dep_gsm_uart);
74 +
75 return sysfs_create_group(&pdev->dev.kobj, &gta01_gsm_attr_group);
76 }
77
78 diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
79 index bd87c79..32cceae 100644
80 --- a/drivers/serial/s3c2410.c
81 +++ b/drivers/serial/s3c2410.c
82 @@ -72,6 +72,7 @@
83 #include <linux/serial.h>
84 #include <linux/delay.h>
85 #include <linux/clk.h>
86 +#include <linux/resume-dependency.h>
87
88 #include <asm/io.h>
89 #include <asm/irq.h>
90 @@ -112,6 +113,8 @@ struct s3c24xx_uart_port {
91 struct clk *clk;
92 struct clk *baudclk;
93 struct uart_port port;
94 +
95 + struct resume_dependency resume_dependency;
96 };
97
98
99 @@ -1088,7 +1091,9 @@ static int s3c24xx_serial_probe(struct platform_device *dev,
100 ourport = &s3c24xx_serial_ports[probe_index];
101 probe_index++;
102
103 - dbg("%s: initialising port %p...\n", __func__, ourport);
104 + init_resume_dependency_list(&ourport->resume_dependency);
105 +
106 + dbg("%s: initialising port %p...\n", __FUNCTION__, ourport);
107
108 ret = s3c24xx_serial_init_port(ourport, info, dev);
109 if (ret < 0)
110 @@ -1128,6 +1133,16 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat
111 return 0;
112 }
113
114 +void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
115 + resume_dependency, int uart_index)
116 +{
117 + struct s3c24xx_uart_port *ourport = &s3c24xx_serial_ports[uart_index];
118 +
119 + register_resume_dependency(&ourport->resume_dependency,
120 + resume_dependency);
121 +}
122 +EXPORT_SYMBOL(s3c24xx_serial_register_resume_dependency);
123 +
124 static int s3c24xx_serial_resume(struct platform_device *dev)
125 {
126 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
127 @@ -1141,6 +1156,8 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
128 uart_resume_port(&s3c24xx_uart_drv, port);
129 }
130
131 + callback_all_resume_dependencies(&ourport->resume_dependency);
132 +
133 return 0;
134 }
135
136 --
137 1.5.6.3
138
This page took 0.049565 seconds and 5 git commands to generate.