ar71xx: register UART for the AR933X SoCs
[openwrt.git] / target / linux / ramips / patches-2.6.37 / 101-rt288x_serial_driver_hack.patch
1 --- a/drivers/serial/8250.c
2 +++ b/drivers/serial/8250.c
3 @@ -305,9 +305,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 @@ -571,8 +571,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 @@ -779,22 +779,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_DLAB);
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 --- 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.
60
61 +config SERIAL_8250_RT288X
62 + bool "Ralink RT288x/RT305x serial port support"
63 + depends on SERIAL_8250 != n && (SOC_RT288X || SOC_RT305X)
64 + help
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.
68 +
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 @@ -307,7 +307,7 @@ struct uart_port {
75 #define UPIO_HUB6 (1)
76 #define UPIO_MEM (2)
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 */
This page took 0.038949 seconds and 5 git commands to generate.