aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorwanzongshun <mcuos.com@gmail.com>2009-08-21 02:07:46 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-02 06:22:23 -0400
commit35c9221acb133ecc9abd701a1fb6fa909d177a77 (patch)
treee2a283112398450001410b5f3fa9a471c34738a7 /arch/arm
parenta8bc4eadd936bbad9e99b89fe692679451ad75c9 (diff)
ARM: 5682/1: Add cpu.c and dev.c and modify some files of w90p910 platform
Add the cpu.c and dev.c and modify w90p910 platform to apply to use the common API(provided by cpu.c and dev.c) at the same time, I renamed all w90x900 to nuc900 in every c file of w90x900 platform and touchscreen's driver name. 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')
-rw-r--r--arch/arm/mach-w90x900/Makefile8
-rw-r--r--arch/arm/mach-w90x900/clksel.c12
-rw-r--r--arch/arm/mach-w90x900/clock.c4
-rw-r--r--arch/arm/mach-w90x900/clock.h8
-rw-r--r--arch/arm/mach-w90x900/cpu.c (renamed from arch/arm/mach-w90x900/w90p910.c)122
-rw-r--r--arch/arm/mach-w90x900/cpu.h50
-rw-r--r--arch/arm/mach-w90x900/dev.c389
-rw-r--r--arch/arm/mach-w90x900/gpio.c78
-rw-r--r--arch/arm/mach-w90x900/irq.c30
-rw-r--r--arch/arm/mach-w90x900/mach-nuc910evb.c44
-rw-r--r--arch/arm/mach-w90x900/mach-w90p910evb.c407
-rw-r--r--arch/arm/mach-w90x900/mfp.c (renamed from arch/arm/mach-w90x900/mfp-w90p910.c)38
-rw-r--r--arch/arm/mach-w90x900/nuc910.c60
-rw-r--r--arch/arm/mach-w90x900/nuc910.h28
-rw-r--r--arch/arm/mach-w90x900/time.c70
15 files changed, 725 insertions, 623 deletions
diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile
index 3ccd625455cf..e38aa328e608 100644
--- a/arch/arm/mach-w90x900/Makefile
+++ b/arch/arm/mach-w90x900/Makefile
@@ -4,12 +4,12 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := irq.o time.o mfp-w90p910.o gpio.o clock.o 7obj-y := irq.o time.o mfp.o gpio.o clock.o
8obj-y += clksel.o 8obj-y += clksel.o dev.o cpu.o
9# W90X900 CPU support files 9# W90X900 CPU support files
10 10
11obj-$(CONFIG_CPU_W90P910) += w90p910.o 11obj-$(CONFIG_CPU_W90P910) += nuc910.o
12 12
13# machine support 13# machine support
14 14
15obj-$(CONFIG_MACH_W90P910EVB) += mach-w90p910evb.o 15obj-$(CONFIG_MACH_W90P910EVB) += mach-nuc910evb.o
diff --git a/arch/arm/mach-w90x900/clksel.c b/arch/arm/mach-w90x900/clksel.c
index 5a77eb91cb16..3de4a5211c3b 100644
--- a/arch/arm/mach-w90x900/clksel.c
+++ b/arch/arm/mach-w90x900/clksel.c
@@ -42,13 +42,13 @@ static void clock_source_select(const char *dev_id, unsigned int clkval)
42 42
43 clksel = __raw_readl(REG_CLKSEL); 43 clksel = __raw_readl(REG_CLKSEL);
44 44
45 if (strcmp(dev_id, "w90p910-ms") == 0) 45 if (strcmp(dev_id, "nuc900-ms") == 0)
46 offset = MSOFFSET; 46 offset = MSOFFSET;
47 else if (strcmp(dev_id, "w90p910-atapi") == 0) 47 else if (strcmp(dev_id, "nuc900-atapi") == 0)
48 offset = ATAOFFSET; 48 offset = ATAOFFSET;
49 else if (strcmp(dev_id, "w90p910-lcd") == 0) 49 else if (strcmp(dev_id, "nuc900-lcd") == 0)
50 offset = LCDOFFSET; 50 offset = LCDOFFSET;
51 else if (strcmp(dev_id, "w90p910-audio") == 0) 51 else if (strcmp(dev_id, "nuc900-audio") == 0)
52 offset = AUDOFFSET; 52 offset = AUDOFFSET;
53 else 53 else
54 offset = CPUOFFSET; 54 offset = CPUOFFSET;
@@ -59,7 +59,7 @@ static void clock_source_select(const char *dev_id, unsigned int clkval)
59 __raw_writel(clksel, REG_CLKSEL); 59 __raw_writel(clksel, REG_CLKSEL);
60} 60}
61 61
62void w90p910_clock_source(struct device *dev, unsigned char *src) 62void nuc900_clock_source(struct device *dev, unsigned char *src)
63{ 63{
64 unsigned int clkval; 64 unsigned int clkval;
65 const char *dev_id; 65 const char *dev_id;
@@ -87,5 +87,5 @@ void w90p910_clock_source(struct device *dev, unsigned char *src)
87 87
88 mutex_unlock(&clksel_sem); 88 mutex_unlock(&clksel_sem);
89} 89}
90EXPORT_SYMBOL(w90p910_clock_source); 90EXPORT_SYMBOL(nuc900_clock_source);
91 91
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index 70b671096377..b785994bab0a 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -61,7 +61,7 @@ unsigned long clk_get_rate(struct clk *clk)
61} 61}
62EXPORT_SYMBOL(clk_get_rate); 62EXPORT_SYMBOL(clk_get_rate);
63 63
64void w90x900_clk_enable(struct clk *clk, int enable) 64void nuc900_clk_enable(struct clk *clk, int enable)
65{ 65{
66 unsigned int clocks = clk->cken; 66 unsigned int clocks = clk->cken;
67 unsigned long clken; 67 unsigned long clken;
@@ -76,7 +76,7 @@ void w90x900_clk_enable(struct clk *clk, int enable)
76 __raw_writel(clken, W90X900_VA_CLKPWR); 76 __raw_writel(clken, W90X900_VA_CLKPWR);
77} 77}
78 78
79void w90x900_subclk_enable(struct clk *clk, int enable) 79void nuc900_subclk_enable(struct clk *clk, int enable)
80{ 80{
81 unsigned int clocks = clk->cken; 81 unsigned int clocks = clk->cken;
82 unsigned long clken; 82 unsigned long clken;
diff --git a/arch/arm/mach-w90x900/clock.h b/arch/arm/mach-w90x900/clock.h
index d2f0e50a70bf..f5816a06eed6 100644
--- a/arch/arm/mach-w90x900/clock.h
+++ b/arch/arm/mach-w90x900/clock.h
@@ -12,8 +12,8 @@
12 12
13#include <asm/clkdev.h> 13#include <asm/clkdev.h>
14 14
15void w90x900_clk_enable(struct clk *clk, int enable); 15void nuc900_clk_enable(struct clk *clk, int enable);
16void w90x900_subclk_enable(struct clk *clk, int enable); 16void nuc900_subclk_enable(struct clk *clk, int enable);
17void clks_register(struct clk_lookup *clks, size_t num); 17void clks_register(struct clk_lookup *clks, size_t num);
18 18
19struct clk { 19struct clk {
@@ -24,13 +24,13 @@ struct clk {
24 24
25#define DEFINE_CLK(_name, _ctrlbit) \ 25#define DEFINE_CLK(_name, _ctrlbit) \
26struct clk clk_##_name = { \ 26struct clk clk_##_name = { \
27 .enable = w90x900_clk_enable, \ 27 .enable = nuc900_clk_enable, \
28 .cken = (1 << _ctrlbit), \ 28 .cken = (1 << _ctrlbit), \
29 } 29 }
30 30
31#define DEFINE_SUBCLK(_name, _ctrlbit) \ 31#define DEFINE_SUBCLK(_name, _ctrlbit) \
32struct clk clk_##_name = { \ 32struct clk clk_##_name = { \
33 .enable = w90x900_subclk_enable, \ 33 .enable = nuc900_subclk_enable, \
34 .cken = (1 << _ctrlbit), \ 34 .cken = (1 << _ctrlbit), \
35 } 35 }
36 36
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/cpu.c
index d33723b69d14..921cef991bf0 100644
--- a/arch/arm/mach-w90x900/w90p910.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -1,13 +1,11 @@
1/* 1/*
2 * linux/arch/arm/mach-w90x900/w90p910.c 2 * linux/arch/arm/mach-w90x900/cpu.c
3 * 3 *
4 * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks 4 * Copyright (c) 2009 Nuvoton corporation.
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation.
7 * 5 *
8 * Wan ZongShun <mcuos.com@gmail.com> 6 * Wan ZongShun <mcuos.com@gmail.com>
9 * 7 *
10 * W90P910 cpu support 8 * NUC900 series cpu common support
11 * 9 *
12 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -41,19 +39,12 @@
41 39
42/* Initial IO mappings */ 40/* Initial IO mappings */
43 41
44static struct map_desc w90p910_iodesc[] __initdata = { 42static struct map_desc nuc900_iodesc[] __initdata = {
45 IODESC_ENT(IRQ), 43 IODESC_ENT(IRQ),
46 IODESC_ENT(GCR), 44 IODESC_ENT(GCR),
47 IODESC_ENT(UART), 45 IODESC_ENT(UART),
48 IODESC_ENT(TIMER), 46 IODESC_ENT(TIMER),
49 IODESC_ENT(EBI), 47 IODESC_ENT(EBI),
50 IODESC_ENT(USBEHCIHOST),
51 IODESC_ENT(USBOHCIHOST),
52 IODESC_ENT(ADC),
53 IODESC_ENT(RTC),
54 IODESC_ENT(KPI),
55 IODESC_ENT(USBDEV),
56 /*IODESC_ENT(LCD),*/
57}; 48};
58 49
59/* Initial clock declarations. */ 50/* Initial clock declarations. */
@@ -78,58 +69,45 @@ static DEFINE_CLK(adc, 28);
78static DEFINE_CLK(usi, 29); 69static DEFINE_CLK(usi, 29);
79static DEFINE_CLK(ext, 0); 70static DEFINE_CLK(ext, 0);
80 71
81static struct clk_lookup w90p910_clkregs[] = { 72static struct clk_lookup nuc900_clkregs[] = {
82 DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), 73 DEF_CLKLOOK(&clk_lcd, "nuc900-lcd", NULL),
83 DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), 74 DEF_CLKLOOK(&clk_audio, "nuc900-audio", NULL),
84 DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), 75 DEF_CLKLOOK(&clk_fmi, "nuc900-fmi", NULL),
85 DEF_CLKLOOK(&clk_ms, "w90p910-fmi", "MS"), 76 DEF_CLKLOOK(&clk_ms, "nuc900-fmi", "MS"),
86 DEF_CLKLOOK(&clk_sd, "w90p910-fmi", "SD"), 77 DEF_CLKLOOK(&clk_sd, "nuc900-fmi", "SD"),
87 DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), 78 DEF_CLKLOOK(&clk_dmac, "nuc900-dmac", NULL),
88 DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), 79 DEF_CLKLOOK(&clk_atapi, "nuc900-atapi", NULL),
89 DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), 80 DEF_CLKLOOK(&clk_emc, "nuc900-emc", NULL),
90 DEF_CLKLOOK(&clk_rmii, "w90p910-emc", "RMII"), 81 DEF_CLKLOOK(&clk_rmii, "nuc900-emc", "RMII"),
91 DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), 82 DEF_CLKLOOK(&clk_usbd, "nuc900-usbd", NULL),
92 DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), 83 DEF_CLKLOOK(&clk_usbh, "nuc900-usbh", NULL),
93 DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), 84 DEF_CLKLOOK(&clk_g2d, "nuc900-g2d", NULL),
94 DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL), 85 DEF_CLKLOOK(&clk_pwm, "nuc900-pwm", NULL),
95 DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL), 86 DEF_CLKLOOK(&clk_ps2, "nuc900-ps2", NULL),
96 DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL), 87 DEF_CLKLOOK(&clk_kpi, "nuc900-kpi", NULL),
97 DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL), 88 DEF_CLKLOOK(&clk_wdt, "nuc900-wdt", NULL),
98 DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL), 89 DEF_CLKLOOK(&clk_gdma, "nuc900-gdma", NULL),
99 DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL), 90 DEF_CLKLOOK(&clk_adc, "nuc900-adc", NULL),
100 DEF_CLKLOOK(&clk_usi, "w90p910-spi", NULL), 91 DEF_CLKLOOK(&clk_usi, "nuc900-spi", NULL),
101 DEF_CLKLOOK(&clk_ext, NULL, "ext"), 92 DEF_CLKLOOK(&clk_ext, NULL, "ext"),
102}; 93};
103 94
104/* Initial serial platform data */ 95/* Initial serial platform data */
105 96
106struct plat_serial8250_port w90p910_uart_data[] = { 97struct plat_serial8250_port nuc900_uart_data[] = {
107 W90X900_8250PORT(UART0), 98 NUC900_8250PORT(UART0),
108}; 99};
109 100
110struct platform_device w90p910_serial_device = { 101struct platform_device nuc900_serial_device = {
111 .name = "serial8250", 102 .name = "serial8250",
112 .id = PLAT8250_DEV_PLATFORM, 103 .id = PLAT8250_DEV_PLATFORM,
113 .dev = { 104 .dev = {
114 .platform_data = w90p910_uart_data, 105 .platform_data = nuc900_uart_data,
115 }, 106 },
116}; 107};
117 108
118/*Init W90P910 evb io*/ 109/*Set NUC900 series cpu frequence*/
119 110static int __init nuc900_set_clkval(unsigned int cpufreq)
120void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size)
121{
122 unsigned long idcode = 0x0;
123
124 iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
125
126 idcode = __raw_readl(W90X900PDID);
127 if (idcode != W90P910_CPUID)
128 printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode);
129}
130
131/*Set W90P910 cpu frequence*/
132static int __init w90p910_set_clkval(unsigned int cpufreq)
133{ 111{
134 unsigned int pllclk, ahbclk, apbclk, val; 112 unsigned int pllclk, ahbclk, apbclk, val;
135 113
@@ -178,7 +156,7 @@ static int __init w90p910_set_clkval(unsigned int cpufreq)
178 156
179 return 0; 157 return 0;
180} 158}
181static int __init w90p910_set_cpufreq(char *str) 159static int __init nuc900_set_cpufreq(char *str)
182{ 160{
183 unsigned long cpufreq, val; 161 unsigned long cpufreq, val;
184 162
@@ -187,9 +165,9 @@ static int __init w90p910_set_cpufreq(char *str)
187 165
188 strict_strtoul(str, 0, &cpufreq); 166 strict_strtoul(str, 0, &cpufreq);
189 167
190 w90p910_clock_source(NULL, "ext"); 168 nuc900_clock_source(NULL, "ext");
191 169
192 w90p910_set_clkval(cpufreq); 170 nuc900_set_clkval(cpufreq);
193 171
194 mdelay(1); 172 mdelay(1);
195 173
@@ -198,27 +176,37 @@ static int __init w90p910_set_cpufreq(char *str)
198 val |= DEFAULTSKEW; 176 val |= DEFAULTSKEW;
199 __raw_writel(val, REG_CKSKEW); 177 __raw_writel(val, REG_CKSKEW);
200 178
201 w90p910_clock_source(NULL, "pll0"); 179 nuc900_clock_source(NULL, "pll0");
202 180
203 return 1; 181 return 1;
204} 182}
205 183
206__setup("cpufreq=", w90p910_set_cpufreq); 184__setup("cpufreq=", nuc900_set_cpufreq);
207 185
208/*Init W90P910 clock*/ 186/*Init NUC900 evb io*/
209 187
210void __init w90p910_init_clocks(void) 188void __init nuc900_map_io(struct map_desc *mach_desc, int mach_size)
211{ 189{
212 clks_register(w90p910_clkregs, ARRAY_SIZE(w90p910_clkregs)); 190 unsigned long idcode = 0x0;
213}
214 191
215static int __init w90p910_init_cpu(void) 192 iotable_init(mach_desc, mach_size);
216{ 193 iotable_init(nuc900_iodesc, ARRAY_SIZE(nuc900_iodesc));
217 return 0; 194
195 idcode = __raw_readl(NUC900PDID);
196 if (idcode == NUC910_CPUID)
197 printk(KERN_INFO "CPU type 0x%08lx is NUC910\n", idcode);
198 else if (idcode == NUC920_CPUID)
199 printk(KERN_INFO "CPU type 0x%08lx is NUC920\n", idcode);
200 else if (idcode == NUC950_CPUID)
201 printk(KERN_INFO "CPU type 0x%08lx is NUC950\n", idcode);
202 else if (idcode == NUC960_CPUID)
203 printk(KERN_INFO "CPU type 0x%08lx is NUC960\n", idcode);
218} 204}
219 205
220static int __init w90x900_arch_init(void) 206/*Init NUC900 clock*/
207
208void __init nuc900_init_clocks(void)
221{ 209{
222 return w90p910_init_cpu(); 210 clks_register(nuc900_clkregs, ARRAY_SIZE(nuc900_clkregs));
223} 211}
224arch_initcall(w90x900_arch_init); 212
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h
index ddde959d8987..4d58ba164e25 100644
--- a/arch/arm/mach-w90x900/cpu.h
+++ b/arch/arm/mach-w90x900/cpu.h
@@ -6,7 +6,7 @@
6 * Copyright (c) 2008 Nuvoton technology corporation 6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Header file for W90X900 CPU support 9 * Header file for NUC900 CPU support
10 * 10 *
11 * Wan ZongShun <mcuos.com@gmail.com> 11 * Wan ZongShun <mcuos.com@gmail.com>
12 * 12 *
@@ -24,30 +24,7 @@
24 .type = MT_DEVICE, \ 24 .type = MT_DEVICE, \
25} 25}
26 26
27/*Cpu identifier register*/ 27#define NUC900_8250PORT(name) \
28
29#define W90X900PDID W90X900_VA_GCR
30#define W90P910_CPUID 0x02900910
31#define W90P920_CPUID 0x02900920
32#define W90P950_CPUID 0x02900950
33#define W90N960_CPUID 0x02900960
34
35struct w90x900_uartcfg;
36struct map_desc;
37struct sys_timer;
38
39/* core initialisation functions */
40
41extern void w90x900_init_irq(void);
42extern void w90p910_init_io(struct map_desc *mach_desc, int size);
43extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no);
44extern void w90p910_init_clocks(void);
45extern void w90p910_map_io(struct map_desc *mach_desc, int size);
46extern struct platform_device w90p910_serial_device;
47extern struct sys_timer w90x900_timer;
48extern void w90p910_clock_source(struct device *dev, unsigned char *src);
49
50#define W90X900_8250PORT(name) \
51{ \ 28{ \
52 .membase = name##_BA, \ 29 .membase = name##_BA, \
53 .mapbase = name##_PA, \ 30 .mapbase = name##_PA, \
@@ -57,3 +34,26 @@ extern void w90p910_clock_source(struct device *dev, unsigned char *src);
57 .iotype = UPIO_MEM, \ 34 .iotype = UPIO_MEM, \
58 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ 35 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
59} 36}
37
38/*Cpu identifier register*/
39
40#define NUC900PDID W90X900_VA_GCR
41#define NUC910_CPUID 0x02900910
42#define NUC920_CPUID 0x02900920
43#define NUC950_CPUID 0x02900950
44#define NUC960_CPUID 0x02900960
45
46/* extern file from cpu.c */
47
48extern void nuc900_clock_source(struct device *dev, unsigned char *src);
49extern void nuc900_init_clocks(void);
50extern void nuc900_map_io(struct map_desc *mach_desc, int mach_size);
51extern void nuc900_board_init(struct platform_device **device, int size);
52
53/* for either public between 910 and 920, or between 920 and 950 */
54
55extern struct platform_device nuc900_serial_device;
56extern struct platform_device nuc900_device_fmi;
57extern struct platform_device nuc900_device_kpi;
58extern struct platform_device nuc900_device_rtc;
59extern struct platform_device nuc900_device_ts;
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
new file mode 100644
index 000000000000..2a6f98de48d2
--- /dev/null
+++ b/arch/arm/mach-w90x900/dev.c
@@ -0,0 +1,389 @@
1/*
2 * linux/arch/arm/mach-w90x900/dev.c
3 *
4 * Copyright (C) 2009 Nuvoton corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/timer.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21
22#include <linux/mtd/physmap.h>
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h>
25
26#include <linux/spi/spi.h>
27#include <linux/spi/flash.h>
28
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32#include <asm/mach-types.h>
33
34#include <mach/regs-serial.h>
35#include <mach/map.h>
36
37#include "cpu.h"
38
39/*NUC900 evb norflash driver data */
40
41#define NUC900_FLASH_BASE 0xA0000000
42#define NUC900_FLASH_SIZE 0x400000
43#define SPIOFFSET 0x200
44#define SPIOREG_SIZE 0x100
45
46static struct mtd_partition nuc900_flash_partitions[] = {
47 {
48 .name = "NOR Partition 1 for kernel (960K)",
49 .size = 0xF0000,
50 .offset = 0x10000,
51 },
52 {
53 .name = "NOR Partition 2 for image (1M)",
54 .size = 0x100000,
55 .offset = 0x100000,
56 },
57 {
58 .name = "NOR Partition 3 for user (2M)",
59 .size = 0x200000,
60 .offset = 0x00200000,
61 }
62};
63
64static struct physmap_flash_data nuc900_flash_data = {
65 .width = 2,
66 .parts = nuc900_flash_partitions,
67 .nr_parts = ARRAY_SIZE(nuc900_flash_partitions),
68};
69
70static struct resource nuc900_flash_resources[] = {
71 {
72 .start = NUC900_FLASH_BASE,
73 .end = NUC900_FLASH_BASE + NUC900_FLASH_SIZE - 1,
74 .flags = IORESOURCE_MEM,
75 }
76};
77
78static struct platform_device nuc900_flash_device = {
79 .name = "physmap-flash",
80 .id = 0,
81 .dev = {
82 .platform_data = &nuc900_flash_data,
83 },
84 .resource = nuc900_flash_resources,
85 .num_resources = ARRAY_SIZE(nuc900_flash_resources),
86};
87
88/* USB EHCI Host Controller */
89
90static struct resource nuc900_usb_ehci_resource[] = {
91 [0] = {
92 .start = W90X900_PA_USBEHCIHOST,
93 .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1,
94 .flags = IORESOURCE_MEM,
95 },
96 [1] = {
97 .start = IRQ_USBH,
98 .end = IRQ_USBH,
99 .flags = IORESOURCE_IRQ,
100 }
101};
102
103static u64 nuc900_device_usb_ehci_dmamask = 0xffffffffUL;
104
105static struct platform_device nuc900_device_usb_ehci = {
106 .name = "nuc900-ehci",
107 .id = -1,
108 .num_resources = ARRAY_SIZE(nuc900_usb_ehci_resource),
109 .resource = nuc900_usb_ehci_resource,
110 .dev = {
111 .dma_mask = &nuc900_device_usb_ehci_dmamask,
112 .coherent_dma_mask = 0xffffffffUL
113 }
114};
115
116/* USB OHCI Host Controller */
117
118static struct resource nuc900_usb_ohci_resource[] = {
119 [0] = {
120 .start = W90X900_PA_USBOHCIHOST,
121 .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1,
122 .flags = IORESOURCE_MEM,
123 },
124 [1] = {
125 .start = IRQ_USBH,
126 .end = IRQ_USBH,
127 .flags = IORESOURCE_IRQ,
128 }
129};
130
131static u64 nuc900_device_usb_ohci_dmamask = 0xffffffffUL;
132static struct platform_device nuc900_device_usb_ohci = {
133 .name = "nuc900-ohci",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(nuc900_usb_ohci_resource),
136 .resource = nuc900_usb_ohci_resource,
137 .dev = {
138 .dma_mask = &nuc900_device_usb_ohci_dmamask,
139 .coherent_dma_mask = 0xffffffffUL
140 }
141};
142
143/* USB Device (Gadget)*/
144
145static struct resource nuc900_usbgadget_resource[] = {
146 [0] = {
147 .start = W90X900_PA_USBDEV,
148 .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 [1] = {
152 .start = IRQ_USBD,
153 .end = IRQ_USBD,
154 .flags = IORESOURCE_IRQ,
155 }
156};
157
158static struct platform_device nuc900_device_usbgadget = {
159 .name = "nuc900-usbgadget",
160 .id = -1,
161 .num_resources = ARRAY_SIZE(nuc900_usbgadget_resource),
162 .resource = nuc900_usbgadget_resource,
163};
164
165/* MAC device */
166
167static struct resource nuc900_emc_resource[] = {
168 [0] = {
169 .start = W90X900_PA_EMC,
170 .end = W90X900_PA_EMC + W90X900_SZ_EMC - 1,
171 .flags = IORESOURCE_MEM,
172 },
173 [1] = {
174 .start = IRQ_EMCTX,
175 .end = IRQ_EMCTX,
176 .flags = IORESOURCE_IRQ,
177 },
178 [2] = {
179 .start = IRQ_EMCRX,
180 .end = IRQ_EMCRX,
181 .flags = IORESOURCE_IRQ,
182 }
183};
184
185static u64 nuc900_device_emc_dmamask = 0xffffffffUL;
186static struct platform_device nuc900_device_emc = {
187 .name = "nuc900-emc",
188 .id = -1,
189 .num_resources = ARRAY_SIZE(nuc900_emc_resource),
190 .resource = nuc900_emc_resource,
191 .dev = {
192 .dma_mask = &nuc900_device_emc_dmamask,
193 .coherent_dma_mask = 0xffffffffUL
194 }
195};
196
197/* SPI device */
198
199static struct resource nuc900_spi_resource[] = {
200 [0] = {
201 .start = W90X900_PA_I2C + SPIOFFSET,
202 .end = W90X900_PA_I2C + SPIOFFSET + SPIOREG_SIZE - 1,
203 .flags = IORESOURCE_MEM,
204 },
205 [1] = {
206 .start = IRQ_SSP,
207 .end = IRQ_SSP,
208 .flags = IORESOURCE_IRQ,
209 }
210};
211
212static struct platform_device nuc900_device_spi = {
213 .name = "nuc900-spi",
214 .id = -1,
215 .num_resources = ARRAY_SIZE(nuc900_spi_resource),
216 .resource = nuc900_spi_resource,
217};
218
219/* spi device, spi flash info */
220
221static struct mtd_partition nuc900_spi_flash_partitions[] = {
222 {
223 .name = "bootloader(spi)",
224 .size = 0x0100000,
225 .offset = 0,
226 },
227};
228
229static struct flash_platform_data nuc900_spi_flash_data = {
230 .name = "m25p80",
231 .parts = nuc900_spi_flash_partitions,
232 .nr_parts = ARRAY_SIZE(nuc900_spi_flash_partitions),
233 .type = "w25x16",
234};
235
236static struct spi_board_info nuc900_spi_board_info[] __initdata = {
237 {
238 .modalias = "m25p80",
239 .max_speed_hz = 20000000,
240 .bus_num = 0,
241 .chip_select = 1,
242 .platform_data = &nuc900_spi_flash_data,
243 .mode = SPI_MODE_0,
244 },
245};
246
247/* WDT Device */
248
249static struct resource nuc900_wdt_resource[] = {
250 [0] = {
251 .start = W90X900_PA_TIMER,
252 .end = W90X900_PA_TIMER + W90X900_SZ_TIMER - 1,
253 .flags = IORESOURCE_MEM,
254 },
255 [1] = {
256 .start = IRQ_WDT,
257 .end = IRQ_WDT,
258 .flags = IORESOURCE_IRQ,
259 }
260};
261
262static struct platform_device nuc900_device_wdt = {
263 .name = "nuc900-wdt",
264 .id = -1,
265 .num_resources = ARRAY_SIZE(nuc900_wdt_resource),
266 .resource = nuc900_wdt_resource,
267};
268
269/*
270 * public device definition between 910 and 920, or 910
271 * and 950 or 950 and 960...,their dev platform register
272 * should be in specific file such as nuc950, nuc960 c
273 * files rather than the public dev.c file here. so the
274 * corresponding platform_device definition should not be
275 * static.
276*/
277
278/* RTC controller*/
279
280static struct resource nuc900_rtc_resource[] = {
281 [0] = {
282 .start = W90X900_PA_RTC,
283 .end = W90X900_PA_RTC + 0xff,
284 .flags = IORESOURCE_MEM,
285 },
286 [1] = {
287 .start = IRQ_RTC,
288 .end = IRQ_RTC,
289 .flags = IORESOURCE_IRQ,
290 },
291};
292
293struct platform_device nuc900_device_rtc = {
294 .name = "nuc900-rtc",
295 .id = -1,
296 .num_resources = ARRAY_SIZE(nuc900_rtc_resource),
297 .resource = nuc900_rtc_resource,
298};
299
300/*TouchScreen controller*/
301
302static struct resource nuc900_ts_resource[] = {
303 [0] = {
304 .start = W90X900_PA_ADC,
305 .end = W90X900_PA_ADC + W90X900_SZ_ADC-1,
306 .flags = IORESOURCE_MEM,
307 },
308 [1] = {
309 .start = IRQ_ADC,
310 .end = IRQ_ADC,
311 .flags = IORESOURCE_IRQ,
312 },
313};
314
315struct platform_device nuc900_device_ts = {
316 .name = "nuc900-ts",
317 .id = -1,
318 .resource = nuc900_ts_resource,
319 .num_resources = ARRAY_SIZE(nuc900_ts_resource),
320};
321
322/* FMI Device */
323
324static struct resource nuc900_fmi_resource[] = {
325 [0] = {
326 .start = W90X900_PA_FMI,
327 .end = W90X900_PA_FMI + W90X900_SZ_FMI - 1,
328 .flags = IORESOURCE_MEM,
329 },
330 [1] = {
331 .start = IRQ_FMI,
332 .end = IRQ_FMI,
333 .flags = IORESOURCE_IRQ,
334 }
335};
336
337struct platform_device nuc900_device_fmi = {
338 .name = "nuc900-fmi",
339 .id = -1,
340 .num_resources = ARRAY_SIZE(nuc900_fmi_resource),
341 .resource = nuc900_fmi_resource,
342};
343
344/* KPI controller*/
345
346static struct resource nuc900_kpi_resource[] = {
347 [0] = {
348 .start = W90X900_PA_KPI,
349 .end = W90X900_PA_KPI + W90X900_SZ_KPI - 1,
350 .flags = IORESOURCE_MEM,
351 },
352 [1] = {
353 .start = IRQ_KPI,
354 .end = IRQ_KPI,
355 .flags = IORESOURCE_IRQ,
356 }
357
358};
359
360struct platform_device nuc900_device_kpi = {
361 .name = "nuc900-kpi",
362 .id = -1,
363 .num_resources = ARRAY_SIZE(nuc900_kpi_resource),
364 .resource = nuc900_kpi_resource,
365};
366
367/*Here should be your evb resourse,such as LCD*/
368
369static struct platform_device *nuc900_public_dev[] __initdata = {
370 &nuc900_serial_device,
371 &nuc900_flash_device,
372 &nuc900_device_usb_ehci,
373 &nuc900_device_usb_ohci,
374 &nuc900_device_usbgadget,
375 &nuc900_device_emc,
376 &nuc900_device_spi,
377 &nuc900_device_wdt,
378};
379
380/* Provide adding specific CPU platform devices API */
381
382void __init nuc900_board_init(struct platform_device **device, int size)
383{
384 platform_add_devices(device, size);
385 platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev));
386 spi_register_board_info(nuc900_spi_board_info,
387 ARRAY_SIZE(nuc900_spi_board_info));
388}
389
diff --git a/arch/arm/mach-w90x900/gpio.c b/arch/arm/mach-w90x900/gpio.c
index c72e0dfa1825..ba05aec7ea4b 100644
--- a/arch/arm/mach-w90x900/gpio.c
+++ b/arch/arm/mach-w90x900/gpio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-w90p910/gpio.c 2 * linux/arch/arm/mach-w90x900/gpio.c
3 * 3 *
4 * Generic w90p910 GPIO handling 4 * Generic nuc900 GPIO handling
5 * 5 *
6 * Wan ZongShun <mcuos.com@gmail.com> 6 * Wan ZongShun <mcuos.com@gmail.com>
7 * 7 *
@@ -30,31 +30,31 @@
30#define GPIO_IN (0x0C) 30#define GPIO_IN (0x0C)
31#define GROUPINERV (0x10) 31#define GROUPINERV (0x10)
32#define GPIO_GPIO(Nb) (0x00000001 << (Nb)) 32#define GPIO_GPIO(Nb) (0x00000001 << (Nb))
33#define to_w90p910_gpio_chip(c) container_of(c, struct w90p910_gpio_chip, chip) 33#define to_nuc900_gpio_chip(c) container_of(c, struct nuc900_gpio_chip, chip)
34 34
35#define W90P910_GPIO_CHIP(name, base_gpio, nr_gpio) \ 35#define NUC900_GPIO_CHIP(name, base_gpio, nr_gpio) \
36 { \ 36 { \
37 .chip = { \ 37 .chip = { \
38 .label = name, \ 38 .label = name, \
39 .direction_input = w90p910_dir_input, \ 39 .direction_input = nuc900_dir_input, \
40 .direction_output = w90p910_dir_output, \ 40 .direction_output = nuc900_dir_output, \
41 .get = w90p910_gpio_get, \ 41 .get = nuc900_gpio_get, \
42 .set = w90p910_gpio_set, \ 42 .set = nuc900_gpio_set, \
43 .base = base_gpio, \ 43 .base = base_gpio, \
44 .ngpio = nr_gpio, \ 44 .ngpio = nr_gpio, \
45 } \ 45 } \
46 } 46 }
47 47
48struct w90p910_gpio_chip { 48struct nuc900_gpio_chip {
49 struct gpio_chip chip; 49 struct gpio_chip chip;
50 void __iomem *regbase; /* Base of group register*/ 50 void __iomem *regbase; /* Base of group register*/
51 spinlock_t gpio_lock; 51 spinlock_t gpio_lock;
52}; 52};
53 53
54static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset) 54static int nuc900_gpio_get(struct gpio_chip *chip, unsigned offset)
55{ 55{
56 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 56 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
57 void __iomem *pio = w90p910_gpio->regbase + GPIO_IN; 57 void __iomem *pio = nuc900_gpio->regbase + GPIO_IN;
58 unsigned int regval; 58 unsigned int regval;
59 59
60 regval = __raw_readl(pio); 60 regval = __raw_readl(pio);
@@ -63,14 +63,14 @@ static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset)
63 return (regval != 0); 63 return (regval != 0);
64} 64}
65 65
66static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val) 66static void nuc900_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
67{ 67{
68 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 68 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
69 void __iomem *pio = w90p910_gpio->regbase + GPIO_OUT; 69 void __iomem *pio = nuc900_gpio->regbase + GPIO_OUT;
70 unsigned int regval; 70 unsigned int regval;
71 unsigned long flags; 71 unsigned long flags;
72 72
73 spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); 73 spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
74 74
75 regval = __raw_readl(pio); 75 regval = __raw_readl(pio);
76 76
@@ -81,36 +81,36 @@ static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
81 81
82 __raw_writel(regval, pio); 82 __raw_writel(regval, pio);
83 83
84 spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); 84 spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
85} 85}
86 86
87static int w90p910_dir_input(struct gpio_chip *chip, unsigned offset) 87static int nuc900_dir_input(struct gpio_chip *chip, unsigned offset)
88{ 88{
89 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 89 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
90 void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; 90 void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR;
91 unsigned int regval; 91 unsigned int regval;
92 unsigned long flags; 92 unsigned long flags;
93 93
94 spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); 94 spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
95 95
96 regval = __raw_readl(pio); 96 regval = __raw_readl(pio);
97 regval &= ~GPIO_GPIO(offset); 97 regval &= ~GPIO_GPIO(offset);
98 __raw_writel(regval, pio); 98 __raw_writel(regval, pio);
99 99
100 spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); 100 spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
101 101
102 return 0; 102 return 0;
103} 103}
104 104
105static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val) 105static int nuc900_dir_output(struct gpio_chip *chip, unsigned offset, int val)
106{ 106{
107 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 107 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
108 void __iomem *outreg = w90p910_gpio->regbase + GPIO_OUT; 108 void __iomem *outreg = nuc900_gpio->regbase + GPIO_OUT;
109 void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; 109 void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR;
110 unsigned int regval; 110 unsigned int regval;
111 unsigned long flags; 111 unsigned long flags;
112 112
113 spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); 113 spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
114 114
115 regval = __raw_readl(pio); 115 regval = __raw_readl(pio);
116 regval |= GPIO_GPIO(offset); 116 regval |= GPIO_GPIO(offset);
@@ -125,28 +125,28 @@ static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val)
125 125
126 __raw_writel(regval, outreg); 126 __raw_writel(regval, outreg);
127 127
128 spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); 128 spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
129 129
130 return 0; 130 return 0;
131} 131}
132 132
133static struct w90p910_gpio_chip w90p910_gpio[] = { 133static struct nuc900_gpio_chip nuc900_gpio[] = {
134 W90P910_GPIO_CHIP("GROUPC", 0, 16), 134 NUC900_GPIO_CHIP("GROUPC", 0, 16),
135 W90P910_GPIO_CHIP("GROUPD", 16, 10), 135 NUC900_GPIO_CHIP("GROUPD", 16, 10),
136 W90P910_GPIO_CHIP("GROUPE", 26, 14), 136 NUC900_GPIO_CHIP("GROUPE", 26, 14),
137 W90P910_GPIO_CHIP("GROUPF", 40, 10), 137 NUC900_GPIO_CHIP("GROUPF", 40, 10),
138 W90P910_GPIO_CHIP("GROUPG", 50, 17), 138 NUC900_GPIO_CHIP("GROUPG", 50, 17),
139 W90P910_GPIO_CHIP("GROUPH", 67, 8), 139 NUC900_GPIO_CHIP("GROUPH", 67, 8),
140 W90P910_GPIO_CHIP("GROUPI", 75, 17), 140 NUC900_GPIO_CHIP("GROUPI", 75, 17),
141}; 141};
142 142
143void __init w90p910_init_gpio(int nr_group) 143void __init nuc900_init_gpio(int nr_group)
144{ 144{
145 unsigned i; 145 unsigned i;
146 struct w90p910_gpio_chip *gpio_chip; 146 struct nuc900_gpio_chip *gpio_chip;
147 147
148 for (i = 0; i < nr_group; i++) { 148 for (i = 0; i < nr_group; i++) {
149 gpio_chip = &w90p910_gpio[i]; 149 gpio_chip = &nuc900_gpio[i];
150 spin_lock_init(&gpio_chip->gpio_lock); 150 spin_lock_init(&gpio_chip->gpio_lock);
151 gpio_chip->regbase = GPIO_BASE + i * GROUPINERV; 151 gpio_chip->regbase = GPIO_BASE + i * GROUPINERV;
152 gpiochip_add(&gpio_chip->chip); 152 gpiochip_add(&gpio_chip->chip);
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index a296c9b81d24..0ce9d8e867eb 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -36,13 +36,13 @@ struct group_irq {
36 36
37static DEFINE_SPINLOCK(groupirq_lock); 37static DEFINE_SPINLOCK(groupirq_lock);
38 38
39#define DEFINE_GROUP(_name, _ctrlbit, _num) \ 39#define DEFINE_GROUP(_name, _ctrlbit, _num) \
40struct group_irq group_##_name = { \ 40struct group_irq group_##_name = { \
41 .enable = w90x900_group_enable, \ 41 .enable = nuc900_group_enable, \
42 .gpen = ((2 ^ _num) - 1) << _ctrlbit, \ 42 .gpen = ((1 << _num) - 1) << _ctrlbit, \
43 } 43 }
44 44
45static void w90x900_group_enable(struct group_irq *gpirq, int enable); 45static void nuc900_group_enable(struct group_irq *gpirq, int enable);
46 46
47static DEFINE_GROUP(nirq0, 0, 4); 47static DEFINE_GROUP(nirq0, 0, 4);
48static DEFINE_GROUP(nirq1, 4, 4); 48static DEFINE_GROUP(nirq1, 4, 4);
@@ -77,7 +77,7 @@ static void group_irq_disable(struct group_irq *group_irq)
77 spin_unlock_irqrestore(&groupirq_lock, flags); 77 spin_unlock_irqrestore(&groupirq_lock, flags);
78} 78}
79 79
80static void w90x900_group_enable(struct group_irq *gpirq, int enable) 80static void nuc900_group_enable(struct group_irq *gpirq, int enable)
81{ 81{
82 unsigned int groupen = gpirq->gpen; 82 unsigned int groupen = gpirq->gpen;
83 unsigned long regval; 83 unsigned long regval;
@@ -92,7 +92,7 @@ static void w90x900_group_enable(struct group_irq *gpirq, int enable)
92 __raw_writel(regval, REG_AIC_GEN); 92 __raw_writel(regval, REG_AIC_GEN);
93} 93}
94 94
95static void w90x900_irq_mask(unsigned int irq) 95static void nuc900_irq_mask(unsigned int irq)
96{ 96{
97 struct group_irq *group_irq; 97 struct group_irq *group_irq;
98 98
@@ -143,12 +143,12 @@ static void w90x900_irq_mask(unsigned int irq)
143 * to REG_AIC_EOSCR for ACK 143 * to REG_AIC_EOSCR for ACK
144 */ 144 */
145 145
146static void w90x900_irq_ack(unsigned int irq) 146static void nuc900_irq_ack(unsigned int irq)
147{ 147{
148 __raw_writel(0x01, REG_AIC_EOSCR); 148 __raw_writel(0x01, REG_AIC_EOSCR);
149} 149}
150 150
151static void w90x900_irq_unmask(unsigned int irq) 151static void nuc900_irq_unmask(unsigned int irq)
152{ 152{
153 struct group_irq *group_irq; 153 struct group_irq *group_irq;
154 154
@@ -194,20 +194,20 @@ static void w90x900_irq_unmask(unsigned int irq)
194 group_irq_enable(group_irq); 194 group_irq_enable(group_irq);
195} 195}
196 196
197static struct irq_chip w90x900_irq_chip = { 197static struct irq_chip nuc900_irq_chip = {
198 .ack = w90x900_irq_ack, 198 .ack = nuc900_irq_ack,
199 .mask = w90x900_irq_mask, 199 .mask = nuc900_irq_mask,
200 .unmask = w90x900_irq_unmask, 200 .unmask = nuc900_irq_unmask,
201}; 201};
202 202
203void __init w90x900_init_irq(void) 203void __init nuc900_init_irq(void)
204{ 204{
205 int irqno; 205 int irqno;
206 206
207 __raw_writel(0xFFFFFFFE, REG_AIC_MDCR); 207 __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
208 208
209 for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) { 209 for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
210 set_irq_chip(irqno, &w90x900_irq_chip); 210 set_irq_chip(irqno, &nuc900_irq_chip);
211 set_irq_handler(irqno, handle_level_irq); 211 set_irq_handler(irqno, handle_level_irq);
212 set_irq_flags(irqno, IRQF_VALID); 212 set_irq_flags(irqno, IRQF_VALID);
213 } 213 }
diff --git a/arch/arm/mach-w90x900/mach-nuc910evb.c b/arch/arm/mach-w90x900/mach-nuc910evb.c
new file mode 100644
index 000000000000..ec05bda946f3
--- /dev/null
+++ b/arch/arm/mach-w90x900/mach-nuc910evb.c
@@ -0,0 +1,44 @@
1/*
2 * linux/arch/arm/mach-w90x900/mach-nuc910evb.c
3 *
4 * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
5 *
6 * Copyright (C) 2008 Nuvoton technology corporation.
7 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation;version 2 of the License.
13 *
14 */
15
16#include <linux/platform_device.h>
17#include <asm/mach/arch.h>
18#include <asm/mach/map.h>
19#include <asm/mach-types.h>
20#include <mach/map.h>
21
22#include "nuc910.h"
23
24static void __init nuc910evb_map_io(void)
25{
26 nuc910_map_io();
27 nuc910_init_clocks();
28}
29
30static void __init nuc910evb_init(void)
31{
32 nuc910_board_init();
33}
34
35MACHINE_START(W90P910EVB, "W90P910EVB")
36 /* Maintainer: Wan ZongShun */
37 .phys_io = W90X900_PA_UART,
38 .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
39 .boot_params = 0,
40 .map_io = nuc910evb_map_io,
41 .init_irq = nuc900_init_irq,
42 .init_machine = nuc910evb_init,
43 .timer = &nuc900_timer,
44MACHINE_END
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c
deleted file mode 100644
index 117578aed681..000000000000
--- a/arch/arm/mach-w90x900/mach-w90p910evb.c
+++ /dev/null
@@ -1,407 +0,0 @@
1/*
2 * linux/arch/arm/mach-w90x900/mach-w90p910evb.c
3 *
4 * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
5 *
6 * Copyright (C) 2008 Nuvoton technology corporation.
7 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation;version 2 of the License.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/list.h>
20#include <linux/timer.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
23
24#include <linux/mtd/physmap.h>
25#include <linux/mtd/mtd.h>
26#include <linux/mtd/partitions.h>
27
28#include <linux/spi/spi.h>
29#include <linux/spi/flash.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/mach/irq.h>
34#include <asm/mach-types.h>
35
36#include <mach/regs-serial.h>
37#include <mach/map.h>
38
39#include "cpu.h"
40/*w90p910 evb norflash driver data */
41
42#define W90P910_FLASH_BASE 0xA0000000
43#define W90P910_FLASH_SIZE 0x400000
44#define SPIOFFSET 0x200
45#define SPIOREG_SIZE 0x100
46
47static struct mtd_partition w90p910_flash_partitions[] = {
48 {
49 .name = "NOR Partition 1 for kernel (960K)",
50 .size = 0xF0000,
51 .offset = 0x10000,
52 },
53 {
54 .name = "NOR Partition 2 for image (1M)",
55 .size = 0x100000,
56 .offset = 0x100000,
57 },
58 {
59 .name = "NOR Partition 3 for user (2M)",
60 .size = 0x200000,
61 .offset = 0x00200000,
62 }
63};
64
65static struct physmap_flash_data w90p910_flash_data = {
66 .width = 2,
67 .parts = w90p910_flash_partitions,
68 .nr_parts = ARRAY_SIZE(w90p910_flash_partitions),
69};
70
71static struct resource w90p910_flash_resources[] = {
72 {
73 .start = W90P910_FLASH_BASE,
74 .end = W90P910_FLASH_BASE + W90P910_FLASH_SIZE - 1,
75 .flags = IORESOURCE_MEM,
76 }
77};
78
79static struct platform_device w90p910_flash_device = {
80 .name = "physmap-flash",
81 .id = 0,
82 .dev = {
83 .platform_data = &w90p910_flash_data,
84 },
85 .resource = w90p910_flash_resources,
86 .num_resources = ARRAY_SIZE(w90p910_flash_resources),
87};
88
89/* USB EHCI Host Controller */
90
91static struct resource w90x900_usb_ehci_resource[] = {
92 [0] = {
93 .start = W90X900_PA_USBEHCIHOST,
94 .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1,
95 .flags = IORESOURCE_MEM,
96 },
97 [1] = {
98 .start = IRQ_USBH,
99 .end = IRQ_USBH,
100 .flags = IORESOURCE_IRQ,
101 }
102};
103
104static u64 w90x900_device_usb_ehci_dmamask = 0xffffffffUL;
105
106struct platform_device w90x900_device_usb_ehci = {
107 .name = "w90x900-ehci",
108 .id = -1,
109 .num_resources = ARRAY_SIZE(w90x900_usb_ehci_resource),
110 .resource = w90x900_usb_ehci_resource,
111 .dev = {
112 .dma_mask = &w90x900_device_usb_ehci_dmamask,
113 .coherent_dma_mask = 0xffffffffUL
114 }
115};
116EXPORT_SYMBOL(w90x900_device_usb_ehci);
117
118/* USB OHCI Host Controller */
119
120static struct resource w90x900_usb_ohci_resource[] = {
121 [0] = {
122 .start = W90X900_PA_USBOHCIHOST,
123 .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1,
124 .flags = IORESOURCE_MEM,
125 },
126 [1] = {
127 .start = IRQ_USBH,
128 .end = IRQ_USBH,
129 .flags = IORESOURCE_IRQ,
130 }
131};
132
133static u64 w90x900_device_usb_ohci_dmamask = 0xffffffffUL;
134struct platform_device w90x900_device_usb_ohci = {
135 .name = "w90x900-ohci",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(w90x900_usb_ohci_resource),
138 .resource = w90x900_usb_ohci_resource,
139 .dev = {
140 .dma_mask = &w90x900_device_usb_ohci_dmamask,
141 .coherent_dma_mask = 0xffffffffUL
142 }
143};
144EXPORT_SYMBOL(w90x900_device_usb_ohci);
145
146/*TouchScreen controller*/
147
148static struct resource w90x900_ts_resource[] = {
149 [0] = {
150 .start = W90X900_PA_ADC,
151 .end = W90X900_PA_ADC + W90X900_SZ_ADC-1,
152 .flags = IORESOURCE_MEM,
153 },
154 [1] = {
155 .start = IRQ_ADC,
156 .end = IRQ_ADC,
157 .flags = IORESOURCE_IRQ,
158 },
159};
160
161struct platform_device w90x900_device_ts = {
162 .name = "w90x900-ts",
163 .id = -1,
164 .resource = w90x900_ts_resource,
165 .num_resources = ARRAY_SIZE(w90x900_ts_resource),
166};
167EXPORT_SYMBOL(w90x900_device_ts);
168
169/* RTC controller*/
170
171static struct resource w90x900_rtc_resource[] = {
172 [0] = {
173 .start = W90X900_PA_RTC,
174 .end = W90X900_PA_RTC + 0xff,
175 .flags = IORESOURCE_MEM,
176 },
177 [1] = {
178 .start = IRQ_RTC,
179 .end = IRQ_RTC,
180 .flags = IORESOURCE_IRQ,
181 },
182};
183
184struct platform_device w90x900_device_rtc = {
185 .name = "w90x900-rtc",
186 .id = -1,
187 .num_resources = ARRAY_SIZE(w90x900_rtc_resource),
188 .resource = w90x900_rtc_resource,
189};
190EXPORT_SYMBOL(w90x900_device_rtc);
191
192/* KPI controller*/
193
194static struct resource w90x900_kpi_resource[] = {
195 [0] = {
196 .start = W90X900_PA_KPI,
197 .end = W90X900_PA_KPI + W90X900_SZ_KPI - 1,
198 .flags = IORESOURCE_MEM,
199 },
200 [1] = {
201 .start = IRQ_KPI,
202 .end = IRQ_KPI,
203 .flags = IORESOURCE_IRQ,
204 }
205
206};
207
208struct platform_device w90x900_device_kpi = {
209 .name = "w90x900-kpi",
210 .id = -1,
211 .num_resources = ARRAY_SIZE(w90x900_kpi_resource),
212 .resource = w90x900_kpi_resource,
213};
214EXPORT_SYMBOL(w90x900_device_kpi);
215
216/* USB Device (Gadget)*/
217
218static struct resource w90x900_usbgadget_resource[] = {
219 [0] = {
220 .start = W90X900_PA_USBDEV,
221 .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1,
222 .flags = IORESOURCE_MEM,
223 },
224 [1] = {
225 .start = IRQ_USBD,
226 .end = IRQ_USBD,
227 .flags = IORESOURCE_IRQ,
228 }
229};
230
231struct platform_device w90x900_device_usbgadget = {
232 .name = "w90x900-usbgadget",
233 .id = -1,
234 .num_resources = ARRAY_SIZE(w90x900_usbgadget_resource),
235 .resource = w90x900_usbgadget_resource,
236};
237EXPORT_SYMBOL(w90x900_device_usbgadget);
238
239/* FMI Device */
240
241static struct resource w90p910_fmi_resource[] = {
242 [0] = {
243 .start = W90X900_PA_FMI,
244 .end = W90X900_PA_FMI + W90X900_SZ_FMI - 1,
245 .flags = IORESOURCE_MEM,
246 },
247 [1] = {
248 .start = IRQ_FMI,
249 .end = IRQ_FMI,
250 .flags = IORESOURCE_IRQ,
251 }
252};
253
254static struct platform_device w90p910_device_fmi = {
255 .name = "w90p910-fmi",
256 .id = -1,
257 .num_resources = ARRAY_SIZE(w90p910_fmi_resource),
258 .resource = w90p910_fmi_resource,
259};
260
261/* MAC device */
262
263static struct resource w90x900_emc_resource[] = {
264 [0] = {
265 .start = W90X900_PA_EMC,
266 .end = W90X900_PA_EMC + W90X900_SZ_EMC - 1,
267 .flags = IORESOURCE_MEM,
268 },
269 [1] = {
270 .start = IRQ_EMCTX,
271 .end = IRQ_EMCTX,
272 .flags = IORESOURCE_IRQ,
273 },
274 [2] = {
275 .start = IRQ_EMCRX,
276 .end = IRQ_EMCRX,
277 .flags = IORESOURCE_IRQ,
278 }
279};
280
281static u64 w90x900_device_emc_dmamask = 0xffffffffUL;
282static struct platform_device w90p910_device_emc = {
283 .name = "w90p910-emc",
284 .id = -1,
285 .num_resources = ARRAY_SIZE(w90x900_emc_resource),
286 .resource = w90x900_emc_resource,
287 .dev = {
288 .dma_mask = &w90x900_device_emc_dmamask,
289 .coherent_dma_mask = 0xffffffffUL
290 }
291};
292
293/* SPI device */
294
295static struct resource w90p910_spi_resource[] = {
296 [0] = {
297 .start = W90X900_PA_I2C + SPIOFFSET,
298 .end = W90X900_PA_I2C + SPIOFFSET + SPIOREG_SIZE - 1,
299 .flags = IORESOURCE_MEM,
300 },
301 [1] = {
302 .start = IRQ_SSP,
303 .end = IRQ_SSP,
304 .flags = IORESOURCE_IRQ,
305 }
306};
307
308static struct platform_device w90p910_device_spi = {
309 .name = "w90p910-spi",
310 .id = -1,
311 .num_resources = ARRAY_SIZE(w90p910_spi_resource),
312 .resource = w90p910_spi_resource,
313};
314
315/* spi device, spi flash info */
316
317static struct mtd_partition w90p910_spi_flash_partitions[] = {
318 {
319 .name = "bootloader(spi)",
320 .size = 0x0100000,
321 .offset = 0,
322 },
323};
324
325static struct flash_platform_data w90p910_spi_flash_data = {
326 .name = "m25p80",
327 .parts = w90p910_spi_flash_partitions,
328 .nr_parts = ARRAY_SIZE(w90p910_spi_flash_partitions),
329 .type = "w25x16",
330};
331
332static struct spi_board_info w90p910_spi_board_info[] __initdata = {
333 {
334 .modalias = "m25p80",
335 .max_speed_hz = 20000000,
336 .bus_num = 0,
337 .chip_select = 1,
338 .platform_data = &w90p910_spi_flash_data,
339 .mode = SPI_MODE_0,
340 },
341};
342
343/* WDT Device */
344
345static struct resource w90p910_wdt_resource[] = {
346 [0] = {
347 .start = W90X900_PA_TIMER,
348 .end = W90X900_PA_TIMER + W90X900_SZ_TIMER - 1,
349 .flags = IORESOURCE_MEM,
350 },
351 [1] = {
352 .start = IRQ_WDT,
353 .end = IRQ_WDT,
354 .flags = IORESOURCE_IRQ,
355 }
356};
357
358static struct platform_device w90p910_device_wdt = {
359 .name = "w90p910-wdt",
360 .id = -1,
361 .num_resources = ARRAY_SIZE(w90p910_wdt_resource),
362 .resource = w90p910_wdt_resource,
363};
364
365static struct map_desc w90p910_iodesc[] __initdata = {
366};
367
368/*Here should be your evb resourse,such as LCD*/
369
370static struct platform_device *w90p910evb_dev[] __initdata = {
371 &w90p910_serial_device,
372 &w90p910_flash_device,
373 &w90x900_device_usb_ehci,
374 &w90x900_device_usb_ohci,
375 &w90x900_device_ts,
376 &w90x900_device_rtc,
377 &w90x900_device_kpi,
378 &w90x900_device_usbgadget,
379 &w90p910_device_fmi,
380 &w90p910_device_emc,
381 &w90p910_device_spi,
382 &w90p910_device_wdt,
383};
384
385static void __init w90p910evb_map_io(void)
386{
387 w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
388 w90p910_init_clocks();
389}
390
391static void __init w90p910evb_init(void)
392{
393 platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev));
394 spi_register_board_info(w90p910_spi_board_info,
395 ARRAY_SIZE(w90p910_spi_board_info));
396}
397
398MACHINE_START(W90P910EVB, "W90P910EVB")
399 /* Maintainer: Wan ZongShun */
400 .phys_io = W90X900_PA_UART,
401 .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
402 .boot_params = 0,
403 .map_io = w90p910evb_map_io,
404 .init_irq = w90x900_init_irq,
405 .init_machine = w90p910evb_init,
406 .timer = &w90x900_timer,
407MACHINE_END
diff --git a/arch/arm/mach-w90x900/mfp-w90p910.c b/arch/arm/mach-w90x900/mfp.c
index 4533098a0ee4..a47dc9a708ee 100644
--- a/arch/arm/mach-w90x900/mfp-w90p910.c
+++ b/arch/arm/mach-w90x900/mfp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-w90x900/mfp-w90p910.c 2 * linux/arch/arm/mach-w90x900/mfp.c
3 * 3 *
4 * Copyright (c) 2008 Nuvoton technology corporation 4 * Copyright (c) 2008 Nuvoton technology corporation
5 * 5 *
@@ -55,7 +55,7 @@ void mfp_set_groupf(struct device *dev)
55 55
56 mfpen = __raw_readl(REG_MFSEL); 56 mfpen = __raw_readl(REG_MFSEL);
57 57
58 if (strcmp(dev_id, "w90p910-emc") == 0) 58 if (strcmp(dev_id, "nuc900-emc") == 0)
59 mfpen |= GPSELF;/*enable mac*/ 59 mfpen |= GPSELF;/*enable mac*/
60 else 60 else
61 mfpen &= ~GPSELF;/*GPIOF[9:0]*/ 61 mfpen &= ~GPSELF;/*GPIOF[9:0]*/
@@ -79,16 +79,16 @@ void mfp_set_groupc(struct device *dev)
79 79
80 mfpen = __raw_readl(REG_MFSEL); 80 mfpen = __raw_readl(REG_MFSEL);
81 81
82 if (strcmp(dev_id, "w90p910-lcd") == 0) 82 if (strcmp(dev_id, "nuc900-lcd") == 0)
83 mfpen |= GPSELC;/*enable lcd*/ 83 mfpen |= GPSELC;/*enable lcd*/
84 else if (strcmp(dev_id, "w90p910-kpi") == 0) { 84 else if (strcmp(dev_id, "nuc900-kpi") == 0) {
85 mfpen &= (~GPSELC);/*enable kpi*/ 85 mfpen &= (~GPSELC);/*enable kpi*/
86 mfpen |= ENKPI; 86 mfpen |= ENKPI;
87 } else if (strcmp(dev_id, "w90p910-nand") == 0) { 87 } else if (strcmp(dev_id, "nuc900-nand") == 0) {
88 mfpen &= (~GPSELC);/*enable nand*/ 88 mfpen &= (~GPSELC);/*enable nand*/
89 mfpen |= ENNAND; 89 mfpen |= ENNAND;
90 } else 90 } else
91 mfpen &= (~GPSELC);/*GPIOC[14:0]*/ 91 mfpen &= (~GPSELC);/*GPIOC[14:0]*/
92 92
93 __raw_writel(mfpen, REG_MFSEL); 93 __raw_writel(mfpen, REG_MFSEL);
94 94
@@ -111,12 +111,12 @@ void mfp_set_groupi(struct device *dev)
111 111
112 mfpen &= ~GPSELEI1;/*default gpio16*/ 112 mfpen &= ~GPSELEI1;/*default gpio16*/
113 113
114 if (strcmp(dev_id, "w90p910-wdog") == 0) 114 if (strcmp(dev_id, "nuc900-wdog") == 0)
115 mfpen |= GPSELEI1;/*enable wdog*/ 115 mfpen |= GPSELEI1;/*enable wdog*/
116 else if (strcmp(dev_id, "w90p910-atapi") == 0) 116 else if (strcmp(dev_id, "nuc900-atapi") == 0)
117 mfpen |= GPSELEI0;/*enable atapi*/ 117 mfpen |= GPSELEI0;/*enable atapi*/
118 else if (strcmp(dev_id, "w90p910-keypad") == 0) 118 else if (strcmp(dev_id, "nuc900-keypad") == 0)
119 mfpen &= ~GPSELEI0;/*enable keypad*/ 119 mfpen &= ~GPSELEI0;/*enable keypad*/
120 120
121 __raw_writel(mfpen, REG_MFSEL); 121 __raw_writel(mfpen, REG_MFSEL);
122 122
@@ -137,13 +137,13 @@ void mfp_set_groupg(struct device *dev)
137 137
138 mfpen = __raw_readl(REG_MFSEL); 138 mfpen = __raw_readl(REG_MFSEL);
139 139
140 if (strcmp(dev_id, "w90p910-spi") == 0) { 140 if (strcmp(dev_id, "nuc900-spi") == 0) {
141 mfpen &= ~(GPIOG0TO1 | GPIOG2TO3); 141 mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);
142 mfpen |= ENSPI;/*enable spi*/ 142 mfpen |= ENSPI;/*enable spi*/
143 } else if (strcmp(dev_id, "w90p910-i2c0") == 0) { 143 } else if (strcmp(dev_id, "nuc900-i2c0") == 0) {
144 mfpen &= ~(GPIOG0TO1); 144 mfpen &= ~(GPIOG0TO1);
145 mfpen |= ENI2C0;/*enable i2c0*/ 145 mfpen |= ENI2C0;/*enable i2c0*/
146 } else if (strcmp(dev_id, "w90p910-i2c1") == 0) { 146 } else if (strcmp(dev_id, "nuc900-i2c1") == 0) {
147 mfpen &= ~(GPIOG2TO3); 147 mfpen &= ~(GPIOG2TO3);
148 mfpen |= ENI2C1;/*enable i2c1*/ 148 mfpen |= ENI2C1;/*enable i2c1*/
149 } else { 149 } else {
diff --git a/arch/arm/mach-w90x900/nuc910.c b/arch/arm/mach-w90x900/nuc910.c
new file mode 100644
index 000000000000..656f03b3b629
--- /dev/null
+++ b/arch/arm/mach-w90x900/nuc910.c
@@ -0,0 +1,60 @@
1/*
2 * linux/arch/arm/mach-w90x900/nuc910.c
3 *
4 * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
5 *
6 * Copyright (c) 2009 Nuvoton corporation.
7 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * NUC910 cpu support
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation;version 2 of the License.
15 *
16 */
17
18#include <linux/platform_device.h>
19#include <asm/mach/map.h>
20#include <mach/hardware.h>
21#include "cpu.h"
22#include "clock.h"
23
24/* define specific CPU platform device */
25
26static struct platform_device *nuc910_dev[] __initdata = {
27 &nuc900_device_ts,
28 &nuc900_device_rtc,
29};
30
31/* define specific CPU platform io map */
32
33static struct map_desc nuc910evb_iodesc[] __initdata = {
34 IODESC_ENT(USBEHCIHOST),
35 IODESC_ENT(USBOHCIHOST),
36 IODESC_ENT(KPI),
37 IODESC_ENT(USBDEV),
38 IODESC_ENT(ADC),
39};
40
41/*Init NUC910 evb io*/
42
43void __init nuc910_map_io(void)
44{
45 nuc900_map_io(nuc910evb_iodesc, ARRAY_SIZE(nuc910evb_iodesc));
46}
47
48/*Init NUC910 clock*/
49
50void __init nuc910_init_clocks(void)
51{
52 nuc900_init_clocks();
53}
54
55/*Init NUC910 board info*/
56
57void __init nuc910_board_init(void)
58{
59 nuc900_board_init(nuc910_dev, ARRAY_SIZE(nuc910_dev));
60}
diff --git a/arch/arm/mach-w90x900/nuc910.h b/arch/arm/mach-w90x900/nuc910.h
new file mode 100644
index 000000000000..83e9ba5fc26c
--- /dev/null
+++ b/arch/arm/mach-w90x900/nuc910.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-w90x900/nuc910.h
3 *
4 * Copyright (c) 2008 Nuvoton corporation
5 *
6 * Header file for NUC900 CPU support
7 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15
16struct map_desc;
17struct sys_timer;
18
19/* core initialisation functions */
20
21extern void nuc900_init_irq(void);
22extern struct sys_timer nuc900_timer;
23
24/* extern file from nuc910.c */
25
26extern void nuc910_board_init(void);
27extern void nuc910_init_clocks(void);
28extern void nuc910_map_io(void);
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index 5e06770e6014..4128af870b41 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -44,7 +44,7 @@
44 44
45unsigned int timer0_load; 45unsigned int timer0_load;
46 46
47static void w90p910_clockevent_setmode(enum clock_event_mode mode, 47static void nuc900_clockevent_setmode(enum clock_event_mode mode,
48 struct clock_event_device *clk) 48 struct clock_event_device *clk)
49{ 49{
50 unsigned int val; 50 unsigned int val;
@@ -71,7 +71,7 @@ static void w90p910_clockevent_setmode(enum clock_event_mode mode,
71 __raw_writel(val, REG_TCSR0); 71 __raw_writel(val, REG_TCSR0);
72} 72}
73 73
74static int w90p910_clockevent_setnextevent(unsigned long evt, 74static int nuc900_clockevent_setnextevent(unsigned long evt,
75 struct clock_event_device *clk) 75 struct clock_event_device *clk)
76{ 76{
77 unsigned int val; 77 unsigned int val;
@@ -85,20 +85,20 @@ static int w90p910_clockevent_setnextevent(unsigned long evt,
85 return 0; 85 return 0;
86} 86}
87 87
88static struct clock_event_device w90p910_clockevent_device = { 88static struct clock_event_device nuc900_clockevent_device = {
89 .name = "w90p910-timer0", 89 .name = "nuc900-timer0",
90 .shift = 32, 90 .shift = 32,
91 .features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 91 .features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
92 .set_mode = w90p910_clockevent_setmode, 92 .set_mode = nuc900_clockevent_setmode,
93 .set_next_event = w90p910_clockevent_setnextevent, 93 .set_next_event = nuc900_clockevent_setnextevent,
94 .rating = 300, 94 .rating = 300,
95}; 95};
96 96
97/*IRQ handler for the timer*/ 97/*IRQ handler for the timer*/
98 98
99static irqreturn_t w90p910_timer0_interrupt(int irq, void *dev_id) 99static irqreturn_t nuc900_timer0_interrupt(int irq, void *dev_id)
100{ 100{
101 struct clock_event_device *evt = &w90p910_clockevent_device; 101 struct clock_event_device *evt = &nuc900_clockevent_device;
102 102
103 __raw_writel(0x01, REG_TISR); /* clear TIF0 */ 103 __raw_writel(0x01, REG_TISR); /* clear TIF0 */
104 104
@@ -106,40 +106,40 @@ static irqreturn_t w90p910_timer0_interrupt(int irq, void *dev_id)
106 return IRQ_HANDLED; 106 return IRQ_HANDLED;
107} 107}
108 108
109static struct irqaction w90p910_timer0_irq = { 109static struct irqaction nuc900_timer0_irq = {
110 .name = "w90p910-timer0", 110 .name = "nuc900-timer0",
111 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 111 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
112 .handler = w90p910_timer0_interrupt, 112 .handler = nuc900_timer0_interrupt,
113}; 113};
114 114
115static void __init w90p910_clockevents_init(unsigned int rate) 115static void __init nuc900_clockevents_init(unsigned int rate)
116{ 116{
117 w90p910_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC, 117 nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC,
118 w90p910_clockevent_device.shift); 118 nuc900_clockevent_device.shift);
119 w90p910_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff, 119 nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff,
120 &w90p910_clockevent_device); 120 &nuc900_clockevent_device);
121 w90p910_clockevent_device.min_delta_ns = clockevent_delta2ns(0xf, 121 nuc900_clockevent_device.min_delta_ns = clockevent_delta2ns(0xf,
122 &w90p910_clockevent_device); 122 &nuc900_clockevent_device);
123 w90p910_clockevent_device.cpumask = cpumask_of(0); 123 nuc900_clockevent_device.cpumask = cpumask_of(0);
124 124
125 clockevents_register_device(&w90p910_clockevent_device); 125 clockevents_register_device(&nuc900_clockevent_device);
126} 126}
127 127
128static cycle_t w90p910_get_cycles(struct clocksource *cs) 128static cycle_t nuc900_get_cycles(struct clocksource *cs)
129{ 129{
130 return ~__raw_readl(REG_TDR1); 130 return ~__raw_readl(REG_TDR1);
131} 131}
132 132
133static struct clocksource clocksource_w90p910 = { 133static struct clocksource clocksource_nuc900 = {
134 .name = "w90p910-timer1", 134 .name = "nuc900-timer1",
135 .rating = 200, 135 .rating = 200,
136 .read = w90p910_get_cycles, 136 .read = nuc900_get_cycles,
137 .mask = CLOCKSOURCE_MASK(32), 137 .mask = CLOCKSOURCE_MASK(32),
138 .shift = 20, 138 .shift = 20,
139 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 139 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
140}; 140};
141 141
142static void __init w90p910_clocksource_init(unsigned int rate) 142static void __init nuc900_clocksource_init(unsigned int rate)
143{ 143{
144 unsigned int val; 144 unsigned int val;
145 145
@@ -149,12 +149,12 @@ static void __init w90p910_clocksource_init(unsigned int rate)
149 val |= (COUNTEN | PERIOD); 149 val |= (COUNTEN | PERIOD);
150 __raw_writel(val, REG_TCSR1); 150 __raw_writel(val, REG_TCSR1);
151 151
152 clocksource_w90p910.mult = 152 clocksource_nuc900.mult =
153 clocksource_khz2mult((rate / 1000), clocksource_w90p910.shift); 153 clocksource_khz2mult((rate / 1000), clocksource_nuc900.shift);
154 clocksource_register(&clocksource_w90p910); 154 clocksource_register(&clocksource_nuc900);
155} 155}
156 156
157static void __init w90p910_timer_init(void) 157static void __init nuc900_timer_init(void)
158{ 158{
159 struct clk *ck_ext = clk_get(NULL, "ext"); 159 struct clk *ck_ext = clk_get(NULL, "ext");
160 unsigned int rate; 160 unsigned int rate;
@@ -171,12 +171,12 @@ static void __init w90p910_timer_init(void)
171 __raw_writel(RESETINT, REG_TISR); 171 __raw_writel(RESETINT, REG_TISR);
172 timer0_load = (rate / TICKS_PER_SEC); 172 timer0_load = (rate / TICKS_PER_SEC);
173 173
174 setup_irq(IRQ_TIMER0, &w90p910_timer0_irq); 174 setup_irq(IRQ_TIMER0, &nuc900_timer0_irq);
175 175
176 w90p910_clocksource_init(rate); 176 nuc900_clocksource_init(rate);
177 w90p910_clockevents_init(rate); 177 nuc900_clockevents_init(rate);
178} 178}
179 179
180struct sys_timer w90x900_timer = { 180struct sys_timer nuc900_timer = {
181 .init = w90p910_timer_init, 181 .init = nuc900_timer_init,
182}; 182};