1 --- a/drivers/serial/8250.c
2 +++ b/drivers/serial/8250.c
3 @@ -301,9 +301,9 @@ static const struct serial8250_config ua
7 -#if defined (CONFIG_SERIAL_8250_AU1X00)
8 +#if defined (CONFIG_SERIAL_8250_AU1X00) || defined (CONFIG_SERIAL_8250_RT288X)
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[] = {
15 @@ -421,7 +421,7 @@ static unsigned int mem32_serial_in(stru
16 return readl(p->membase + offset);
19 -#ifdef CONFIG_SERIAL_8250_AU1X00
20 +#if defined(CONFIG_SERIAL_8250_AU1X00) || defined(CONFIG_SERIAL_8250_RT288X)
21 static unsigned int au_serial_in(struct uart_port *p, int offset)
23 offset = map_8250_in_reg(p, offset) << p->regshift;
24 @@ -502,7 +502,7 @@ static void set_io_from_upio(struct uart
25 p->serial_out = mem32_serial_out;
28 -#ifdef CONFIG_SERIAL_8250_AU1X00
29 +#if defined (CONFIG_SERIAL_8250_AU1X00) || defined (CONFIG_SERIAL_8250_RT288X)
31 p->serial_in = au_serial_in;
32 p->serial_out = au_serial_out;
33 @@ -534,7 +534,7 @@ serial_out_sync(struct uart_8250_port *u
37 -#ifdef CONFIG_SERIAL_8250_AU1X00
38 +#if defined (CONFIG_SERIAL_8250_AU1X00) || defined (CONFIG_SERIAL_8250_RT288X)
42 @@ -572,8 +572,8 @@ static inline void _serial_dl_write(stru
43 serial_outp(up, UART_DLM, value >> 8 & 0xff);
46 -#if defined(CONFIG_SERIAL_8250_AU1X00)
47 -/* Au1x00 haven't got a standard divisor latch */
48 +#if defined (CONFIG_SERIAL_8250_AU1X00) || defined (CONFIG_SERIAL_8250_RT288X)
49 +/* Au1x00 and RT288x haven't got a standard divisor latch */
50 static int serial_dl_read(struct uart_8250_port *up)
52 if (up->port.iotype == UPIO_AU)
53 @@ -780,22 +780,19 @@ static int size_fifo(struct uart_8250_po
55 static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
57 - unsigned char old_dll, old_dlm, old_lcr;
58 + unsigned char old_lcr;
59 + unsigned int old_dl;
62 old_lcr = serial_inp(p, UART_LCR);
63 serial_outp(p, UART_LCR, UART_LCR_DLAB);
65 - old_dll = serial_inp(p, UART_DLL);
66 - old_dlm = serial_inp(p, UART_DLM);
67 + old_dl = serial_dl_read(p);
69 - serial_outp(p, UART_DLL, 0);
70 - serial_outp(p, UART_DLM, 0);
71 + serial_dl_write(p, 0);
72 + id = serial_dl_read(p);
74 - id = serial_inp(p, UART_DLL) | serial_inp(p, UART_DLM) << 8;
76 - serial_outp(p, UART_DLL, old_dll);
77 - serial_outp(p, UART_DLM, old_dlm);
78 + serial_dl_write(p, old_dl);
79 serial_outp(p, UART_LCR, old_lcr);
82 @@ -1217,7 +1214,7 @@ static void autoconfig(struct uart_8250_
86 -#ifdef CONFIG_SERIAL_8250_AU1X00
87 +#if defined (CONFIG_SERIAL_8250_AU1X00) || defined (CONFIG_SERIAL_8250_RT288X)
88 /* if access method is AU, it is a 16550 with a quirk */
89 if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU)
90 up->bugs |= UART_BUG_NOMSR;
91 --- a/drivers/serial/Kconfig
92 +++ b/drivers/serial/Kconfig
93 @@ -266,6 +266,14 @@ config SERIAL_8250_AU1X00
94 say Y to this option. The driver can handle up to 4 serial ports,
95 depending on the SOC. If unsure, say N.
97 +config SERIAL_8250_RT288X
98 + bool "Ralink RT288x/RT305x serial port support"
99 + depends on SERIAL_8250 != n && (SOC_RT288X || SOC_RT305X)
101 + If you have a Ralink RT288x/RT305x SoC based board and want to use the
102 + serial port, say Y to this option. The driver can handle up to 2 serial
103 + ports. If unsure, say N.
105 config SERIAL_8250_RM9K
106 bool "Support for MIPS RM9xxx integrated serial port"
107 depends on SERIAL_8250 != n && SERIAL_RM9000
108 --- a/include/linux/serial_core.h
109 +++ b/include/linux/serial_core.h
110 @@ -281,7 +281,7 @@ struct uart_port {
111 #define UPIO_HUB6 (1)
113 #define UPIO_MEM32 (3)
114 -#define UPIO_AU (4) /* Au1x00 type IO */
115 +#define UPIO_AU (4) /* Au1x00 and RT288x type IO */
116 #define UPIO_TSI (5) /* Tsi108/109 type IO */
117 #define UPIO_DWAPB (6) /* DesignWare APB UART */
118 #define UPIO_RM9000 (7) /* RM9000 type IO */