From 6da7929da1b46bccaae0f53bf7a26cdd74a3b70a Mon Sep 17 00:00:00 2001
From: Mike Westerhof <mwester@dls.net>
Date: Wed, 2 Jul 2008 22:44:01 +0100
Subject: [PATCH] clean-gsm-flow-control.patch

Signed-off-by: Mike Westerhof <mwester@dls.net>

 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c |   52 +-------
 drivers/serial/s3c2410.c               |  204 +++-----------------------------
 2 files changed, 24 insertions(+), 232 deletions(-)
---
 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c |   32 ++++++++++++++++++--------------
 drivers/serial/s3c2410.c               |    3 ++-
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
index d70a481..f3c9504 100644
--- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
@@ -31,6 +31,18 @@
 #include <asm/arch/regs-gpioj.h>
 #endif
 
+extern void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
+					     resume_dependency, int uart_index);
+
+/* flag set if we flow-controlled the GSM in our suspend routine */
+int gsm_auto_flowcontrolled;
+
+int gta01_gsm_enabled;
+EXPORT_SYMBOL(gta01_gsm_enabled);
+
+int gta_gsm_interrupts;
+EXPORT_SYMBOL(gta_gsm_interrupts);
+
 struct gta01pm_priv {
 	int gpio_ngsm_en;
         int gpio_ndl_gsm;
@@ -183,20 +195,6 @@ static DEVICE_ATTR(reset, 0644, gsm_read, gsm_write);
 static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
 
 #ifdef CONFIG_PM
-static void gsm_resume_work(struct work_struct *w)
-{
-	printk(KERN_INFO "%s: waiting...\n", __FUNCTION__);
-	if (gsm_autounlock_delay)
-		msleep(gsm_autounlock_delay);
-	if (gsm_auto_flowcontrolled) {
-		if (machine_is_neo1973_gta01())
-			s3c24xx_fake_rx_interrupt(10000);
-		s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
-		gsm_auto_flowcontrolled = 0;
-	}
-	printk(KERN_INFO "%s: done.\n", __FUNCTION__);
-}
-
 static int gta01_gsm_resume(struct platform_device *pdev);
 static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
 {
@@ -235,6 +233,12 @@ static int gta01_gsm_resume(struct platform_device *pdev)
 	if (machine_is_neo1973_gta02())
 		s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, gta01_gsm.gpio_ndl_gsm);
 
+	/* If we forced flow-control on the GSM, we should also release it */
+	if (gsm_auto_flowcontrolled) {
+		s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
+		gsm_auto_flowcontrolled = 0;
+	}
+
 	return 0;
 }
 #else
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index bc6736d..73c6284 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -385,7 +385,8 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
 		if (uart_handle_sysrq_char(port, ch))
 			goto ignore_char;
 
-		uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch, flag);
+		uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch,
+									  flag);
 
 	ignore_char:
 		continue;
-- 
1.5.6.5