1 --- a/drivers/serial/8250.c
2 +++ b/drivers/serial/8250.c
3 @@ -309,9 +309,9 @@ static const struct serial8250_config ua
7 -#if defined(CONFIG_MIPS_ALCHEMY)
8 +#if defined(CONFIG_MIPS_ALCHEMY) || 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 @@ -575,8 +575,8 @@ static inline void _serial_dl_write(stru
16 serial_outp(up, UART_DLM, value >> 8 & 0xff);
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)
25 if (up->port.iotype == UPIO_AU)
26 @@ -783,22 +783,19 @@ static int size_fifo(struct uart_8250_po
28 static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
30 - unsigned char old_dll, old_dlm, old_lcr;
31 + unsigned char old_lcr;
32 + unsigned int old_dl;
35 old_lcr = serial_inp(p, UART_LCR);
36 serial_outp(p, UART_LCR, UART_LCR_DLAB);
38 - old_dll = serial_inp(p, UART_DLL);
39 - old_dlm = serial_inp(p, UART_DLM);
40 + old_dl = serial_dl_read(p);
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);
47 - id = serial_inp(p, UART_DLL) | serial_inp(p, UART_DLM) << 8;
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);
55 --- a/drivers/serial/Kconfig
56 +++ b/drivers/serial/Kconfig
57 @@ -258,6 +258,14 @@ config SERIAL_8250_ACORN
58 system, say Y to this option. The driver can handle 1, 2, or 3 port
59 cards. If unsure, say N.
61 +config SERIAL_8250_RT288X
62 + bool "Ralink RT288x/RT305x serial port support"
63 + depends on SERIAL_8250 != n && (SOC_RT288X || SOC_RT305X)
65 + If you have a Ralink RT288x/RT305x SoC based board and want to use the
66 + serial port, say Y to this option. The driver can handle up to 2 serial
67 + ports. If unsure, say N.
69 config SERIAL_8250_RM9K
70 bool "Support for MIPS RM9xxx integrated serial port"
71 depends on SERIAL_8250 != n && SERIAL_RM9000
72 --- a/include/linux/serial_core.h
73 +++ b/include/linux/serial_core.h
74 @@ -302,7 +302,7 @@ struct uart_port {
77 #define UPIO_MEM32 (3)
78 -#define UPIO_AU (4) /* Au1x00 type IO */
79 +#define UPIO_AU (4) /* Au1x00 and RT288x type IO */
80 #define UPIO_TSI (5) /* Tsi108/109 type IO */
81 #define UPIO_DWAPB (6) /* DesignWare APB UART */
82 #define UPIO_RM9000 (7) /* RM9000 type IO */