diff options
author | wanzongshun <mcuos.com@gmail.com> | 2009-02-03 23:01:38 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-10 06:24:21 -0500 |
commit | 17198f2d681d34b3376f3a55b2837e56062c2439 (patch) | |
tree | 9d9f87f3bf08c530ef18251e04a50ec16d6633ea /arch/arm/mach-w90x900 | |
parent | b74788d8c118a48585ad5342560e0aea6ed0ccd4 (diff) |
[ARM] 5374/1: The w90p910 uart0 driver patch
Add W90P910 UART0 support,the W90P910 UART0 is 8250 series.
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-w90x900')
-rw-r--r-- | arch/arm/mach-w90x900/cpu.h | 17 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/mach-w90p910evb.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/w90p910.c | 67 |
3 files changed, 24 insertions, 70 deletions
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h index 40ff40845df0..001d50915e38 100644 --- a/arch/arm/mach-w90x900/cpu.h +++ b/arch/arm/mach-w90x900/cpu.h | |||
@@ -43,6 +43,7 @@ extern void w90p910_init_io(struct map_desc *mach_desc, int size); | |||
43 | extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no); | 43 | extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no); |
44 | extern void w90p910_init_clocks(int xtal); | 44 | extern void w90p910_init_clocks(int xtal); |
45 | extern void w90p910_map_io(struct map_desc *mach_desc, int size); | 45 | extern void w90p910_map_io(struct map_desc *mach_desc, int size); |
46 | extern struct platform_device w90p910_serial_device; | ||
46 | extern struct sys_timer w90x900_timer; | 47 | extern struct sys_timer w90x900_timer; |
47 | 48 | ||
48 | #define W90X900_RES(name) \ | 49 | #define W90X900_RES(name) \ |
@@ -67,11 +68,13 @@ struct platform_device w90x900_##devname = { \ | |||
67 | .resource = w90x900_##regname##_resource, \ | 68 | .resource = w90x900_##regname##_resource, \ |
68 | } | 69 | } |
69 | 70 | ||
70 | #define W90X900_UARTCFG(port, flag, uc, ulc, ufc) \ | 71 | #define W90X900_8250PORT(name) \ |
71 | { \ | 72 | { \ |
72 | .hwport = port, \ | 73 | .membase = name##_BA, \ |
73 | .flags = flag, \ | 74 | .mapbase = name##_PA, \ |
74 | .ucon = uc, \ | 75 | .irq = IRQ_##name, \ |
75 | .ulcon = ulc, \ | 76 | .uartclk = 11313600, \ |
76 | .ufcon = ufc, \ | 77 | .regshift = 2, \ |
78 | .iotype = UPIO_MEM, \ | ||
79 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ | ||
77 | } | 80 | } |
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c index 9ebc93f48530..542527019b65 100644 --- a/arch/arm/mach-w90x900/mach-w90p910evb.c +++ b/arch/arm/mach-w90x900/mach-w90p910evb.c | |||
@@ -36,24 +36,16 @@ | |||
36 | static struct map_desc w90p910_iodesc[] __initdata = { | 36 | static struct map_desc w90p910_iodesc[] __initdata = { |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static struct w90x900_uartcfg w90p910_uartcfgs[] = { | ||
40 | W90X900_UARTCFG(0, 0, 0, 0, 0), | ||
41 | W90X900_UARTCFG(1, 0, 0, 0, 0), | ||
42 | W90X900_UARTCFG(2, 0, 0, 0, 0), | ||
43 | W90X900_UARTCFG(3, 0, 0, 0, 0), | ||
44 | W90X900_UARTCFG(4, 0, 0, 0, 0), | ||
45 | }; | ||
46 | |||
47 | /*Here should be your evb resourse,such as LCD*/ | 39 | /*Here should be your evb resourse,such as LCD*/ |
48 | 40 | ||
49 | static struct platform_device *w90p910evb_dev[] __initdata = { | 41 | static struct platform_device *w90p910evb_dev[] __initdata = { |
42 | &w90p910_serial_device, | ||
50 | }; | 43 | }; |
51 | 44 | ||
52 | static void __init w90p910evb_map_io(void) | 45 | static void __init w90p910evb_map_io(void) |
53 | { | 46 | { |
54 | w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); | 47 | w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); |
55 | w90p910_init_clocks(0); | 48 | w90p910_init_clocks(0); |
56 | w90p910_init_uarts(w90p910_uartcfgs, ARRAY_SIZE(w90p910_uartcfgs)); | ||
57 | } | 49 | } |
58 | 50 | ||
59 | static void __init w90p910evb_init(void) | 51 | static void __init w90p910evb_init(void) |
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c index aa783bc94310..2bcbaa681b99 100644 --- a/arch/arm/mach-w90x900/w90p910.c +++ b/arch/arm/mach-w90x900/w90p910.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/serial_8250.h> | ||
28 | 29 | ||
29 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
30 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
@@ -36,12 +37,6 @@ | |||
36 | 37 | ||
37 | #include "cpu.h" | 38 | #include "cpu.h" |
38 | 39 | ||
39 | /*W90P910 has five uarts*/ | ||
40 | |||
41 | #define MAX_UART_COUNT 5 | ||
42 | static int uart_count; | ||
43 | static struct platform_device *uart_devs[MAX_UART_COUNT-1]; | ||
44 | |||
45 | /* Initial IO mappings */ | 40 | /* Initial IO mappings */ |
46 | 41 | ||
47 | static struct map_desc w90p910_iodesc[] __initdata = { | 42 | static struct map_desc w90p910_iodesc[] __initdata = { |
@@ -53,48 +48,19 @@ static struct map_desc w90p910_iodesc[] __initdata = { | |||
53 | /*IODESC_ENT(LCD),*/ | 48 | /*IODESC_ENT(LCD),*/ |
54 | }; | 49 | }; |
55 | 50 | ||
56 | /*Init the dev resource*/ | 51 | /* Initial serial platform data */ |
57 | |||
58 | static W90X900_RES(UART0); | ||
59 | static W90X900_RES(UART1); | ||
60 | static W90X900_RES(UART2); | ||
61 | static W90X900_RES(UART3); | ||
62 | static W90X900_RES(UART4); | ||
63 | static W90X900_DEVICE(uart0, UART0, 0, "w90x900-uart"); | ||
64 | static W90X900_DEVICE(uart1, UART1, 1, "w90x900-uart"); | ||
65 | static W90X900_DEVICE(uart2, UART2, 2, "w90x900-uart"); | ||
66 | static W90X900_DEVICE(uart3, UART3, 3, "w90x900-uart"); | ||
67 | static W90X900_DEVICE(uart4, UART4, 4, "w90x900-uart"); | ||
68 | |||
69 | static struct platform_device *uart_devices[] __initdata = { | ||
70 | &w90x900_uart0, | ||
71 | &w90x900_uart1, | ||
72 | &w90x900_uart2, | ||
73 | &w90x900_uart3, | ||
74 | &w90x900_uart4 | ||
75 | }; | ||
76 | 52 | ||
77 | /*Init W90P910 uart device*/ | 53 | struct plat_serial8250_port w90p910_uart_data[] = { |
54 | W90X900_8250PORT(UART0), | ||
55 | }; | ||
78 | 56 | ||
79 | void __init w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no) | 57 | struct platform_device w90p910_serial_device = { |
80 | { | 58 | .name = "serial8250", |
81 | struct platform_device *platdev; | 59 | .id = PLAT8250_DEV_PLATFORM, |
82 | int uart, uartdev; | 60 | .dev = { |
83 | 61 | .platform_data = w90p910_uart_data, | |
84 | /*By min() to judge count of uart be used indeed*/ | 62 | }, |
85 | 63 | }; | |
86 | uartdev = ARRAY_SIZE(uart_devices); | ||
87 | no = min(uartdev, no); | ||
88 | |||
89 | for (uart = 0; uart < no; uart++, cfg++) { | ||
90 | if (cfg->hwport != uart) | ||
91 | printk(KERN_ERR "w90x900_uartcfg[%d] error\n", uart); | ||
92 | platdev = uart_devices[cfg->hwport]; | ||
93 | uart_devs[uart] = platdev; | ||
94 | platdev->dev.platform_data = cfg; | ||
95 | } | ||
96 | uart_count = uart; | ||
97 | } | ||
98 | 64 | ||
99 | /*Init W90P910 evb io*/ | 65 | /*Init W90P910 evb io*/ |
100 | 66 | ||
@@ -122,13 +88,6 @@ static int __init w90p910_init_cpu(void) | |||
122 | 88 | ||
123 | static int __init w90x900_arch_init(void) | 89 | static int __init w90x900_arch_init(void) |
124 | { | 90 | { |
125 | int ret; | 91 | return w90p910_init_cpu(); |
126 | |||
127 | ret = w90p910_init_cpu(); | ||
128 | if (ret != 0) | ||
129 | return ret; | ||
130 | |||
131 | return platform_add_devices(uart_devs, uart_count); | ||
132 | |||
133 | } | 92 | } |
134 | arch_initcall(w90x900_arch_init); | 93 | arch_initcall(w90x900_arch_init); |