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