add preliminary Marvell Kirkwood support
[openwrt.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 diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
12 index c1c2918..9b6b744 100644
13 --- a/arch/mips/rb532/devices.c
14 +++ b/arch/mips/rb532/devices.c
15 @@ -24,6 +24,7 @@
16 #include <linux/mtd/partitions.h>
17 #include <linux/gpio_keys.h>
18 #include <linux/input.h>
19 +#include <linux/serial_8250.h>
20
21 #include <asm/bootinfo.h>
22
23 @@ -39,6 +40,8 @@
24 #define ETH0_RX_DMA_ADDR (DMA0_BASE_ADDR + 0 * DMA_CHAN_OFFSET)
25 #define ETH0_TX_DMA_ADDR (DMA0_BASE_ADDR + 1 * DMA_CHAN_OFFSET)
26
27 +extern unsigned int idt_cpu_freq;
28 +
29 static struct resource korina_dev0_res[] = {
30 {
31 .name = "korina_regs",
32 @@ -214,12 +217,32 @@ static struct platform_device rb532_wdt = {
33 .num_resources = ARRAY_SIZE(rb532_wdt_res),
34 };
35
36 +static struct plat_serial8250_port rb532_uart_res[] = {
37 + {
38 + .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE),
39 + .irq = UART0_IRQ,
40 + .regshift = 2,
41 + .iotype = UPIO_MEM,
42 + .flags = UPF_BOOT_AUTOCONF,
43 + },
44 + {
45 + .flags = 0,
46 + }
47 +};
48 +
49 +static struct platform_device rb532_uart = {
50 + .name = "serial8250",
51 + .id = PLAT8250_DEV_PLATFORM,
52 + .dev.platform_data = &rb532_uart_res,
53 +};
54 +
55 static struct platform_device *rb532_devs[] = {
56 &korina_dev0,
57 &nand_slot0,
58 &cf_slot0,
59 &rb532_led,
60 &rb532_button,
61 + &rb532_uart,
62 &rb532_wdt
63 };
64
65 @@ -294,6 +317,9 @@ static int __init plat_setup_devices(void)
66 /* Initialise the NAND device */
67 rb532_nand_setup();
68
69 + /* set the uart clock to the current cpu frequency */
70 + rb532_uart_res[0].uartclk = idt_cpu_freq;
71 +
72 return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
73 }
74
75 diff --git a/arch/mips/rb532/serial.c b/arch/mips/rb532/serial.c
76 index 3e0d7ec..00ed19f 100644
77 --- a/arch/mips/rb532/serial.c
78 +++ b/arch/mips/rb532/serial.c
79 @@ -36,7 +36,7 @@
80 extern unsigned int idt_cpu_freq;
81
82 static struct uart_port rb532_uart = {
83 - .type = PORT_16550A,
84 + .flags = UPF_BOOT_AUTOCONF,
85 .line = 0,
86 .irq = UART0_IRQ,
87 .iotype = UPIO_MEM,
88 --
89 1.5.6.4
90
91
This page took 0.047152 seconds and 5 git commands to generate.