add support for target 3c24xx (more known as Openmoko GTA02 "Freerunner") and merge...
[openwrt/openwrt.git] / target / linux / s3c24xx / patches / 0242-silence-serial-console-gta01.patch.patch
1 From 85ef1fb82db8188fd5a615e557bf5407113d163f Mon Sep 17 00:00:00 2001
2 From: Mike Westerhof <mwester@dls.net>
3 Date: Sun, 10 Aug 2008 09:13:20 +0100
4 Subject: [PATCH] silence-serial-console-gta01.patch
5
6 This patch ensures that no console data will go the UART while
7 the GSM mux is switched to the GSM. This is necessary despite
8 the code that disables the console due to the fact that the
9 console resumes before the neo1973_pm_gsm driver, and consoles
10 always resume in the "on" state.
11
12 Signed-off-by: Mike Westerhof <mwester@dls.net>
13 ---
14 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 3 +++
15 drivers/serial/s3c2410.c | 10 ++++++++++
16 2 files changed, 13 insertions(+), 0 deletions(-)
17
18 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
19 index 901f8fb..8d5e41c 100644
20 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
21 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
22 @@ -31,6 +31,7 @@
23 #include <asm/arch/regs-gpioj.h>
24 #endif
25
26 +extern void s3c24xx_serial_console_set_silence(int silence);
27 extern void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
28 resume_dependency, int uart_index);
29
30 @@ -105,6 +106,7 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
31 "disconnecting serial console\n");
32
33 console_stop(gta01_gsm.con);
34 + s3c24xx_serial_console_set_silence(1);
35 }
36
37 if (gta01_gsm.gpio_ngsm_en)
38 @@ -144,6 +146,7 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
39 s3c2410_gpio_setpin(gta01_gsm.gpio_ngsm_en, 1);
40
41 if (gta01_gsm.con) {
42 + s3c24xx_serial_console_set_silence(0);
43 console_start(gta01_gsm.con);
44
45 dev_dbg(dev, "powered down GSM, thus enabling "
46 diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
47 index d0b55b1..8de1564 100644
48 --- a/drivers/serial/s3c2410.c
49 +++ b/drivers/serial/s3c2410.c
50 @@ -1791,6 +1791,13 @@ module_exit(s3c24xx_serial_modexit);
51 #ifdef CONFIG_SERIAL_S3C2410_CONSOLE
52
53 static struct uart_port *cons_uart;
54 +static int cons_silenced;
55 +
56 +void s3c24xx_serial_console_set_silence(int silenced)
57 +{
58 + cons_silenced = silenced;
59 +}
60 +EXPORT_SYMBOL(s3c24xx_serial_console_set_silence);
61
62 static int
63 s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
64 @@ -1817,6 +1824,9 @@ s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
65 unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
66 unsigned int umcon = rd_regl(cons_uart, S3C2410_UMCON);
67
68 + if (cons_silenced)
69 + return;
70 +
71 /* If auto HW flow control enabled, temporarily turn it off */
72 if (umcon & S3C2410_UMCOM_AFC)
73 wr_regl(port, S3C2410_UMCON, (umcon & !S3C2410_UMCOM_AFC));
74 --
75 1.5.6.3
76