e506103424d60e4d72d3b50cc79694960c1b78ab
[openwrt/svn-archive/archive.git] / target / linux / rb532 / patches-2.6.28 / 022-rb532_uart_autodetect.patch
1 Auto-detection works just fine, so use it instead of specifying the type
2 manually. Also define a platform device for the uart, as suggested by
3 David Daney.
4
5 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
6 ---
7 arch/mips/rb532/devices.c | 26 ++++++++++++++++++++++++++
8 arch/mips/rb532/serial.c | 2 +-
9 2 files changed, 27 insertions(+), 1 deletions(-)
10
11 --- a/arch/mips/rb532/devices.c
12 +++ b/arch/mips/rb532/devices.c
13 @@ -24,6 +24,7 @@
14 #include <linux/mtd/partitions.h>
15 #include <linux/gpio_keys.h>
16 #include <linux/input.h>
17 +#include <linux/serial_8250.h>
18
19 #include <asm/bootinfo.h>
20
21 @@ -39,6 +40,8 @@
22 #define ETH0_RX_DMA_ADDR (DMA0_BASE_ADDR + 0 * DMA_CHAN_OFFSET)
23 #define ETH0_TX_DMA_ADDR (DMA0_BASE_ADDR + 1 * DMA_CHAN_OFFSET)
24
25 +extern unsigned int idt_cpu_freq;
26 +
27 static struct resource korina_dev0_res[] = {
28 {
29 .name = "korina_regs",
30 @@ -214,12 +217,32 @@ static struct platform_device rb532_wdt
31 .num_resources = ARRAY_SIZE(rb532_wdt_res),
32 };
33
34 +static struct plat_serial8250_port rb532_uart_res[] = {
35 + {
36 + .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE),
37 + .irq = UART0_IRQ,
38 + .regshift = 2,
39 + .iotype = UPIO_MEM,
40 + .flags = UPF_BOOT_AUTOCONF,
41 + },
42 + {
43 + .flags = 0,
44 + }
45 +};
46 +
47 +static struct platform_device rb532_uart = {
48 + .name = "serial8250",
49 + .id = PLAT8250_DEV_PLATFORM,
50 + .dev.platform_data = &rb532_uart_res,
51 +};
52 +
53 static struct platform_device *rb532_devs[] = {
54 &korina_dev0,
55 &nand_slot0,
56 &cf_slot0,
57 &rb532_led,
58 &rb532_button,
59 + &rb532_uart,
60 &rb532_wdt
61 };
62
63 @@ -294,6 +317,9 @@ static int __init plat_setup_devices(voi
64 /* Initialise the NAND device */
65 rb532_nand_setup();
66
67 + /* set the uart clock to the current cpu frequency */
68 + rb532_uart_res[0].uartclk = idt_cpu_freq;
69 +
70 return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
71 }
72
73 --- a/arch/mips/rb532/serial.c
74 +++ b/arch/mips/rb532/serial.c
75 @@ -36,7 +36,7 @@
76 extern unsigned int idt_cpu_freq;
77
78 static struct uart_port rb532_uart = {
79 - .type = PORT_16550A,
80 + .flags = UPF_BOOT_AUTOCONF,
81 .line = 0,
82 .irq = UART0_IRQ,
83 .iotype = UPIO_MEM,