2 * linux/arch/arm/mach-w90x900/w90p910.c
4 * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
6 * Copyright (c) 2008 Nuvoton technology corporation
9 * Wan ZongShun <mcuos.com@gmail.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
20 #include <linux/kernel.h>
21 #include <linux/types.h>
22 #include <linux/interrupt.h>
23 #include <linux/list.h>
24 #include <linux/timer.h>
25 #include <linux/init.h>
26 #include <linux/platform_device.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
34 #include <mach/hardware.h>
35 #include <mach/regs-serial.h>
39 /*W90P910 has five uarts*/
41 #define MAX_UART_COUNT 5
42 static int uart_count
;
43 static struct platform_device
*uart_devs
[MAX_UART_COUNT
-1];
45 /* Initial IO mappings */
47 static struct map_desc w90p910_iodesc
[] __initdata
= {
56 /*Init the dev resource*/
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");
69 static struct platform_device
*uart_devices
[] __initdata
= {
77 /*Init W90P910 uart device*/
79 void __init
w90p910_init_uarts(struct w90x900_uartcfg
*cfg
, int no
)
81 struct platform_device
*platdev
;
84 /*By min() to judge count of uart be used indeed*/
86 uartdev
= ARRAY_SIZE(uart_devices
);
87 no
= min(uartdev
, no
);
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
;
99 /*Init W90P910 evb io*/
101 void __init
w90p910_map_io(struct map_desc
*mach_desc
, int mach_size
)
103 unsigned long idcode
= 0x0;
105 iotable_init(w90p910_iodesc
, ARRAY_SIZE(w90p910_iodesc
));
107 idcode
= __raw_readl(W90X900PDID
);
108 if (idcode
!= W90P910_CPUID
)
109 printk(KERN_ERR
"CPU type 0x%08lx is not W90P910\n", idcode
);
112 /*Init W90P910 clock*/
114 void __init
w90p910_init_clocks(int xtal
)
118 static int __init
w90p910_init_cpu(void)
123 static int __init
w90x900_arch_init(void)
127 ret
= w90p910_init_cpu();
131 return platform_add_devices(uart_devs
, uart_count
);
134 arch_initcall(w90x900_arch_init
);