diff options
Diffstat (limited to 'arch/arm/mach-w90x900')
27 files changed, 1724 insertions, 631 deletions
diff --git a/arch/arm/mach-w90x900/Kconfig b/arch/arm/mach-w90x900/Kconfig index 8e4178fe5ec..69bab32a8bc 100644 --- a/arch/arm/mach-w90x900/Kconfig +++ b/arch/arm/mach-w90x900/Kconfig | |||
@@ -5,6 +5,16 @@ config CPU_W90P910 | |||
5 | help | 5 | help |
6 | Support for W90P910 of Nuvoton W90X900 CPUs. | 6 | Support for W90P910 of Nuvoton W90X900 CPUs. |
7 | 7 | ||
8 | config CPU_NUC950 | ||
9 | bool | ||
10 | help | ||
11 | Support for NUCP950 of Nuvoton NUC900 CPUs. | ||
12 | |||
13 | config CPU_NUC960 | ||
14 | bool | ||
15 | help | ||
16 | Support for NUCP960 of Nuvoton NUC900 CPUs. | ||
17 | |||
8 | menu "W90P910 Machines" | 18 | menu "W90P910 Machines" |
9 | 19 | ||
10 | config MACH_W90P910EVB | 20 | config MACH_W90P910EVB |
@@ -16,4 +26,24 @@ config MACH_W90P910EVB | |||
16 | 26 | ||
17 | endmenu | 27 | endmenu |
18 | 28 | ||
29 | menu "NUC950 Machines" | ||
30 | |||
31 | config MACH_W90P950EVB | ||
32 | bool "Nuvoton NUC950 Evaluation Board" | ||
33 | select CPU_NUC950 | ||
34 | help | ||
35 | Say Y here if you are using the Nuvoton NUC950EVB | ||
36 | |||
37 | endmenu | ||
38 | |||
39 | menu "NUC960 Machines" | ||
40 | |||
41 | config MACH_W90N960EVB | ||
42 | bool "Nuvoton NUC960 Evaluation Board" | ||
43 | select CPU_NUC960 | ||
44 | help | ||
45 | Say Y here if you are using the Nuvoton NUC960EVB | ||
46 | |||
47 | endmenu | ||
48 | |||
19 | endif | 49 | endif |
diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile index d50c94f4dbd..828c0326441 100644 --- a/arch/arm/mach-w90x900/Makefile +++ b/arch/arm/mach-w90x900/Makefile | |||
@@ -4,12 +4,16 @@ | |||
4 | 4 | ||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-y := irq.o time.o mfp-w90p910.o gpio.o clock.o | 7 | obj-y := irq.o time.o mfp.o gpio.o clock.o |
8 | 8 | obj-y += clksel.o dev.o cpu.o | |
9 | # W90X900 CPU support files | 9 | # W90X900 CPU support files |
10 | 10 | ||
11 | obj-$(CONFIG_CPU_W90P910) += w90p910.o | 11 | obj-$(CONFIG_CPU_W90P910) += nuc910.o |
12 | obj-$(CONFIG_CPU_NUC950) += nuc950.o | ||
13 | obj-$(CONFIG_CPU_NUC960) += nuc960.o | ||
12 | 14 | ||
13 | # machine support | 15 | # machine support |
14 | 16 | ||
15 | obj-$(CONFIG_MACH_W90P910EVB) += mach-w90p910evb.o | 17 | obj-$(CONFIG_MACH_W90P910EVB) += mach-nuc910evb.o |
18 | obj-$(CONFIG_MACH_W90P950EVB) += mach-nuc950evb.o | ||
19 | obj-$(CONFIG_MACH_W90N960EVB) += mach-nuc960evb.o | ||
diff --git a/arch/arm/mach-w90x900/clksel.c b/arch/arm/mach-w90x900/clksel.c new file mode 100644 index 00000000000..3de4a5211c3 --- /dev/null +++ b/arch/arm/mach-w90x900/clksel.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/clksel.c | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/regs-clock.h> | ||
26 | |||
27 | #define PLL0 0x00 | ||
28 | #define PLL1 0x01 | ||
29 | #define OTHER 0x02 | ||
30 | #define EXT 0x03 | ||
31 | #define MSOFFSET 0x0C | ||
32 | #define ATAOFFSET 0x0a | ||
33 | #define LCDOFFSET 0x06 | ||
34 | #define AUDOFFSET 0x04 | ||
35 | #define CPUOFFSET 0x00 | ||
36 | |||
37 | static DEFINE_MUTEX(clksel_sem); | ||
38 | |||
39 | static void clock_source_select(const char *dev_id, unsigned int clkval) | ||
40 | { | ||
41 | unsigned int clksel, offset; | ||
42 | |||
43 | clksel = __raw_readl(REG_CLKSEL); | ||
44 | |||
45 | if (strcmp(dev_id, "nuc900-ms") == 0) | ||
46 | offset = MSOFFSET; | ||
47 | else if (strcmp(dev_id, "nuc900-atapi") == 0) | ||
48 | offset = ATAOFFSET; | ||
49 | else if (strcmp(dev_id, "nuc900-lcd") == 0) | ||
50 | offset = LCDOFFSET; | ||
51 | else if (strcmp(dev_id, "nuc900-audio") == 0) | ||
52 | offset = AUDOFFSET; | ||
53 | else | ||
54 | offset = CPUOFFSET; | ||
55 | |||
56 | clksel &= ~(0x03 << offset); | ||
57 | clksel |= (clkval << offset); | ||
58 | |||
59 | __raw_writel(clksel, REG_CLKSEL); | ||
60 | } | ||
61 | |||
62 | void nuc900_clock_source(struct device *dev, unsigned char *src) | ||
63 | { | ||
64 | unsigned int clkval; | ||
65 | const char *dev_id; | ||
66 | |||
67 | BUG_ON(!src); | ||
68 | clkval = 0; | ||
69 | |||
70 | mutex_lock(&clksel_sem); | ||
71 | |||
72 | if (dev) | ||
73 | dev_id = dev_name(dev); | ||
74 | else | ||
75 | dev_id = "cpufreq"; | ||
76 | |||
77 | if (strcmp(src, "pll0") == 0) | ||
78 | clkval = PLL0; | ||
79 | else if (strcmp(src, "pll1") == 0) | ||
80 | clkval = PLL1; | ||
81 | else if (strcmp(src, "ext") == 0) | ||
82 | clkval = EXT; | ||
83 | else if (strcmp(src, "oth") == 0) | ||
84 | clkval = OTHER; | ||
85 | |||
86 | clock_source_select(dev_id, clkval); | ||
87 | |||
88 | mutex_unlock(&clksel_sem); | ||
89 | } | ||
90 | EXPORT_SYMBOL(nuc900_clock_source); | ||
91 | |||
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c index f420613cd39..b785994bab0 100644 --- a/arch/arm/mach-w90x900/clock.c +++ b/arch/arm/mach-w90x900/clock.c | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include "clock.h" | 26 | #include "clock.h" |
27 | 27 | ||
28 | #define SUBCLK 0x24 | ||
29 | |||
28 | static DEFINE_SPINLOCK(clocks_lock); | 30 | static DEFINE_SPINLOCK(clocks_lock); |
29 | 31 | ||
30 | int clk_enable(struct clk *clk) | 32 | int clk_enable(struct clk *clk) |
@@ -53,7 +55,13 @@ void clk_disable(struct clk *clk) | |||
53 | } | 55 | } |
54 | EXPORT_SYMBOL(clk_disable); | 56 | EXPORT_SYMBOL(clk_disable); |
55 | 57 | ||
56 | void w90x900_clk_enable(struct clk *clk, int enable) | 58 | unsigned long clk_get_rate(struct clk *clk) |
59 | { | ||
60 | return 15000000; | ||
61 | } | ||
62 | EXPORT_SYMBOL(clk_get_rate); | ||
63 | |||
64 | void nuc900_clk_enable(struct clk *clk, int enable) | ||
57 | { | 65 | { |
58 | unsigned int clocks = clk->cken; | 66 | unsigned int clocks = clk->cken; |
59 | unsigned long clken; | 67 | unsigned long clken; |
@@ -68,6 +76,22 @@ void w90x900_clk_enable(struct clk *clk, int enable) | |||
68 | __raw_writel(clken, W90X900_VA_CLKPWR); | 76 | __raw_writel(clken, W90X900_VA_CLKPWR); |
69 | } | 77 | } |
70 | 78 | ||
79 | void nuc900_subclk_enable(struct clk *clk, int enable) | ||
80 | { | ||
81 | unsigned int clocks = clk->cken; | ||
82 | unsigned long clken; | ||
83 | |||
84 | clken = __raw_readl(W90X900_VA_CLKPWR + SUBCLK); | ||
85 | |||
86 | if (enable) | ||
87 | clken |= clocks; | ||
88 | else | ||
89 | clken &= ~clocks; | ||
90 | |||
91 | __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK); | ||
92 | } | ||
93 | |||
94 | |||
71 | void clks_register(struct clk_lookup *clks, size_t num) | 95 | void clks_register(struct clk_lookup *clks, size_t num) |
72 | { | 96 | { |
73 | int i; | 97 | int i; |
diff --git a/arch/arm/mach-w90x900/clock.h b/arch/arm/mach-w90x900/clock.h index 4f27bda76d5..f5816a06eed 100644 --- a/arch/arm/mach-w90x900/clock.h +++ b/arch/arm/mach-w90x900/clock.h | |||
@@ -12,7 +12,8 @@ | |||
12 | 12 | ||
13 | #include <asm/clkdev.h> | 13 | #include <asm/clkdev.h> |
14 | 14 | ||
15 | void w90x900_clk_enable(struct clk *clk, int enable); | 15 | void nuc900_clk_enable(struct clk *clk, int enable); |
16 | void nuc900_subclk_enable(struct clk *clk, int enable); | ||
16 | void clks_register(struct clk_lookup *clks, size_t num); | 17 | void clks_register(struct clk_lookup *clks, size_t num); |
17 | 18 | ||
18 | struct clk { | 19 | struct clk { |
@@ -23,10 +24,17 @@ struct clk { | |||
23 | 24 | ||
24 | #define DEFINE_CLK(_name, _ctrlbit) \ | 25 | #define DEFINE_CLK(_name, _ctrlbit) \ |
25 | struct clk clk_##_name = { \ | 26 | struct clk clk_##_name = { \ |
26 | .enable = w90x900_clk_enable, \ | 27 | .enable = nuc900_clk_enable, \ |
27 | .cken = (1 << _ctrlbit), \ | 28 | .cken = (1 << _ctrlbit), \ |
28 | } | 29 | } |
29 | 30 | ||
31 | #define DEFINE_SUBCLK(_name, _ctrlbit) \ | ||
32 | struct clk clk_##_name = { \ | ||
33 | .enable = nuc900_subclk_enable, \ | ||
34 | .cken = (1 << _ctrlbit), \ | ||
35 | } | ||
36 | |||
37 | |||
30 | #define DEF_CLKLOOK(_clk, _devname, _conname) \ | 38 | #define DEF_CLKLOOK(_clk, _devname, _conname) \ |
31 | { \ | 39 | { \ |
32 | .clk = _clk, \ | 40 | .clk = _clk, \ |
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c new file mode 100644 index 00000000000..921cef991bf --- /dev/null +++ b/arch/arm/mach-w90x900/cpu.c | |||
@@ -0,0 +1,212 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/cpu.c | ||
3 | * | ||
4 | * Copyright (c) 2009 Nuvoton corporation. | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * NUC900 series cpu common support | ||
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 as published by | ||
12 | * 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 | #include <linux/io.h> | ||
24 | #include <linux/serial_8250.h> | ||
25 | #include <linux/delay.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <asm/mach/irq.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <mach/hardware.h> | ||
33 | #include <mach/regs-serial.h> | ||
34 | #include <mach/regs-clock.h> | ||
35 | #include <mach/regs-ebi.h> | ||
36 | |||
37 | #include "cpu.h" | ||
38 | #include "clock.h" | ||
39 | |||
40 | /* Initial IO mappings */ | ||
41 | |||
42 | static struct map_desc nuc900_iodesc[] __initdata = { | ||
43 | IODESC_ENT(IRQ), | ||
44 | IODESC_ENT(GCR), | ||
45 | IODESC_ENT(UART), | ||
46 | IODESC_ENT(TIMER), | ||
47 | IODESC_ENT(EBI), | ||
48 | }; | ||
49 | |||
50 | /* Initial clock declarations. */ | ||
51 | static DEFINE_CLK(lcd, 0); | ||
52 | static DEFINE_CLK(audio, 1); | ||
53 | static DEFINE_CLK(fmi, 4); | ||
54 | static DEFINE_SUBCLK(ms, 0); | ||
55 | static DEFINE_SUBCLK(sd, 1); | ||
56 | static DEFINE_CLK(dmac, 5); | ||
57 | static DEFINE_CLK(atapi, 6); | ||
58 | static DEFINE_CLK(emc, 7); | ||
59 | static DEFINE_SUBCLK(rmii, 2); | ||
60 | static DEFINE_CLK(usbd, 8); | ||
61 | static DEFINE_CLK(usbh, 9); | ||
62 | static DEFINE_CLK(g2d, 10);; | ||
63 | static DEFINE_CLK(pwm, 18); | ||
64 | static DEFINE_CLK(ps2, 24); | ||
65 | static DEFINE_CLK(kpi, 25); | ||
66 | static DEFINE_CLK(wdt, 26); | ||
67 | static DEFINE_CLK(gdma, 27); | ||
68 | static DEFINE_CLK(adc, 28); | ||
69 | static DEFINE_CLK(usi, 29); | ||
70 | static DEFINE_CLK(ext, 0); | ||
71 | |||
72 | static struct clk_lookup nuc900_clkregs[] = { | ||
73 | DEF_CLKLOOK(&clk_lcd, "nuc900-lcd", NULL), | ||
74 | DEF_CLKLOOK(&clk_audio, "nuc900-audio", NULL), | ||
75 | DEF_CLKLOOK(&clk_fmi, "nuc900-fmi", NULL), | ||
76 | DEF_CLKLOOK(&clk_ms, "nuc900-fmi", "MS"), | ||
77 | DEF_CLKLOOK(&clk_sd, "nuc900-fmi", "SD"), | ||
78 | DEF_CLKLOOK(&clk_dmac, "nuc900-dmac", NULL), | ||
79 | DEF_CLKLOOK(&clk_atapi, "nuc900-atapi", NULL), | ||
80 | DEF_CLKLOOK(&clk_emc, "nuc900-emc", NULL), | ||
81 | DEF_CLKLOOK(&clk_rmii, "nuc900-emc", "RMII"), | ||
82 | DEF_CLKLOOK(&clk_usbd, "nuc900-usbd", NULL), | ||
83 | DEF_CLKLOOK(&clk_usbh, "nuc900-usbh", NULL), | ||
84 | DEF_CLKLOOK(&clk_g2d, "nuc900-g2d", NULL), | ||
85 | DEF_CLKLOOK(&clk_pwm, "nuc900-pwm", NULL), | ||
86 | DEF_CLKLOOK(&clk_ps2, "nuc900-ps2", NULL), | ||
87 | DEF_CLKLOOK(&clk_kpi, "nuc900-kpi", NULL), | ||
88 | DEF_CLKLOOK(&clk_wdt, "nuc900-wdt", NULL), | ||
89 | DEF_CLKLOOK(&clk_gdma, "nuc900-gdma", NULL), | ||
90 | DEF_CLKLOOK(&clk_adc, "nuc900-adc", NULL), | ||
91 | DEF_CLKLOOK(&clk_usi, "nuc900-spi", NULL), | ||
92 | DEF_CLKLOOK(&clk_ext, NULL, "ext"), | ||
93 | }; | ||
94 | |||
95 | /* Initial serial platform data */ | ||
96 | |||
97 | struct plat_serial8250_port nuc900_uart_data[] = { | ||
98 | NUC900_8250PORT(UART0), | ||
99 | }; | ||
100 | |||
101 | struct platform_device nuc900_serial_device = { | ||
102 | .name = "serial8250", | ||
103 | .id = PLAT8250_DEV_PLATFORM, | ||
104 | .dev = { | ||
105 | .platform_data = nuc900_uart_data, | ||
106 | }, | ||
107 | }; | ||
108 | |||
109 | /*Set NUC900 series cpu frequence*/ | ||
110 | static int __init nuc900_set_clkval(unsigned int cpufreq) | ||
111 | { | ||
112 | unsigned int pllclk, ahbclk, apbclk, val; | ||
113 | |||
114 | pllclk = 0; | ||
115 | ahbclk = 0; | ||
116 | apbclk = 0; | ||
117 | |||
118 | switch (cpufreq) { | ||
119 | case 66: | ||
120 | pllclk = PLL_66MHZ; | ||
121 | ahbclk = AHB_CPUCLK_1_1; | ||
122 | apbclk = APB_AHB_1_2; | ||
123 | break; | ||
124 | |||
125 | case 100: | ||
126 | pllclk = PLL_100MHZ; | ||
127 | ahbclk = AHB_CPUCLK_1_1; | ||
128 | apbclk = APB_AHB_1_2; | ||
129 | break; | ||
130 | |||
131 | case 120: | ||
132 | pllclk = PLL_120MHZ; | ||
133 | ahbclk = AHB_CPUCLK_1_2; | ||
134 | apbclk = APB_AHB_1_2; | ||
135 | break; | ||
136 | |||
137 | case 166: | ||
138 | pllclk = PLL_166MHZ; | ||
139 | ahbclk = AHB_CPUCLK_1_2; | ||
140 | apbclk = APB_AHB_1_2; | ||
141 | break; | ||
142 | |||
143 | case 200: | ||
144 | pllclk = PLL_200MHZ; | ||
145 | ahbclk = AHB_CPUCLK_1_2; | ||
146 | apbclk = APB_AHB_1_2; | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | __raw_writel(pllclk, REG_PLLCON0); | ||
151 | |||
152 | val = __raw_readl(REG_CLKDIV); | ||
153 | val &= ~(0x03 << 24 | 0x03 << 26); | ||
154 | val |= (ahbclk << 24 | apbclk << 26); | ||
155 | __raw_writel(val, REG_CLKDIV); | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | static int __init nuc900_set_cpufreq(char *str) | ||
160 | { | ||
161 | unsigned long cpufreq, val; | ||
162 | |||
163 | if (!*str) | ||
164 | return 0; | ||
165 | |||
166 | strict_strtoul(str, 0, &cpufreq); | ||
167 | |||
168 | nuc900_clock_source(NULL, "ext"); | ||
169 | |||
170 | nuc900_set_clkval(cpufreq); | ||
171 | |||
172 | mdelay(1); | ||
173 | |||
174 | val = __raw_readl(REG_CKSKEW); | ||
175 | val &= ~0xff; | ||
176 | val |= DEFAULTSKEW; | ||
177 | __raw_writel(val, REG_CKSKEW); | ||
178 | |||
179 | nuc900_clock_source(NULL, "pll0"); | ||
180 | |||
181 | return 1; | ||
182 | } | ||
183 | |||
184 | __setup("cpufreq=", nuc900_set_cpufreq); | ||
185 | |||
186 | /*Init NUC900 evb io*/ | ||
187 | |||
188 | void __init nuc900_map_io(struct map_desc *mach_desc, int mach_size) | ||
189 | { | ||
190 | unsigned long idcode = 0x0; | ||
191 | |||
192 | iotable_init(mach_desc, mach_size); | ||
193 | iotable_init(nuc900_iodesc, ARRAY_SIZE(nuc900_iodesc)); | ||
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); | ||
204 | } | ||
205 | |||
206 | /*Init NUC900 clock*/ | ||
207 | |||
208 | void __init nuc900_init_clocks(void) | ||
209 | { | ||
210 | clks_register(nuc900_clkregs, ARRAY_SIZE(nuc900_clkregs)); | ||
211 | } | ||
212 | |||
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h index 57b5dbabeb4..4d58ba164e2 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,29 +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 | |||
35 | struct w90x900_uartcfg; | ||
36 | struct map_desc; | ||
37 | struct sys_timer; | ||
38 | |||
39 | /* core initialisation functions */ | ||
40 | |||
41 | extern void w90x900_init_irq(void); | ||
42 | extern void w90p910_init_io(struct map_desc *mach_desc, int size); | ||
43 | extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no); | ||
44 | extern void w90p910_init_clocks(void); | ||
45 | extern void w90p910_map_io(struct map_desc *mach_desc, int size); | ||
46 | extern struct platform_device w90p910_serial_device; | ||
47 | extern struct sys_timer w90x900_timer; | ||
48 | |||
49 | #define W90X900_8250PORT(name) \ | ||
50 | { \ | 28 | { \ |
51 | .membase = name##_BA, \ | 29 | .membase = name##_BA, \ |
52 | .mapbase = name##_PA, \ | 30 | .mapbase = name##_PA, \ |
@@ -56,3 +34,26 @@ extern struct sys_timer w90x900_timer; | |||
56 | .iotype = UPIO_MEM, \ | 34 | .iotype = UPIO_MEM, \ |
57 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ | 35 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ |
58 | } | 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 | |||
48 | extern void nuc900_clock_source(struct device *dev, unsigned char *src); | ||
49 | extern void nuc900_init_clocks(void); | ||
50 | extern void nuc900_map_io(struct map_desc *mach_desc, int mach_size); | ||
51 | extern 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 | |||
55 | extern struct platform_device nuc900_serial_device; | ||
56 | extern struct platform_device nuc900_device_fmi; | ||
57 | extern struct platform_device nuc900_device_kpi; | ||
58 | extern struct platform_device nuc900_device_rtc; | ||
59 | extern 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 00000000000..2a6f98de48d --- /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 | |||
46 | static 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 | |||
64 | static 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 | |||
70 | static 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 | |||
78 | static 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 | |||
90 | static 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 | |||
103 | static u64 nuc900_device_usb_ehci_dmamask = 0xffffffffUL; | ||
104 | |||
105 | static 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 | |||
118 | static 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 | |||
131 | static u64 nuc900_device_usb_ohci_dmamask = 0xffffffffUL; | ||
132 | static 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 | |||
145 | static 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 | |||
158 | static 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 | |||
167 | static 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 | |||
185 | static u64 nuc900_device_emc_dmamask = 0xffffffffUL; | ||
186 | static 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 | |||
199 | static 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 | |||
212 | static 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 | |||
221 | static struct mtd_partition nuc900_spi_flash_partitions[] = { | ||
222 | { | ||
223 | .name = "bootloader(spi)", | ||
224 | .size = 0x0100000, | ||
225 | .offset = 0, | ||
226 | }, | ||
227 | }; | ||
228 | |||
229 | static 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 | |||
236 | static 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 | |||
249 | static 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 | |||
262 | static 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 | |||
280 | static 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 | |||
293 | struct 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 | |||
302 | static 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 | |||
315 | struct 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 | |||
324 | static 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 | |||
337 | struct 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 | |||
346 | static 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 | |||
360 | struct 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 | |||
369 | static 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 | |||
382 | void __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 c72e0dfa182..ba05aec7ea4 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 | ||
48 | struct w90p910_gpio_chip { | 48 | struct 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 | ||
54 | static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset) | 54 | static 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 | ||
66 | static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | 66 | static 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 | ||
87 | static int w90p910_dir_input(struct gpio_chip *chip, unsigned offset) | 87 | static 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 | ||
105 | static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val) | 105 | static 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 | ||
133 | static struct w90p910_gpio_chip w90p910_gpio[] = { | 133 | static 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 | ||
143 | void __init w90p910_init_gpio(int nr_group) | 143 | void __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/include/mach/regs-clock.h b/arch/arm/mach-w90x900/include/mach/regs-clock.h index f10b6a8dc06..516d6b477b6 100644 --- a/arch/arm/mach-w90x900/include/mach/regs-clock.h +++ b/arch/arm/mach-w90x900/include/mach/regs-clock.h | |||
@@ -28,4 +28,26 @@ | |||
28 | #define REG_CLKEN1 (CLK_BA + 0x24) | 28 | #define REG_CLKEN1 (CLK_BA + 0x24) |
29 | #define REG_CLKDIV1 (CLK_BA + 0x28) | 29 | #define REG_CLKDIV1 (CLK_BA + 0x28) |
30 | 30 | ||
31 | /* Define PLL freq setting */ | ||
32 | #define PLL_DISABLE 0x12B63 | ||
33 | #define PLL_66MHZ 0x2B63 | ||
34 | #define PLL_100MHZ 0x4F64 | ||
35 | #define PLL_120MHZ 0x4F63 | ||
36 | #define PLL_166MHZ 0x4124 | ||
37 | #define PLL_200MHZ 0x4F24 | ||
38 | |||
39 | /* Define AHB:CPUFREQ ratio */ | ||
40 | #define AHB_CPUCLK_1_1 0x00 | ||
41 | #define AHB_CPUCLK_1_2 0x01 | ||
42 | #define AHB_CPUCLK_1_4 0x02 | ||
43 | #define AHB_CPUCLK_1_8 0x03 | ||
44 | |||
45 | /* Define APB:AHB ratio */ | ||
46 | #define APB_AHB_1_2 0x01 | ||
47 | #define APB_AHB_1_4 0x02 | ||
48 | #define APB_AHB_1_8 0x03 | ||
49 | |||
50 | /* Define clock skew */ | ||
51 | #define DEFAULTSKEW 0x48 | ||
52 | |||
31 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ | 53 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ |
diff --git a/arch/arm/mach-w90x900/include/mach/regs-ebi.h b/arch/arm/mach-w90x900/include/mach/regs-ebi.h new file mode 100644 index 00000000000..b68455e7f88 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-ebi.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-ebi.h | ||
3 | * | ||
4 | * Copyright (c) 2009 Nuvoton technology corporation. | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_EBI_H | ||
15 | #define __ASM_ARCH_REGS_EBI_H | ||
16 | |||
17 | /* EBI Control Registers */ | ||
18 | |||
19 | #define EBI_BA W90X900_VA_EBI | ||
20 | #define REG_EBICON (EBI_BA + 0x00) | ||
21 | #define REG_ROMCON (EBI_BA + 0x04) | ||
22 | #define REG_SDCONF0 (EBI_BA + 0x08) | ||
23 | #define REG_SDCONF1 (EBI_BA + 0x0C) | ||
24 | #define REG_SDTIME0 (EBI_BA + 0x10) | ||
25 | #define REG_SDTIME1 (EBI_BA + 0x14) | ||
26 | #define REG_EXT0CON (EBI_BA + 0x18) | ||
27 | #define REG_EXT1CON (EBI_BA + 0x1C) | ||
28 | #define REG_EXT2CON (EBI_BA + 0x20) | ||
29 | #define REG_EXT3CON (EBI_BA + 0x24) | ||
30 | #define REG_EXT4CON (EBI_BA + 0x28) | ||
31 | #define REG_CKSKEW (EBI_BA + 0x2C) | ||
32 | |||
33 | #endif /* __ASM_ARCH_REGS_EBI_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/w90p910_keypad.h b/arch/arm/mach-w90x900/include/mach/w90p910_keypad.h new file mode 100644 index 00000000000..556778e8dda --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/w90p910_keypad.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __ASM_ARCH_W90P910_KEYPAD_H | ||
2 | #define __ASM_ARCH_W90P910_KEYPAD_H | ||
3 | |||
4 | #include <linux/input/matrix_keypad.h> | ||
5 | |||
6 | extern void mfp_set_groupi(struct device *dev); | ||
7 | |||
8 | struct w90p910_keypad_platform_data { | ||
9 | const struct matrix_keymap_data *keymap_data; | ||
10 | |||
11 | unsigned int prescale; | ||
12 | unsigned int debounce; | ||
13 | }; | ||
14 | |||
15 | #endif /* __ASM_ARCH_W90P910_KEYPAD_H */ | ||
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c index 0b4fc194729..0ce9d8e867e 100644 --- a/arch/arm/mach-w90x900/irq.c +++ b/arch/arm/mach-w90x900/irq.c | |||
@@ -10,8 +10,7 @@ | |||
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or | 13 | * the Free Software Foundation;version 2 of the License. |
14 | * (at your option) any later version. | ||
15 | * | 14 | * |
16 | */ | 15 | */ |
17 | 16 | ||
@@ -29,9 +28,114 @@ | |||
29 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
30 | #include <mach/regs-irq.h> | 29 | #include <mach/regs-irq.h> |
31 | 30 | ||
32 | static void w90x900_irq_mask(unsigned int irq) | 31 | struct group_irq { |
32 | unsigned long gpen; | ||
33 | unsigned int enabled; | ||
34 | void (*enable)(struct group_irq *, int enable); | ||
35 | }; | ||
36 | |||
37 | static DEFINE_SPINLOCK(groupirq_lock); | ||
38 | |||
39 | #define DEFINE_GROUP(_name, _ctrlbit, _num) \ | ||
40 | struct group_irq group_##_name = { \ | ||
41 | .enable = nuc900_group_enable, \ | ||
42 | .gpen = ((1 << _num) - 1) << _ctrlbit, \ | ||
43 | } | ||
44 | |||
45 | static void nuc900_group_enable(struct group_irq *gpirq, int enable); | ||
46 | |||
47 | static DEFINE_GROUP(nirq0, 0, 4); | ||
48 | static DEFINE_GROUP(nirq1, 4, 4); | ||
49 | static DEFINE_GROUP(usbh, 8, 2); | ||
50 | static DEFINE_GROUP(ottimer, 16, 3); | ||
51 | static DEFINE_GROUP(gdma, 20, 2); | ||
52 | static DEFINE_GROUP(sc, 24, 2); | ||
53 | static DEFINE_GROUP(i2c, 26, 2); | ||
54 | static DEFINE_GROUP(ps2, 28, 2); | ||
55 | |||
56 | static int group_irq_enable(struct group_irq *group_irq) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | |||
60 | spin_lock_irqsave(&groupirq_lock, flags); | ||
61 | if (group_irq->enabled++ == 0) | ||
62 | (group_irq->enable)(group_irq, 1); | ||
63 | spin_unlock_irqrestore(&groupirq_lock, flags); | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static void group_irq_disable(struct group_irq *group_irq) | ||
33 | { | 69 | { |
70 | unsigned long flags; | ||
71 | |||
72 | WARN_ON(group_irq->enabled == 0); | ||
73 | |||
74 | spin_lock_irqsave(&groupirq_lock, flags); | ||
75 | if (--group_irq->enabled == 0) | ||
76 | (group_irq->enable)(group_irq, 0); | ||
77 | spin_unlock_irqrestore(&groupirq_lock, flags); | ||
78 | } | ||
79 | |||
80 | static void nuc900_group_enable(struct group_irq *gpirq, int enable) | ||
81 | { | ||
82 | unsigned int groupen = gpirq->gpen; | ||
83 | unsigned long regval; | ||
84 | |||
85 | regval = __raw_readl(REG_AIC_GEN); | ||
86 | |||
87 | if (enable) | ||
88 | regval |= groupen; | ||
89 | else | ||
90 | regval &= ~groupen; | ||
91 | |||
92 | __raw_writel(regval, REG_AIC_GEN); | ||
93 | } | ||
94 | |||
95 | static void nuc900_irq_mask(unsigned int irq) | ||
96 | { | ||
97 | struct group_irq *group_irq; | ||
98 | |||
99 | group_irq = NULL; | ||
100 | |||
34 | __raw_writel(1 << irq, REG_AIC_MDCR); | 101 | __raw_writel(1 << irq, REG_AIC_MDCR); |
102 | |||
103 | switch (irq) { | ||
104 | case IRQ_GROUP0: | ||
105 | group_irq = &group_nirq0; | ||
106 | break; | ||
107 | |||
108 | case IRQ_GROUP1: | ||
109 | group_irq = &group_nirq1; | ||
110 | break; | ||
111 | |||
112 | case IRQ_USBH: | ||
113 | group_irq = &group_usbh; | ||
114 | break; | ||
115 | |||
116 | case IRQ_T_INT_GROUP: | ||
117 | group_irq = &group_ottimer; | ||
118 | break; | ||
119 | |||
120 | case IRQ_GDMAGROUP: | ||
121 | group_irq = &group_gdma; | ||
122 | break; | ||
123 | |||
124 | case IRQ_SCGROUP: | ||
125 | group_irq = &group_sc; | ||
126 | break; | ||
127 | |||
128 | case IRQ_I2CGROUP: | ||
129 | group_irq = &group_i2c; | ||
130 | break; | ||
131 | |||
132 | case IRQ_P2SGROUP: | ||
133 | group_irq = &group_ps2; | ||
134 | break; | ||
135 | } | ||
136 | |||
137 | if (group_irq) | ||
138 | group_irq_disable(group_irq); | ||
35 | } | 139 | } |
36 | 140 | ||
37 | /* | 141 | /* |
@@ -39,37 +143,71 @@ static void w90x900_irq_mask(unsigned int irq) | |||
39 | * to REG_AIC_EOSCR for ACK | 143 | * to REG_AIC_EOSCR for ACK |
40 | */ | 144 | */ |
41 | 145 | ||
42 | static void w90x900_irq_ack(unsigned int irq) | 146 | static void nuc900_irq_ack(unsigned int irq) |
43 | { | 147 | { |
44 | __raw_writel(0x01, REG_AIC_EOSCR); | 148 | __raw_writel(0x01, REG_AIC_EOSCR); |
45 | } | 149 | } |
46 | 150 | ||
47 | static void w90x900_irq_unmask(unsigned int irq) | 151 | static void nuc900_irq_unmask(unsigned int irq) |
48 | { | 152 | { |
49 | unsigned long mask; | 153 | struct group_irq *group_irq; |
154 | |||
155 | group_irq = NULL; | ||
50 | 156 | ||
51 | if (irq == IRQ_T_INT_GROUP) { | ||
52 | mask = __raw_readl(REG_AIC_GEN); | ||
53 | __raw_writel(TIME_GROUP_IRQ | mask, REG_AIC_GEN); | ||
54 | __raw_writel(1 << IRQ_T_INT_GROUP, REG_AIC_MECR); | ||
55 | } | ||
56 | __raw_writel(1 << irq, REG_AIC_MECR); | 157 | __raw_writel(1 << irq, REG_AIC_MECR); |
158 | |||
159 | switch (irq) { | ||
160 | case IRQ_GROUP0: | ||
161 | group_irq = &group_nirq0; | ||
162 | break; | ||
163 | |||
164 | case IRQ_GROUP1: | ||
165 | group_irq = &group_nirq1; | ||
166 | break; | ||
167 | |||
168 | case IRQ_USBH: | ||
169 | group_irq = &group_usbh; | ||
170 | break; | ||
171 | |||
172 | case IRQ_T_INT_GROUP: | ||
173 | group_irq = &group_ottimer; | ||
174 | break; | ||
175 | |||
176 | case IRQ_GDMAGROUP: | ||
177 | group_irq = &group_gdma; | ||
178 | break; | ||
179 | |||
180 | case IRQ_SCGROUP: | ||
181 | group_irq = &group_sc; | ||
182 | break; | ||
183 | |||
184 | case IRQ_I2CGROUP: | ||
185 | group_irq = &group_i2c; | ||
186 | break; | ||
187 | |||
188 | case IRQ_P2SGROUP: | ||
189 | group_irq = &group_ps2; | ||
190 | break; | ||
191 | } | ||
192 | |||
193 | if (group_irq) | ||
194 | group_irq_enable(group_irq); | ||
57 | } | 195 | } |
58 | 196 | ||
59 | static struct irq_chip w90x900_irq_chip = { | 197 | static struct irq_chip nuc900_irq_chip = { |
60 | .ack = w90x900_irq_ack, | 198 | .ack = nuc900_irq_ack, |
61 | .mask = w90x900_irq_mask, | 199 | .mask = nuc900_irq_mask, |
62 | .unmask = w90x900_irq_unmask, | 200 | .unmask = nuc900_irq_unmask, |
63 | }; | 201 | }; |
64 | 202 | ||
65 | void __init w90x900_init_irq(void) | 203 | void __init nuc900_init_irq(void) |
66 | { | 204 | { |
67 | int irqno; | 205 | int irqno; |
68 | 206 | ||
69 | __raw_writel(0xFFFFFFFE, REG_AIC_MDCR); | 207 | __raw_writel(0xFFFFFFFE, REG_AIC_MDCR); |
70 | 208 | ||
71 | for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) { | 209 | for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) { |
72 | set_irq_chip(irqno, &w90x900_irq_chip); | 210 | set_irq_chip(irqno, &nuc900_irq_chip); |
73 | set_irq_handler(irqno, handle_level_irq); | 211 | set_irq_handler(irqno, handle_level_irq); |
74 | set_irq_flags(irqno, IRQF_VALID); | 212 | set_irq_flags(irqno, IRQF_VALID); |
75 | } | 213 | } |
diff --git a/arch/arm/mach-w90x900/mach-nuc910evb.c b/arch/arm/mach-w90x900/mach-nuc910evb.c new file mode 100644 index 00000000000..ec05bda946f --- /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 | |||
24 | static void __init nuc910evb_map_io(void) | ||
25 | { | ||
26 | nuc910_map_io(); | ||
27 | nuc910_init_clocks(); | ||
28 | } | ||
29 | |||
30 | static void __init nuc910evb_init(void) | ||
31 | { | ||
32 | nuc910_board_init(); | ||
33 | } | ||
34 | |||
35 | MACHINE_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, | ||
44 | MACHINE_END | ||
diff --git a/arch/arm/mach-w90x900/mach-nuc950evb.c b/arch/arm/mach-w90x900/mach-nuc950evb.c new file mode 100644 index 00000000000..cef903bcccd --- /dev/null +++ b/arch/arm/mach-w90x900/mach-nuc950evb.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/mach-nuc950evb.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 "nuc950.h" | ||
23 | |||
24 | static void __init nuc950evb_map_io(void) | ||
25 | { | ||
26 | nuc950_map_io(); | ||
27 | nuc950_init_clocks(); | ||
28 | } | ||
29 | |||
30 | static void __init nuc950evb_init(void) | ||
31 | { | ||
32 | nuc950_board_init(); | ||
33 | } | ||
34 | |||
35 | MACHINE_START(W90P950EVB, "W90P950EVB") | ||
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 = nuc950evb_map_io, | ||
41 | .init_irq = nuc900_init_irq, | ||
42 | .init_machine = nuc950evb_init, | ||
43 | .timer = &nuc900_timer, | ||
44 | MACHINE_END | ||
diff --git a/arch/arm/mach-w90x900/mach-nuc960evb.c b/arch/arm/mach-w90x900/mach-nuc960evb.c new file mode 100644 index 00000000000..e3a46f19f2b --- /dev/null +++ b/arch/arm/mach-w90x900/mach-nuc960evb.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/mach-nuc960evb.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 "nuc960.h" | ||
23 | |||
24 | static void __init nuc960evb_map_io(void) | ||
25 | { | ||
26 | nuc960_map_io(); | ||
27 | nuc960_init_clocks(); | ||
28 | } | ||
29 | |||
30 | static void __init nuc960evb_init(void) | ||
31 | { | ||
32 | nuc960_board_init(); | ||
33 | } | ||
34 | |||
35 | MACHINE_START(W90N960EVB, "W90N960EVB") | ||
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 = nuc960evb_map_io, | ||
41 | .init_irq = nuc900_init_irq, | ||
42 | .init_machine = nuc960evb_init, | ||
43 | .timer = &nuc900_timer, | ||
44 | MACHINE_END | ||
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c deleted file mode 100644 index 7a62bd348e8..00000000000 --- a/arch/arm/mach-w90x900/mach-w90p910evb.c +++ /dev/null | |||
@@ -1,267 +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 | #include <linux/mtd/physmap.h> | ||
24 | |||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach/map.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | #include <asm/mach-types.h> | ||
29 | |||
30 | #include <mach/regs-serial.h> | ||
31 | #include <mach/map.h> | ||
32 | |||
33 | #include "cpu.h" | ||
34 | /*w90p910 evb norflash driver data */ | ||
35 | |||
36 | #define W90P910_FLASH_BASE 0xA0000000 | ||
37 | #define W90P910_FLASH_SIZE 0x400000 | ||
38 | |||
39 | static struct mtd_partition w90p910_flash_partitions[] = { | ||
40 | { | ||
41 | .name = "NOR Partition 1 for kernel (960K)", | ||
42 | .size = 0xF0000, | ||
43 | .offset = 0x10000, | ||
44 | }, | ||
45 | { | ||
46 | .name = "NOR Partition 2 for image (1M)", | ||
47 | .size = 0x100000, | ||
48 | .offset = 0x100000, | ||
49 | }, | ||
50 | { | ||
51 | .name = "NOR Partition 3 for user (2M)", | ||
52 | .size = 0x200000, | ||
53 | .offset = 0x00200000, | ||
54 | } | ||
55 | }; | ||
56 | |||
57 | static struct physmap_flash_data w90p910_flash_data = { | ||
58 | .width = 2, | ||
59 | .parts = w90p910_flash_partitions, | ||
60 | .nr_parts = ARRAY_SIZE(w90p910_flash_partitions), | ||
61 | }; | ||
62 | |||
63 | static struct resource w90p910_flash_resources[] = { | ||
64 | { | ||
65 | .start = W90P910_FLASH_BASE, | ||
66 | .end = W90P910_FLASH_BASE + W90P910_FLASH_SIZE - 1, | ||
67 | .flags = IORESOURCE_MEM, | ||
68 | } | ||
69 | }; | ||
70 | |||
71 | static struct platform_device w90p910_flash_device = { | ||
72 | .name = "physmap-flash", | ||
73 | .id = 0, | ||
74 | .dev = { | ||
75 | .platform_data = &w90p910_flash_data, | ||
76 | }, | ||
77 | .resource = w90p910_flash_resources, | ||
78 | .num_resources = ARRAY_SIZE(w90p910_flash_resources), | ||
79 | }; | ||
80 | |||
81 | /* USB EHCI Host Controller */ | ||
82 | |||
83 | static struct resource w90x900_usb_ehci_resource[] = { | ||
84 | [0] = { | ||
85 | .start = W90X900_PA_USBEHCIHOST, | ||
86 | .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1, | ||
87 | .flags = IORESOURCE_MEM, | ||
88 | }, | ||
89 | [1] = { | ||
90 | .start = IRQ_USBH, | ||
91 | .end = IRQ_USBH, | ||
92 | .flags = IORESOURCE_IRQ, | ||
93 | } | ||
94 | }; | ||
95 | |||
96 | static u64 w90x900_device_usb_ehci_dmamask = 0xffffffffUL; | ||
97 | |||
98 | struct platform_device w90x900_device_usb_ehci = { | ||
99 | .name = "w90x900-ehci", | ||
100 | .id = -1, | ||
101 | .num_resources = ARRAY_SIZE(w90x900_usb_ehci_resource), | ||
102 | .resource = w90x900_usb_ehci_resource, | ||
103 | .dev = { | ||
104 | .dma_mask = &w90x900_device_usb_ehci_dmamask, | ||
105 | .coherent_dma_mask = 0xffffffffUL | ||
106 | } | ||
107 | }; | ||
108 | EXPORT_SYMBOL(w90x900_device_usb_ehci); | ||
109 | |||
110 | /* USB OHCI Host Controller */ | ||
111 | |||
112 | static struct resource w90x900_usb_ohci_resource[] = { | ||
113 | [0] = { | ||
114 | .start = W90X900_PA_USBOHCIHOST, | ||
115 | .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1, | ||
116 | .flags = IORESOURCE_MEM, | ||
117 | }, | ||
118 | [1] = { | ||
119 | .start = IRQ_USBH, | ||
120 | .end = IRQ_USBH, | ||
121 | .flags = IORESOURCE_IRQ, | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | static u64 w90x900_device_usb_ohci_dmamask = 0xffffffffUL; | ||
126 | struct platform_device w90x900_device_usb_ohci = { | ||
127 | .name = "w90x900-ohci", | ||
128 | .id = -1, | ||
129 | .num_resources = ARRAY_SIZE(w90x900_usb_ohci_resource), | ||
130 | .resource = w90x900_usb_ohci_resource, | ||
131 | .dev = { | ||
132 | .dma_mask = &w90x900_device_usb_ohci_dmamask, | ||
133 | .coherent_dma_mask = 0xffffffffUL | ||
134 | } | ||
135 | }; | ||
136 | EXPORT_SYMBOL(w90x900_device_usb_ohci); | ||
137 | |||
138 | /*TouchScreen controller*/ | ||
139 | |||
140 | static struct resource w90x900_ts_resource[] = { | ||
141 | [0] = { | ||
142 | .start = W90X900_PA_ADC, | ||
143 | .end = W90X900_PA_ADC + W90X900_SZ_ADC-1, | ||
144 | .flags = IORESOURCE_MEM, | ||
145 | }, | ||
146 | [1] = { | ||
147 | .start = IRQ_ADC, | ||
148 | .end = IRQ_ADC, | ||
149 | .flags = IORESOURCE_IRQ, | ||
150 | }, | ||
151 | }; | ||
152 | |||
153 | struct platform_device w90x900_device_ts = { | ||
154 | .name = "w90x900-ts", | ||
155 | .id = -1, | ||
156 | .resource = w90x900_ts_resource, | ||
157 | .num_resources = ARRAY_SIZE(w90x900_ts_resource), | ||
158 | }; | ||
159 | EXPORT_SYMBOL(w90x900_device_ts); | ||
160 | |||
161 | /* RTC controller*/ | ||
162 | |||
163 | static struct resource w90x900_rtc_resource[] = { | ||
164 | [0] = { | ||
165 | .start = W90X900_PA_RTC, | ||
166 | .end = W90X900_PA_RTC + 0xff, | ||
167 | .flags = IORESOURCE_MEM, | ||
168 | }, | ||
169 | [1] = { | ||
170 | .start = IRQ_RTC, | ||
171 | .end = IRQ_RTC, | ||
172 | .flags = IORESOURCE_IRQ, | ||
173 | }, | ||
174 | }; | ||
175 | |||
176 | struct platform_device w90x900_device_rtc = { | ||
177 | .name = "w90x900-rtc", | ||
178 | .id = -1, | ||
179 | .num_resources = ARRAY_SIZE(w90x900_rtc_resource), | ||
180 | .resource = w90x900_rtc_resource, | ||
181 | }; | ||
182 | EXPORT_SYMBOL(w90x900_device_rtc); | ||
183 | |||
184 | /* KPI controller*/ | ||
185 | |||
186 | static struct resource w90x900_kpi_resource[] = { | ||
187 | [0] = { | ||
188 | .start = W90X900_PA_KPI, | ||
189 | .end = W90X900_PA_KPI + W90X900_SZ_KPI - 1, | ||
190 | .flags = IORESOURCE_MEM, | ||
191 | }, | ||
192 | [1] = { | ||
193 | .start = IRQ_KPI, | ||
194 | .end = IRQ_KPI, | ||
195 | .flags = IORESOURCE_IRQ, | ||
196 | } | ||
197 | |||
198 | }; | ||
199 | |||
200 | struct platform_device w90x900_device_kpi = { | ||
201 | .name = "w90x900-kpi", | ||
202 | .id = -1, | ||
203 | .num_resources = ARRAY_SIZE(w90x900_kpi_resource), | ||
204 | .resource = w90x900_kpi_resource, | ||
205 | }; | ||
206 | EXPORT_SYMBOL(w90x900_device_kpi); | ||
207 | |||
208 | /* USB Device (Gadget)*/ | ||
209 | |||
210 | static struct resource w90x900_usbgadget_resource[] = { | ||
211 | [0] = { | ||
212 | .start = W90X900_PA_USBDEV, | ||
213 | .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1, | ||
214 | .flags = IORESOURCE_MEM, | ||
215 | }, | ||
216 | [1] = { | ||
217 | .start = IRQ_USBD, | ||
218 | .end = IRQ_USBD, | ||
219 | .flags = IORESOURCE_IRQ, | ||
220 | } | ||
221 | }; | ||
222 | |||
223 | struct platform_device w90x900_device_usbgadget = { | ||
224 | .name = "w90x900-usbgadget", | ||
225 | .id = -1, | ||
226 | .num_resources = ARRAY_SIZE(w90x900_usbgadget_resource), | ||
227 | .resource = w90x900_usbgadget_resource, | ||
228 | }; | ||
229 | EXPORT_SYMBOL(w90x900_device_usbgadget); | ||
230 | |||
231 | static struct map_desc w90p910_iodesc[] __initdata = { | ||
232 | }; | ||
233 | |||
234 | /*Here should be your evb resourse,such as LCD*/ | ||
235 | |||
236 | static struct platform_device *w90p910evb_dev[] __initdata = { | ||
237 | &w90p910_serial_device, | ||
238 | &w90p910_flash_device, | ||
239 | &w90x900_device_usb_ehci, | ||
240 | &w90x900_device_usb_ohci, | ||
241 | &w90x900_device_ts, | ||
242 | &w90x900_device_rtc, | ||
243 | &w90x900_device_kpi, | ||
244 | &w90x900_device_usbgadget, | ||
245 | }; | ||
246 | |||
247 | static void __init w90p910evb_map_io(void) | ||
248 | { | ||
249 | w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); | ||
250 | w90p910_init_clocks(); | ||
251 | } | ||
252 | |||
253 | static void __init w90p910evb_init(void) | ||
254 | { | ||
255 | platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev)); | ||
256 | } | ||
257 | |||
258 | MACHINE_START(W90P910EVB, "W90P910EVB") | ||
259 | /* Maintainer: Wan ZongShun */ | ||
260 | .phys_io = W90X900_PA_UART, | ||
261 | .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc, | ||
262 | .boot_params = 0, | ||
263 | .map_io = w90p910evb_map_io, | ||
264 | .init_irq = w90x900_init_irq, | ||
265 | .init_machine = w90p910evb_init, | ||
266 | .timer = &w90x900_timer, | ||
267 | MACHINE_END | ||
diff --git a/arch/arm/mach-w90x900/mfp-w90p910.c b/arch/arm/mach-w90x900/mfp-w90p910.c deleted file mode 100644 index a3520fefb5e..00000000000 --- a/arch/arm/mach-w90x900/mfp-w90p910.c +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/mfp-w90p910.c | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | |||
26 | #define REG_MFSEL (W90X900_VA_GCR + 0xC) | ||
27 | |||
28 | #define GPSELF (0x01 << 1) | ||
29 | |||
30 | #define GPSELC (0x03 << 2) | ||
31 | #define ENKPI (0x02 << 2) | ||
32 | #define ENNAND (0x01 << 2) | ||
33 | |||
34 | #define GPSELEI0 (0x01 << 26) | ||
35 | #define GPSELEI1 (0x01 << 27) | ||
36 | |||
37 | static DECLARE_MUTEX(mfp_sem); | ||
38 | |||
39 | void mfp_set_groupf(struct device *dev) | ||
40 | { | ||
41 | unsigned long mfpen; | ||
42 | const char *dev_id; | ||
43 | |||
44 | BUG_ON(!dev); | ||
45 | |||
46 | down(&mfp_sem); | ||
47 | |||
48 | dev_id = dev_name(dev); | ||
49 | |||
50 | mfpen = __raw_readl(REG_MFSEL); | ||
51 | |||
52 | if (strcmp(dev_id, "w90p910-emc") == 0) | ||
53 | mfpen |= GPSELF;/*enable mac*/ | ||
54 | else | ||
55 | mfpen &= ~GPSELF;/*GPIOF[9:0]*/ | ||
56 | |||
57 | __raw_writel(mfpen, REG_MFSEL); | ||
58 | |||
59 | up(&mfp_sem); | ||
60 | } | ||
61 | EXPORT_SYMBOL(mfp_set_groupf); | ||
62 | |||
63 | void mfp_set_groupc(struct device *dev) | ||
64 | { | ||
65 | unsigned long mfpen; | ||
66 | const char *dev_id; | ||
67 | |||
68 | BUG_ON(!dev); | ||
69 | |||
70 | down(&mfp_sem); | ||
71 | |||
72 | dev_id = dev_name(dev); | ||
73 | |||
74 | mfpen = __raw_readl(REG_MFSEL); | ||
75 | |||
76 | if (strcmp(dev_id, "w90p910-lcd") == 0) | ||
77 | mfpen |= GPSELC;/*enable lcd*/ | ||
78 | else if (strcmp(dev_id, "w90p910-kpi") == 0) { | ||
79 | mfpen &= (~GPSELC);/*enable kpi*/ | ||
80 | mfpen |= ENKPI; | ||
81 | } else if (strcmp(dev_id, "w90p910-nand") == 0) { | ||
82 | mfpen &= (~GPSELC);/*enable nand*/ | ||
83 | mfpen |= ENNAND; | ||
84 | } else | ||
85 | mfpen &= (~GPSELC);/*GPIOC[14:0]*/ | ||
86 | |||
87 | __raw_writel(mfpen, REG_MFSEL); | ||
88 | |||
89 | up(&mfp_sem); | ||
90 | } | ||
91 | EXPORT_SYMBOL(mfp_set_groupc); | ||
92 | |||
93 | void mfp_set_groupi(struct device *dev, int gpio) | ||
94 | { | ||
95 | unsigned long mfpen; | ||
96 | const char *dev_id; | ||
97 | |||
98 | BUG_ON(!dev); | ||
99 | |||
100 | down(&mfp_sem); | ||
101 | |||
102 | dev_id = dev_name(dev); | ||
103 | |||
104 | mfpen = __raw_readl(REG_MFSEL); | ||
105 | |||
106 | if (strcmp(dev_id, "w90p910-wdog") == 0) | ||
107 | mfpen |= GPSELEI1;/*enable wdog*/ | ||
108 | else if (strcmp(dev_id, "w90p910-atapi") == 0) | ||
109 | mfpen |= GPSELEI0;/*enable atapi*/ | ||
110 | |||
111 | __raw_writel(mfpen, REG_MFSEL); | ||
112 | |||
113 | up(&mfp_sem); | ||
114 | } | ||
115 | EXPORT_SYMBOL(mfp_set_groupi); | ||
116 | |||
diff --git a/arch/arm/mach-w90x900/mfp.c b/arch/arm/mach-w90x900/mfp.c new file mode 100644 index 00000000000..a47dc9a708e --- /dev/null +++ b/arch/arm/mach-w90x900/mfp.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/mfp.c | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | |||
26 | #define REG_MFSEL (W90X900_VA_GCR + 0xC) | ||
27 | |||
28 | #define GPSELF (0x01 << 1) | ||
29 | |||
30 | #define GPSELC (0x03 << 2) | ||
31 | #define ENKPI (0x02 << 2) | ||
32 | #define ENNAND (0x01 << 2) | ||
33 | |||
34 | #define GPSELEI0 (0x01 << 26) | ||
35 | #define GPSELEI1 (0x01 << 27) | ||
36 | |||
37 | #define GPIOG0TO1 (0x03 << 14) | ||
38 | #define GPIOG2TO3 (0x03 << 16) | ||
39 | #define ENSPI (0x0a << 14) | ||
40 | #define ENI2C0 (0x01 << 14) | ||
41 | #define ENI2C1 (0x01 << 16) | ||
42 | |||
43 | static DEFINE_MUTEX(mfp_mutex); | ||
44 | |||
45 | void mfp_set_groupf(struct device *dev) | ||
46 | { | ||
47 | unsigned long mfpen; | ||
48 | const char *dev_id; | ||
49 | |||
50 | BUG_ON(!dev); | ||
51 | |||
52 | mutex_lock(&mfp_mutex); | ||
53 | |||
54 | dev_id = dev_name(dev); | ||
55 | |||
56 | mfpen = __raw_readl(REG_MFSEL); | ||
57 | |||
58 | if (strcmp(dev_id, "nuc900-emc") == 0) | ||
59 | mfpen |= GPSELF;/*enable mac*/ | ||
60 | else | ||
61 | mfpen &= ~GPSELF;/*GPIOF[9:0]*/ | ||
62 | |||
63 | __raw_writel(mfpen, REG_MFSEL); | ||
64 | |||
65 | mutex_unlock(&mfp_mutex); | ||
66 | } | ||
67 | EXPORT_SYMBOL(mfp_set_groupf); | ||
68 | |||
69 | void mfp_set_groupc(struct device *dev) | ||
70 | { | ||
71 | unsigned long mfpen; | ||
72 | const char *dev_id; | ||
73 | |||
74 | BUG_ON(!dev); | ||
75 | |||
76 | mutex_lock(&mfp_mutex); | ||
77 | |||
78 | dev_id = dev_name(dev); | ||
79 | |||
80 | mfpen = __raw_readl(REG_MFSEL); | ||
81 | |||
82 | if (strcmp(dev_id, "nuc900-lcd") == 0) | ||
83 | mfpen |= GPSELC;/*enable lcd*/ | ||
84 | else if (strcmp(dev_id, "nuc900-kpi") == 0) { | ||
85 | mfpen &= (~GPSELC);/*enable kpi*/ | ||
86 | mfpen |= ENKPI; | ||
87 | } else if (strcmp(dev_id, "nuc900-nand") == 0) { | ||
88 | mfpen &= (~GPSELC);/*enable nand*/ | ||
89 | mfpen |= ENNAND; | ||
90 | } else | ||
91 | mfpen &= (~GPSELC);/*GPIOC[14:0]*/ | ||
92 | |||
93 | __raw_writel(mfpen, REG_MFSEL); | ||
94 | |||
95 | mutex_unlock(&mfp_mutex); | ||
96 | } | ||
97 | EXPORT_SYMBOL(mfp_set_groupc); | ||
98 | |||
99 | void mfp_set_groupi(struct device *dev) | ||
100 | { | ||
101 | unsigned long mfpen; | ||
102 | const char *dev_id; | ||
103 | |||
104 | BUG_ON(!dev); | ||
105 | |||
106 | mutex_lock(&mfp_mutex); | ||
107 | |||
108 | dev_id = dev_name(dev); | ||
109 | |||
110 | mfpen = __raw_readl(REG_MFSEL); | ||
111 | |||
112 | mfpen &= ~GPSELEI1;/*default gpio16*/ | ||
113 | |||
114 | if (strcmp(dev_id, "nuc900-wdog") == 0) | ||
115 | mfpen |= GPSELEI1;/*enable wdog*/ | ||
116 | else if (strcmp(dev_id, "nuc900-atapi") == 0) | ||
117 | mfpen |= GPSELEI0;/*enable atapi*/ | ||
118 | else if (strcmp(dev_id, "nuc900-keypad") == 0) | ||
119 | mfpen &= ~GPSELEI0;/*enable keypad*/ | ||
120 | |||
121 | __raw_writel(mfpen, REG_MFSEL); | ||
122 | |||
123 | mutex_unlock(&mfp_mutex); | ||
124 | } | ||
125 | EXPORT_SYMBOL(mfp_set_groupi); | ||
126 | |||
127 | void mfp_set_groupg(struct device *dev) | ||
128 | { | ||
129 | unsigned long mfpen; | ||
130 | const char *dev_id; | ||
131 | |||
132 | BUG_ON(!dev); | ||
133 | |||
134 | mutex_lock(&mfp_mutex); | ||
135 | |||
136 | dev_id = dev_name(dev); | ||
137 | |||
138 | mfpen = __raw_readl(REG_MFSEL); | ||
139 | |||
140 | if (strcmp(dev_id, "nuc900-spi") == 0) { | ||
141 | mfpen &= ~(GPIOG0TO1 | GPIOG2TO3); | ||
142 | mfpen |= ENSPI;/*enable spi*/ | ||
143 | } else if (strcmp(dev_id, "nuc900-i2c0") == 0) { | ||
144 | mfpen &= ~(GPIOG0TO1); | ||
145 | mfpen |= ENI2C0;/*enable i2c0*/ | ||
146 | } else if (strcmp(dev_id, "nuc900-i2c1") == 0) { | ||
147 | mfpen &= ~(GPIOG2TO3); | ||
148 | mfpen |= ENI2C1;/*enable i2c1*/ | ||
149 | } else { | ||
150 | mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);/*GPIOG[3:0]*/ | ||
151 | } | ||
152 | |||
153 | __raw_writel(mfpen, REG_MFSEL); | ||
154 | |||
155 | mutex_unlock(&mfp_mutex); | ||
156 | } | ||
157 | EXPORT_SYMBOL(mfp_set_groupg); | ||
158 | |||
diff --git a/arch/arm/mach-w90x900/nuc910.c b/arch/arm/mach-w90x900/nuc910.c new file mode 100644 index 00000000000..656f03b3b62 --- /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 | |||
26 | static struct platform_device *nuc910_dev[] __initdata = { | ||
27 | &nuc900_device_ts, | ||
28 | &nuc900_device_rtc, | ||
29 | }; | ||
30 | |||
31 | /* define specific CPU platform io map */ | ||
32 | |||
33 | static 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 | |||
43 | void __init nuc910_map_io(void) | ||
44 | { | ||
45 | nuc900_map_io(nuc910evb_iodesc, ARRAY_SIZE(nuc910evb_iodesc)); | ||
46 | } | ||
47 | |||
48 | /*Init NUC910 clock*/ | ||
49 | |||
50 | void __init nuc910_init_clocks(void) | ||
51 | { | ||
52 | nuc900_init_clocks(); | ||
53 | } | ||
54 | |||
55 | /*Init NUC910 board info*/ | ||
56 | |||
57 | void __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 00000000000..83e9ba5fc26 --- /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 | |||
16 | struct map_desc; | ||
17 | struct sys_timer; | ||
18 | |||
19 | /* core initialisation functions */ | ||
20 | |||
21 | extern void nuc900_init_irq(void); | ||
22 | extern struct sys_timer nuc900_timer; | ||
23 | |||
24 | /* extern file from nuc910.c */ | ||
25 | |||
26 | extern void nuc910_board_init(void); | ||
27 | extern void nuc910_init_clocks(void); | ||
28 | extern void nuc910_map_io(void); | ||
diff --git a/arch/arm/mach-w90x900/nuc950.c b/arch/arm/mach-w90x900/nuc950.c new file mode 100644 index 00000000000..149508116d1 --- /dev/null +++ b/arch/arm/mach-w90x900/nuc950.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/nuc950.c | ||
3 | * | ||
4 | * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks | ||
5 | * | ||
6 | * Copyright (c) 2008 Nuvoton technology corporation. | ||
7 | * | ||
8 | * Wan ZongShun <mcuos.com@gmail.com> | ||
9 | * | ||
10 | * NUC950 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 | |||
23 | /* define specific CPU platform device */ | ||
24 | |||
25 | static struct platform_device *nuc950_dev[] __initdata = { | ||
26 | &nuc900_device_kpi, | ||
27 | &nuc900_device_fmi, | ||
28 | }; | ||
29 | |||
30 | /* define specific CPU platform io map */ | ||
31 | |||
32 | static struct map_desc nuc950evb_iodesc[] __initdata = { | ||
33 | }; | ||
34 | |||
35 | /*Init NUC950 evb io*/ | ||
36 | |||
37 | void __init nuc950_map_io(void) | ||
38 | { | ||
39 | nuc900_map_io(nuc950evb_iodesc, ARRAY_SIZE(nuc950evb_iodesc)); | ||
40 | } | ||
41 | |||
42 | /*Init NUC950 clock*/ | ||
43 | |||
44 | void __init nuc950_init_clocks(void) | ||
45 | { | ||
46 | nuc900_init_clocks(); | ||
47 | } | ||
48 | |||
49 | /*Init NUC950 board info*/ | ||
50 | |||
51 | void __init nuc950_board_init(void) | ||
52 | { | ||
53 | nuc900_board_init(nuc950_dev, ARRAY_SIZE(nuc950_dev)); | ||
54 | } | ||
diff --git a/arch/arm/mach-w90x900/nuc950.h b/arch/arm/mach-w90x900/nuc950.h new file mode 100644 index 00000000000..98a1148bc5a --- /dev/null +++ b/arch/arm/mach-w90x900/nuc950.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/nuc950.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 | |||
16 | struct map_desc; | ||
17 | struct sys_timer; | ||
18 | |||
19 | /* core initialisation functions */ | ||
20 | |||
21 | extern void nuc900_init_irq(void); | ||
22 | extern struct sys_timer nuc900_timer; | ||
23 | |||
24 | /* extern file from nuc950.c */ | ||
25 | |||
26 | extern void nuc950_board_init(void); | ||
27 | extern void nuc950_init_clocks(void); | ||
28 | extern void nuc950_map_io(void); | ||
diff --git a/arch/arm/mach-w90x900/nuc960.c b/arch/arm/mach-w90x900/nuc960.c new file mode 100644 index 00000000000..8851a3a27ce --- /dev/null +++ b/arch/arm/mach-w90x900/nuc960.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/nuc960.c | ||
3 | * | ||
4 | * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks | ||
5 | * | ||
6 | * Copyright (c) 2008 Nuvoton technology corporation. | ||
7 | * | ||
8 | * Wan ZongShun <mcuos.com@gmail.com> | ||
9 | * | ||
10 | * NUC960 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 | |||
23 | /* define specific CPU platform device */ | ||
24 | |||
25 | static struct platform_device *nuc960_dev[] __initdata = { | ||
26 | &nuc900_device_kpi, | ||
27 | &nuc900_device_fmi, | ||
28 | }; | ||
29 | |||
30 | /* define specific CPU platform io map */ | ||
31 | |||
32 | static struct map_desc nuc960evb_iodesc[] __initdata = { | ||
33 | }; | ||
34 | |||
35 | /*Init NUC960 evb io*/ | ||
36 | |||
37 | void __init nuc960_map_io(void) | ||
38 | { | ||
39 | nuc900_map_io(nuc960evb_iodesc, ARRAY_SIZE(nuc960evb_iodesc)); | ||
40 | } | ||
41 | |||
42 | /*Init NUC960 clock*/ | ||
43 | |||
44 | void __init nuc960_init_clocks(void) | ||
45 | { | ||
46 | nuc900_init_clocks(); | ||
47 | } | ||
48 | |||
49 | /*Init NUC960 board info*/ | ||
50 | |||
51 | void __init nuc960_board_init(void) | ||
52 | { | ||
53 | nuc900_board_init(nuc960_dev, ARRAY_SIZE(nuc960_dev)); | ||
54 | } | ||
diff --git a/arch/arm/mach-w90x900/nuc960.h b/arch/arm/mach-w90x900/nuc960.h new file mode 100644 index 00000000000..f0c07cbe3a8 --- /dev/null +++ b/arch/arm/mach-w90x900/nuc960.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/nuc960.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 | |||
16 | struct map_desc; | ||
17 | struct sys_timer; | ||
18 | |||
19 | /* core initialisation functions */ | ||
20 | |||
21 | extern void nuc900_init_irq(void); | ||
22 | extern struct sys_timer nuc900_timer; | ||
23 | |||
24 | /* extern file from nuc960.c */ | ||
25 | |||
26 | extern void nuc960_board_init(void); | ||
27 | extern void nuc960_init_clocks(void); | ||
28 | extern void nuc960_map_io(void); | ||
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c index bcc838f6b39..4128af870b4 100644 --- a/arch/arm/mach-w90x900/time.c +++ b/arch/arm/mach-w90x900/time.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks | 4 | * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks |
5 | * | 5 | * |
6 | * Copyright (c) 2008 Nuvoton technology corporation | 6 | * Copyright (c) 2009 Nuvoton technology corporation |
7 | * All rights reserved. | 7 | * All rights reserved. |
8 | * | 8 | * |
9 | * Wan ZongShun <mcuos.com@gmail.com> | 9 | * Wan ZongShun <mcuos.com@gmail.com> |
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/leds.h> | 25 | #include <linux/leds.h> |
26 | #include <linux/clocksource.h> | ||
27 | #include <linux/clockchips.h> | ||
26 | 28 | ||
27 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
28 | #include <asm/mach/irq.h> | 30 | #include <asm/mach/irq.h> |
@@ -31,49 +33,150 @@ | |||
31 | #include <mach/map.h> | 33 | #include <mach/map.h> |
32 | #include <mach/regs-timer.h> | 34 | #include <mach/regs-timer.h> |
33 | 35 | ||
34 | static unsigned long w90x900_gettimeoffset(void) | 36 | #define RESETINT 0x1f |
37 | #define PERIOD (0x01 << 27) | ||
38 | #define ONESHOT (0x00 << 27) | ||
39 | #define COUNTEN (0x01 << 30) | ||
40 | #define INTEN (0x01 << 29) | ||
41 | |||
42 | #define TICKS_PER_SEC 100 | ||
43 | #define PRESCALE 0x63 /* Divider = prescale + 1 */ | ||
44 | |||
45 | unsigned int timer0_load; | ||
46 | |||
47 | static void nuc900_clockevent_setmode(enum clock_event_mode mode, | ||
48 | struct clock_event_device *clk) | ||
35 | { | 49 | { |
50 | unsigned int val; | ||
51 | |||
52 | val = __raw_readl(REG_TCSR0); | ||
53 | val &= ~(0x03 << 27); | ||
54 | |||
55 | switch (mode) { | ||
56 | case CLOCK_EVT_MODE_PERIODIC: | ||
57 | __raw_writel(timer0_load, REG_TICR0); | ||
58 | val |= (PERIOD | COUNTEN | INTEN | PRESCALE); | ||
59 | break; | ||
60 | |||
61 | case CLOCK_EVT_MODE_ONESHOT: | ||
62 | val |= (ONESHOT | COUNTEN | INTEN | PRESCALE); | ||
63 | break; | ||
64 | |||
65 | case CLOCK_EVT_MODE_UNUSED: | ||
66 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
67 | case CLOCK_EVT_MODE_RESUME: | ||
68 | break; | ||
69 | } | ||
70 | |||
71 | __raw_writel(val, REG_TCSR0); | ||
72 | } | ||
73 | |||
74 | static int nuc900_clockevent_setnextevent(unsigned long evt, | ||
75 | struct clock_event_device *clk) | ||
76 | { | ||
77 | unsigned int val; | ||
78 | |||
79 | __raw_writel(evt, REG_TICR0); | ||
80 | |||
81 | val = __raw_readl(REG_TCSR0); | ||
82 | val |= (COUNTEN | INTEN | PRESCALE); | ||
83 | __raw_writel(val, REG_TCSR0); | ||
84 | |||
36 | return 0; | 85 | return 0; |
37 | } | 86 | } |
38 | 87 | ||
88 | static struct clock_event_device nuc900_clockevent_device = { | ||
89 | .name = "nuc900-timer0", | ||
90 | .shift = 32, | ||
91 | .features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
92 | .set_mode = nuc900_clockevent_setmode, | ||
93 | .set_next_event = nuc900_clockevent_setnextevent, | ||
94 | .rating = 300, | ||
95 | }; | ||
96 | |||
39 | /*IRQ handler for the timer*/ | 97 | /*IRQ handler for the timer*/ |
40 | 98 | ||
41 | static irqreturn_t | 99 | static irqreturn_t nuc900_timer0_interrupt(int irq, void *dev_id) |
42 | w90x900_timer_interrupt(int irq, void *dev_id) | ||
43 | { | 100 | { |
44 | timer_tick(); | 101 | struct clock_event_device *evt = &nuc900_clockevent_device; |
102 | |||
45 | __raw_writel(0x01, REG_TISR); /* clear TIF0 */ | 103 | __raw_writel(0x01, REG_TISR); /* clear TIF0 */ |
104 | |||
105 | evt->event_handler(evt); | ||
46 | return IRQ_HANDLED; | 106 | return IRQ_HANDLED; |
47 | } | 107 | } |
48 | 108 | ||
49 | static struct irqaction w90x900_timer_irq = { | 109 | static struct irqaction nuc900_timer0_irq = { |
50 | .name = "w90x900 Timer Tick", | 110 | .name = "nuc900-timer0", |
51 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 111 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
52 | .handler = w90x900_timer_interrupt, | 112 | .handler = nuc900_timer0_interrupt, |
53 | }; | 113 | }; |
54 | 114 | ||
55 | /*Set up timer reg.*/ | 115 | static void __init nuc900_clockevents_init(unsigned int rate) |
116 | { | ||
117 | nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC, | ||
118 | nuc900_clockevent_device.shift); | ||
119 | nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff, | ||
120 | &nuc900_clockevent_device); | ||
121 | nuc900_clockevent_device.min_delta_ns = clockevent_delta2ns(0xf, | ||
122 | &nuc900_clockevent_device); | ||
123 | nuc900_clockevent_device.cpumask = cpumask_of(0); | ||
56 | 124 | ||
57 | static void w90x900_timer_setup(void) | 125 | clockevents_register_device(&nuc900_clockevent_device); |
126 | } | ||
127 | |||
128 | static cycle_t nuc900_get_cycles(struct clocksource *cs) | ||
58 | { | 129 | { |
59 | __raw_writel(0, REG_TCSR0); | 130 | return ~__raw_readl(REG_TDR1); |
60 | __raw_writel(0, REG_TCSR1); | ||
61 | __raw_writel(0, REG_TCSR2); | ||
62 | __raw_writel(0, REG_TCSR3); | ||
63 | __raw_writel(0, REG_TCSR4); | ||
64 | __raw_writel(0x1F, REG_TISR); | ||
65 | __raw_writel(15000000/(100 * 100), REG_TICR0); | ||
66 | __raw_writel(0x68000063, REG_TCSR0); | ||
67 | } | 131 | } |
68 | 132 | ||
69 | static void __init w90x900_timer_init(void) | 133 | static struct clocksource clocksource_nuc900 = { |
134 | .name = "nuc900-timer1", | ||
135 | .rating = 200, | ||
136 | .read = nuc900_get_cycles, | ||
137 | .mask = CLOCKSOURCE_MASK(32), | ||
138 | .shift = 20, | ||
139 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
140 | }; | ||
141 | |||
142 | static void __init nuc900_clocksource_init(unsigned int rate) | ||
70 | { | 143 | { |
71 | w90x900_timer_setup(); | 144 | unsigned int val; |
72 | setup_irq(IRQ_TIMER0, &w90x900_timer_irq); | 145 | |
146 | __raw_writel(0xffffffff, REG_TICR1); | ||
147 | |||
148 | val = __raw_readl(REG_TCSR1); | ||
149 | val |= (COUNTEN | PERIOD); | ||
150 | __raw_writel(val, REG_TCSR1); | ||
151 | |||
152 | clocksource_nuc900.mult = | ||
153 | clocksource_khz2mult((rate / 1000), clocksource_nuc900.shift); | ||
154 | clocksource_register(&clocksource_nuc900); | ||
155 | } | ||
156 | |||
157 | static void __init nuc900_timer_init(void) | ||
158 | { | ||
159 | struct clk *ck_ext = clk_get(NULL, "ext"); | ||
160 | unsigned int rate; | ||
161 | |||
162 | BUG_ON(IS_ERR(ck_ext)); | ||
163 | |||
164 | rate = clk_get_rate(ck_ext); | ||
165 | clk_put(ck_ext); | ||
166 | rate = rate / (PRESCALE + 0x01); | ||
167 | |||
168 | /* set a known state */ | ||
169 | __raw_writel(0x00, REG_TCSR0); | ||
170 | __raw_writel(0x00, REG_TCSR1); | ||
171 | __raw_writel(RESETINT, REG_TISR); | ||
172 | timer0_load = (rate / TICKS_PER_SEC); | ||
173 | |||
174 | setup_irq(IRQ_TIMER0, &nuc900_timer0_irq); | ||
175 | |||
176 | nuc900_clocksource_init(rate); | ||
177 | nuc900_clockevents_init(rate); | ||
73 | } | 178 | } |
74 | 179 | ||
75 | struct sys_timer w90x900_timer = { | 180 | struct sys_timer nuc900_timer = { |
76 | .init = w90x900_timer_init, | 181 | .init = nuc900_timer_init, |
77 | .offset = w90x900_gettimeoffset, | ||
78 | .resume = w90x900_timer_setup | ||
79 | }; | 182 | }; |
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c deleted file mode 100644 index 1c97e4930b7..00000000000 --- a/arch/arm/mach-w90x900/w90p910.c +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/w90p910.c | ||
3 | * | ||
4 | * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks | ||
5 | * | ||
6 | * Copyright (c) 2008 Nuvoton technology corporation. | ||
7 | * | ||
8 | * Wan ZongShun <mcuos.com@gmail.com> | ||
9 | * | ||
10 | * W90P910 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/kernel.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/timer.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/serial_8250.h> | ||
27 | |||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/map.h> | ||
30 | #include <asm/mach/irq.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <mach/hardware.h> | ||
34 | #include <mach/regs-serial.h> | ||
35 | |||
36 | #include "cpu.h" | ||
37 | #include "clock.h" | ||
38 | |||
39 | /* Initial IO mappings */ | ||
40 | |||
41 | static struct map_desc w90p910_iodesc[] __initdata = { | ||
42 | IODESC_ENT(IRQ), | ||
43 | IODESC_ENT(GCR), | ||
44 | IODESC_ENT(UART), | ||
45 | IODESC_ENT(TIMER), | ||
46 | IODESC_ENT(EBI), | ||
47 | IODESC_ENT(USBEHCIHOST), | ||
48 | IODESC_ENT(USBOHCIHOST), | ||
49 | IODESC_ENT(ADC), | ||
50 | IODESC_ENT(RTC), | ||
51 | IODESC_ENT(KPI), | ||
52 | IODESC_ENT(USBDEV), | ||
53 | /*IODESC_ENT(LCD),*/ | ||
54 | }; | ||
55 | |||
56 | /* Initial clock declarations. */ | ||
57 | static DEFINE_CLK(lcd, 0); | ||
58 | static DEFINE_CLK(audio, 1); | ||
59 | static DEFINE_CLK(fmi, 4); | ||
60 | static DEFINE_CLK(dmac, 5); | ||
61 | static DEFINE_CLK(atapi, 6); | ||
62 | static DEFINE_CLK(emc, 7); | ||
63 | static DEFINE_CLK(usbd, 8); | ||
64 | static DEFINE_CLK(usbh, 9); | ||
65 | static DEFINE_CLK(g2d, 10);; | ||
66 | static DEFINE_CLK(pwm, 18); | ||
67 | static DEFINE_CLK(ps2, 24); | ||
68 | static DEFINE_CLK(kpi, 25); | ||
69 | static DEFINE_CLK(wdt, 26); | ||
70 | static DEFINE_CLK(gdma, 27); | ||
71 | static DEFINE_CLK(adc, 28); | ||
72 | static DEFINE_CLK(usi, 29); | ||
73 | |||
74 | static struct clk_lookup w90p910_clkregs[] = { | ||
75 | DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), | ||
76 | DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), | ||
77 | DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), | ||
78 | DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), | ||
79 | DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), | ||
80 | DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), | ||
81 | DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), | ||
82 | DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), | ||
83 | DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), | ||
84 | DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL), | ||
85 | DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL), | ||
86 | DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL), | ||
87 | DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL), | ||
88 | DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL), | ||
89 | DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL), | ||
90 | DEF_CLKLOOK(&clk_usi, "w90p910-usi", NULL), | ||
91 | }; | ||
92 | |||
93 | /* Initial serial platform data */ | ||
94 | |||
95 | struct plat_serial8250_port w90p910_uart_data[] = { | ||
96 | W90X900_8250PORT(UART0), | ||
97 | }; | ||
98 | |||
99 | struct platform_device w90p910_serial_device = { | ||
100 | .name = "serial8250", | ||
101 | .id = PLAT8250_DEV_PLATFORM, | ||
102 | .dev = { | ||
103 | .platform_data = w90p910_uart_data, | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | /*Init W90P910 evb io*/ | ||
108 | |||
109 | void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size) | ||
110 | { | ||
111 | unsigned long idcode = 0x0; | ||
112 | |||
113 | iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); | ||
114 | |||
115 | idcode = __raw_readl(W90X900PDID); | ||
116 | if (idcode != W90P910_CPUID) | ||
117 | printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode); | ||
118 | } | ||
119 | |||
120 | /*Init W90P910 clock*/ | ||
121 | |||
122 | void __init w90p910_init_clocks(void) | ||
123 | { | ||
124 | clks_register(w90p910_clkregs, ARRAY_SIZE(w90p910_clkregs)); | ||
125 | } | ||
126 | |||
127 | static int __init w90p910_init_cpu(void) | ||
128 | { | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static int __init w90x900_arch_init(void) | ||
133 | { | ||
134 | return w90p910_init_cpu(); | ||
135 | } | ||
136 | arch_initcall(w90x900_arch_init); | ||