38ef41abf7d0ba595f72fb3859155f791554e4eb
[openwrt.git] / target / linux / ramips / patches-3.8 / 0015-serial-ralink-adds-support-for-the-serial-core-found.patch
1 From c420811f117a59a4a7d4e34b362437b91c7fafa1 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 25 Jan 2013 19:39:51 +0100
4 Subject: [PATCH] serial: ralink: adds support for the serial core found on
5  ralink wisoc
6
7 The MIPS based Ralink WiSoC platform has 1 or more 8250 compatible serial cores.
8 To make them work we require the same quirks that are used by AU1x00.
9
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 ---
13  drivers/tty/serial/8250/8250.c  |    6 +++---
14  drivers/tty/serial/8250/Kconfig |    8 ++++++++
15  include/linux/serial_core.h     |    2 +-
16  3 files changed, 12 insertions(+), 4 deletions(-)
17
18 --- a/drivers/tty/serial/8250/8250.c
19 +++ b/drivers/tty/serial/8250/8250.c
20 @@ -345,9 +345,9 @@ static void default_serial_dl_write(stru
21         serial_out(up, UART_DLM, value >> 8 & 0xff);
22  }
23  
24 -#ifdef CONFIG_MIPS_ALCHEMY
25 +#if defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_SERIAL_8250_RT288X)
26  
27 -/* Au1x00 UART hardware has a weird register layout */
28 +/* Au1x00/RT288x UART hardware has a weird register layout */
29  static const u8 au_io_in_map[] = {
30         [UART_RX]  = 0,
31         [UART_IER] = 2,
32 @@ -527,7 +527,7 @@ static void set_io_from_upio(struct uart
33                 break;
34  #endif
35  
36 -#ifdef CONFIG_MIPS_ALCHEMY
37 +#if defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_SERIAL_8250_RT288X)
38         case UPIO_AU:
39                 p->serial_in = au_serial_in;
40                 p->serial_out = au_serial_out;
41 --- a/drivers/tty/serial/8250/Kconfig
42 +++ b/drivers/tty/serial/8250/Kconfig
43 @@ -277,3 +277,11 @@ config SERIAL_8250_EM
44           Selecting this option will add support for the integrated serial
45           port hardware found on the Emma Mobile line of processors.
46           If unsure, say N.
47 +
48 +config SERIAL_8250_RT288X
49 +       bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support"
50 +       depends on SERIAL_8250 && (SOC_RT288X || SOC_RT305X || SOC_RT3883)
51 +       help
52 +         If you have a Ralink RT288x/RT305x SoC based board and want to use the
53 +         serial port, say Y to this option. The driver can handle up to 2 serial
54 +         ports. If unsure, say N.
55 --- a/include/linux/serial_core.h
56 +++ b/include/linux/serial_core.h
57 @@ -134,7 +134,7 @@ struct uart_port {
58  #define UPIO_HUB6              (1)
59  #define UPIO_MEM               (2)
60  #define UPIO_MEM32             (3)
61 -#define UPIO_AU                        (4)                     /* Au1x00 type IO */
62 +#define UPIO_AU                        (4)                     /* Au1x00 and RT288x type IO */
63  #define UPIO_TSI               (5)                     /* Tsi108/109 type IO */
64  #define UPIO_RM9000            (6)                     /* RM9000 type IO */
65