aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-w90x900
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-w90x900')
-rw-r--r--arch/arm/mach-w90x900/cpu.h39
-rw-r--r--arch/arm/mach-w90x900/mach-w90p910evb.c56
-rw-r--r--arch/arm/mach-w90x900/w90p910.c67
3 files changed, 71 insertions, 91 deletions
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h
index 40ff40845df0..de29ddcb9459 100644
--- a/arch/arm/mach-w90x900/cpu.h
+++ b/arch/arm/mach-w90x900/cpu.h
@@ -43,35 +43,16 @@ extern void w90p910_init_io(struct map_desc *mach_desc, int size);
43extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no); 43extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no);
44extern void w90p910_init_clocks(int xtal); 44extern void w90p910_init_clocks(int xtal);
45extern void w90p910_map_io(struct map_desc *mach_desc, int size); 45extern void w90p910_map_io(struct map_desc *mach_desc, int size);
46extern struct platform_device w90p910_serial_device;
46extern struct sys_timer w90x900_timer; 47extern struct sys_timer w90x900_timer;
47 48
48#define W90X900_RES(name) \ 49#define W90X900_8250PORT(name) \
49struct resource w90x900_##name##_resource[] = { \ 50{ \
50 [0] = { \ 51 .membase = name##_BA, \
51 .start = name##_PA, \ 52 .mapbase = name##_PA, \
52 .end = name##_PA + 0x0ff, \ 53 .irq = IRQ_##name, \
53 .flags = IORESOURCE_MEM, \ 54 .uartclk = 11313600, \
54 }, \ 55 .regshift = 2, \
55 [1] = { \ 56 .iotype = UPIO_MEM, \
56 .start = IRQ_##name, \ 57 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
57 .end = IRQ_##name, \
58 .flags = IORESOURCE_IRQ, \
59 } \
60}
61
62#define W90X900_DEVICE(devname, regname, devid, platdevname) \
63struct platform_device w90x900_##devname = { \
64 .name = platdevname, \
65 .id = devid, \
66 .num_resources = ARRAY_SIZE(w90x900_##regname##_resource), \
67 .resource = w90x900_##regname##_resource, \
68}
69
70#define W90X900_UARTCFG(port, flag, uc, ulc, ufc) \
71{ \
72 .hwport = port, \
73 .flags = flag, \
74 .ucon = uc, \
75 .ulcon = ulc, \
76 .ufcon = ufc, \
77} 58}
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c
index 9ebc93f48530..726ff6798a56 100644
--- a/arch/arm/mach-w90x900/mach-w90p910evb.c
+++ b/arch/arm/mach-w90x900/mach-w90p910evb.c
@@ -22,6 +22,7 @@
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/mtd/physmap.h>
25 26
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 28#include <asm/mach/map.h>
@@ -32,28 +33,67 @@
32#include <mach/map.h> 33#include <mach/map.h>
33 34
34#include "cpu.h" 35#include "cpu.h"
36/*w90p910 evb norflash driver data */
35 37
36static struct map_desc w90p910_iodesc[] __initdata = { 38#define W90P910_FLASH_BASE 0xA0000000
39#define W90P910_FLASH_SIZE 0x400000
40
41static struct mtd_partition w90p910_flash_partitions[] = {
42 {
43 .name = "NOR Partition 1 for kernel (960K)",
44 .size = 0xF0000,
45 .offset = 0x10000,
46 },
47 {
48 .name = "NOR Partition 2 for image (1M)",
49 .size = 0x100000,
50 .offset = 0x100000,
51 },
52 {
53 .name = "NOR Partition 3 for user (2M)",
54 .size = 0x200000,
55 .offset = 0x00200000,
56 }
37}; 57};
38 58
39static struct w90x900_uartcfg w90p910_uartcfgs[] = { 59static struct physmap_flash_data w90p910_flash_data = {
40 W90X900_UARTCFG(0, 0, 0, 0, 0), 60 .width = 2,
41 W90X900_UARTCFG(1, 0, 0, 0, 0), 61 .parts = w90p910_flash_partitions,
42 W90X900_UARTCFG(2, 0, 0, 0, 0), 62 .nr_parts = ARRAY_SIZE(w90p910_flash_partitions),
43 W90X900_UARTCFG(3, 0, 0, 0, 0), 63};
44 W90X900_UARTCFG(4, 0, 0, 0, 0), 64
65static struct resource w90p910_flash_resources[] = {
66 {
67 .start = W90P910_FLASH_BASE,
68 .end = W90P910_FLASH_BASE + W90P910_FLASH_SIZE - 1,
69 .flags = IORESOURCE_MEM,
70 }
71};
72
73static struct platform_device w90p910_flash_device = {
74 .name = "physmap-flash",
75 .id = 0,
76 .dev = {
77 .platform_data = &w90p910_flash_data,
78 },
79 .resource = w90p910_flash_resources,
80 .num_resources = ARRAY_SIZE(w90p910_flash_resources),
81};
82
83static struct map_desc w90p910_iodesc[] __initdata = {
45}; 84};
46 85
47/*Here should be your evb resourse,such as LCD*/ 86/*Here should be your evb resourse,such as LCD*/
48 87
49static struct platform_device *w90p910evb_dev[] __initdata = { 88static struct platform_device *w90p910evb_dev[] __initdata = {
89 &w90p910_serial_device,
90 &w90p910_flash_device,
50}; 91};
51 92
52static void __init w90p910evb_map_io(void) 93static void __init w90p910evb_map_io(void)
53{ 94{
54 w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); 95 w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
55 w90p910_init_clocks(0); 96 w90p910_init_clocks(0);
56 w90p910_init_uarts(w90p910_uartcfgs, ARRAY_SIZE(w90p910_uartcfgs));
57} 97}
58 98
59static void __init w90p910evb_init(void) 99static 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
42static int uart_count;
43static struct platform_device *uart_devs[MAX_UART_COUNT-1];
44
45/* Initial IO mappings */ 40/* Initial IO mappings */
46 41
47static struct map_desc w90p910_iodesc[] __initdata = { 42static 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
58static W90X900_RES(UART0);
59static W90X900_RES(UART1);
60static W90X900_RES(UART2);
61static W90X900_RES(UART3);
62static W90X900_RES(UART4);
63static W90X900_DEVICE(uart0, UART0, 0, "w90x900-uart");
64static W90X900_DEVICE(uart1, UART1, 1, "w90x900-uart");
65static W90X900_DEVICE(uart2, UART2, 2, "w90x900-uart");
66static W90X900_DEVICE(uart3, UART3, 3, "w90x900-uart");
67static W90X900_DEVICE(uart4, UART4, 4, "w90x900-uart");
68
69static 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*/ 53struct plat_serial8250_port w90p910_uart_data[] = {
54 W90X900_8250PORT(UART0),
55};
78 56
79void __init w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no) 57struct 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
123static int __init w90x900_arch_init(void) 89static 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}
134arch_initcall(w90x900_arch_init); 93arch_initcall(w90x900_arch_init);