Root/target/linux/ramips/patches-3.2/101-rt288x_serial_driver_hack.patch

1--- a/drivers/tty/serial/8250.c
2+++ b/drivers/tty/serial/8250.c
3@@ -318,9 +318,9 @@ static const struct serial8250_config ua
4     },
5 };
6 
7-#if defined(CONFIG_MIPS_ALCHEMY)
8+#if defined(CONFIG_MIPS_ALCHEMY) || defined (CONFIG_SERIAL_8250_RT288X)
9 
10-/* Au1x00 UART hardware has a weird register layout */
11+/* Au1x00 and RT288x UART hardware has a weird register layout */
12 static const u8 au_io_in_map[] = {
13     [UART_RX] = 0,
14     [UART_IER] = 2,
15@@ -542,8 +542,8 @@ static inline void _serial_dl_write(stru
16     serial_outp(up, UART_DLM, value >> 8 & 0xff);
17 }
18 
19-#if defined(CONFIG_MIPS_ALCHEMY)
20-/* Au1x00 haven't got a standard divisor latch */
21+#if defined(CONFIG_MIPS_ALCHEMY) || defined (CONFIG_SERIAL_8250_RT288X)
22+/* Au1x00 and RT288x haven't got a standard divisor latch */
23 static int serial_dl_read(struct uart_8250_port *up)
24 {
25     if (up->port.iotype == UPIO_AU)
26@@ -750,22 +750,19 @@ static int size_fifo(struct uart_8250_po
27  */
28 static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
29 {
30- unsigned char old_dll, old_dlm, old_lcr;
31+ unsigned char old_lcr;
32+ unsigned int old_dl;
33     unsigned int id;
34 
35     old_lcr = serial_inp(p, UART_LCR);
36     serial_outp(p, UART_LCR, UART_LCR_CONF_MODE_A);
37 
38- old_dll = serial_inp(p, UART_DLL);
39- old_dlm = serial_inp(p, UART_DLM);
40+ old_dl = serial_dl_read(p);
41 
42- serial_outp(p, UART_DLL, 0);
43- serial_outp(p, UART_DLM, 0);
44+ serial_dl_write(p, 0);
45+ id = serial_dl_read(p);
46 
47- id = serial_inp(p, UART_DLL) | serial_inp(p, UART_DLM) << 8;
48-
49- serial_outp(p, UART_DLL, old_dll);
50- serial_outp(p, UART_DLM, old_dlm);
51+ serial_dl_write(p, old_dl);
52     serial_outp(p, UART_LCR, old_lcr);
53 
54     return id;
55@@ -891,7 +888,7 @@ static int broken_efr(struct uart_8250_p
56     /*
57      * Exar ST16C2550 "A2" devices incorrectly detect as
58      * having an EFR, and report an ID of 0x0201. See
59- * http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-11/4812.html
60+ * http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-11/4812.html
61      */
62     if (autoconfig_read_divisor_id(up) == 0x0201 && size_fifo(up) == 16)
63         return 1;
64--- a/drivers/tty/serial/Kconfig
65+++ b/drivers/tty/serial/Kconfig
66@@ -258,6 +258,14 @@ config SERIAL_8250_ACORN
67       system, say Y to this option. The driver can handle 1, 2, or 3 port
68       cards. If unsure, say N.
69 
70+config SERIAL_8250_RT288X
71+ bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support"
72+ depends on SERIAL_8250 != n && (SOC_RT288X || SOC_RT305X || SOC_RT3883)
73+ help
74+ If you have a Ralink RT288x/RT305x SoC based board and want to use the
75+ serial port, say Y to this option. The driver can handle up to 2 serial
76+ ports. If unsure, say N.
77+
78 config SERIAL_8250_RM9K
79     bool "Support for MIPS RM9xxx integrated serial port"
80     depends on SERIAL_8250 != n && SERIAL_RM9000
81--- a/include/linux/serial_core.h
82+++ b/include/linux/serial_core.h
83@@ -317,7 +317,7 @@ struct uart_port {
84 #define UPIO_HUB6 (1)
85 #define UPIO_MEM (2)
86 #define UPIO_MEM32 (3)
87-#define UPIO_AU (4) /* Au1x00 type IO */
88+#define UPIO_AU (4) /* Au1x00 and RT288x type IO */
89 #define UPIO_TSI (5) /* Tsi108/109 type IO */
90 #define UPIO_RM9000 (6) /* RM9000 type IO */
91 
92

Archive Download this file



interactive