1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-09 10:39:21 +02:00
openwrt-xburst/target/linux/s3c24xx/patches-2.6.26/1191-fix-gsm-resume-problems.patch.patch

139 lines
4.1 KiB
Diff
Raw Normal View History

From 5bba01c998f5c88ab2337df915e135e0d950c7a9 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Fri, 25 Jul 2008 23:06:16 +0100
Subject: [PATCH] fix-gsm-resume-problems.patch
Signed-off-by: Andy Green <andy@openmoko.com>
---
arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 19 +++++++++++++++++++
drivers/serial/s3c2410.c | 19 ++++++++++++++++++-
2 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
index 149b866..6b6b2f4 100644
--- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
@@ -18,6 +18,7 @@
#include <linux/console.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
+#include <linux/resume-dependency.h>
#include <asm/gpio.h>
#include <asm/mach-types.h>
@@ -33,9 +34,12 @@
struct gta01pm_priv {
int gpio_ngsm_en;
int gpio_ndl_gsm;
+
struct console *con;
};
+struct resume_dependency resume_dep_gsm_uart;
+
static struct gta01pm_priv gta01_gsm;
static struct console *find_s3c24xx_console(void)
@@ -179,6 +183,8 @@ static DEVICE_ATTR(reset, 0644, gsm_read, gsm_write);
static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
#ifdef CONFIG_PM
+
+static int gta01_gsm_resume(struct platform_device *pdev);
static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
{
/* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
@@ -189,11 +195,22 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
if (machine_is_neo1973_gta02())
s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
+ /* register our resume dependency on the appropriate UART being up */
+ resume_dep_gsm_uart.callback = gta01_gsm_resume;
+ resume_dep_gsm_uart.context = (void *)pdev;
+
+ s3c24xx_serial_register_resume_dependency(&resume_dep_gsm_uart, 0);
+
return 0;
}
static int gta01_gsm_resume(struct platform_device *pdev)
{
+ if (resume_dep_gsm_uart.called_flag != 1)
+ return 0;
+
+ resume_dep_gsm_uart.called_flag++; /* only run once */
+
/* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
* don't need to do much here. */
@@ -279,6 +296,8 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
if (machine_is_neo1973_gta02())
s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
+ init_resume_dependency_list(&resume_dep_gsm_uart);
+
return sysfs_create_group(&pdev->dev.kobj, &gta01_gsm_attr_group);
}
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index bd87c79..32cceae 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -72,6 +72,7 @@
#include <linux/serial.h>
#include <linux/delay.h>
#include <linux/clk.h>
+#include <linux/resume-dependency.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -112,6 +113,8 @@ struct s3c24xx_uart_port {
struct clk *clk;
struct clk *baudclk;
struct uart_port port;
+
+ struct resume_dependency resume_dependency;
};
@@ -1088,7 +1091,9 @@ static int s3c24xx_serial_probe(struct platform_device *dev,
ourport = &s3c24xx_serial_ports[probe_index];
probe_index++;
- dbg("%s: initialising port %p...\n", __func__, ourport);
+ init_resume_dependency_list(&ourport->resume_dependency);
+
+ dbg("%s: initialising port %p...\n", __FUNCTION__, ourport);
ret = s3c24xx_serial_init_port(ourport, info, dev);
if (ret < 0)
@@ -1128,6 +1133,16 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat
return 0;
}
+void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
+ resume_dependency, int uart_index)
+{
+ struct s3c24xx_uart_port *ourport = &s3c24xx_serial_ports[uart_index];
+
+ register_resume_dependency(&ourport->resume_dependency,
+ resume_dependency);
+}
+EXPORT_SYMBOL(s3c24xx_serial_register_resume_dependency);
+
static int s3c24xx_serial_resume(struct platform_device *dev)
{
struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
@@ -1141,6 +1156,8 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
uart_resume_port(&s3c24xx_uart_drv, port);
}
+ callback_all_resume_dependencies(&ourport->resume_dependency);
+
return 0;
}
--
1.5.6.3