diff options
author | wanzongshun <mcuos.com@gmail.com> | 2008-12-02 21:55:38 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-12-03 16:57:16 -0500 |
commit | 7ec80ddf0455ff3854a5ca524952d91b5eb676b2 (patch) | |
tree | be9c2a70b771a9d94844b7f37e63471e7bbaff6a /arch | |
parent | c5b84b3bb0c055d70dc9f1b5e900378bc9d059ea (diff) |
[ARM] 5338/1: Add Nuvoton W90P910 Platform support
Add Nuvoton W90X900 ARM9 plat support to linux arm tree,
Now, this patch include only W90P910 EVB of W90P910 CPU,
Its driver is nothing.
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
23 files changed, 986 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 93c5bebcd10f..4546f8b2ce8c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -572,6 +572,13 @@ config ARCH_MSM | |||
572 | interface to the ARM9 modem processor which runs the baseband stack | 572 | interface to the ARM9 modem processor which runs the baseband stack |
573 | and controls some vital subsystems (clock and power control, etc). | 573 | and controls some vital subsystems (clock and power control, etc). |
574 | 574 | ||
575 | config ARCH_W90X900 | ||
576 | bool "Nuvoton W90X900 CPU" | ||
577 | select CPU_ARM926T | ||
578 | help | ||
579 | Support for Nuvoton (Winbond logic dept.) ARM9 processor,You | ||
580 | can login www.mcuos.com or www.nuvoton.com to know more. | ||
581 | |||
575 | endchoice | 582 | endchoice |
576 | 583 | ||
577 | source "arch/arm/mach-clps711x/Kconfig" | 584 | source "arch/arm/mach-clps711x/Kconfig" |
@@ -650,6 +657,8 @@ source "arch/arm/mach-ks8695/Kconfig" | |||
650 | 657 | ||
651 | source "arch/arm/mach-msm/Kconfig" | 658 | source "arch/arm/mach-msm/Kconfig" |
652 | 659 | ||
660 | source "arch/arm/mach-w90x900/Kconfig" | ||
661 | |||
653 | # Definitions to make life easier | 662 | # Definitions to make life easier |
654 | config ARCH_ACORN | 663 | config ARCH_ACORN |
655 | bool | 664 | bool |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 2eca2998f93e..69d3038b35e3 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -143,6 +143,7 @@ endif | |||
143 | machine-$(CONFIG_ARCH_MSM) := msm | 143 | machine-$(CONFIG_ARCH_MSM) := msm |
144 | machine-$(CONFIG_ARCH_LOKI) := loki | 144 | machine-$(CONFIG_ARCH_LOKI) := loki |
145 | machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0 | 145 | machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0 |
146 | machine-$(CONFIG_ARCH_W90X900) := w90x900 | ||
146 | 147 | ||
147 | ifeq ($(CONFIG_ARCH_EBSA110),y) | 148 | ifeq ($(CONFIG_ARCH_EBSA110),y) |
148 | # This is what happens if you forget the IOCS16 line. | 149 | # This is what happens if you forget the IOCS16 line. |
diff --git a/arch/arm/mach-w90x900/Kconfig b/arch/arm/mach-w90x900/Kconfig new file mode 100644 index 000000000000..8e4178fe5ec2 --- /dev/null +++ b/arch/arm/mach-w90x900/Kconfig | |||
@@ -0,0 +1,19 @@ | |||
1 | if ARCH_W90X900 | ||
2 | |||
3 | config CPU_W90P910 | ||
4 | bool | ||
5 | help | ||
6 | Support for W90P910 of Nuvoton W90X900 CPUs. | ||
7 | |||
8 | menu "W90P910 Machines" | ||
9 | |||
10 | config MACH_W90P910EVB | ||
11 | bool "Nuvoton W90P910 Evaluation Board" | ||
12 | default y | ||
13 | select CPU_W90P910 | ||
14 | help | ||
15 | Say Y here if you are using the Nuvoton W90P910EVB | ||
16 | |||
17 | endmenu | ||
18 | |||
19 | endif | ||
diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile new file mode 100644 index 000000000000..0c0c1d63f1c7 --- /dev/null +++ b/arch/arm/mach-w90x900/Makefile | |||
@@ -0,0 +1,15 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | # Object file lists. | ||
6 | |||
7 | obj-y := irq.o time.o | ||
8 | |||
9 | # W90X900 CPU support files | ||
10 | |||
11 | obj-$(CONFIG_CPU_W90P910) += w90p910.o | ||
12 | |||
13 | # machine support | ||
14 | |||
15 | obj-$(CONFIG_MACH_W90P910EVB) += mach-w90p910evb.o | ||
diff --git a/arch/arm/mach-w90x900/Makefile.boot b/arch/arm/mach-w90x900/Makefile.boot new file mode 100644 index 000000000000..a057b546b6e5 --- /dev/null +++ b/arch/arm/mach-w90x900/Makefile.boot | |||
@@ -0,0 +1,3 @@ | |||
1 | zreladdr-y := 0x00008000 | ||
2 | params_phys-y := 0x00000100 | ||
3 | |||
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h new file mode 100644 index 000000000000..40ff40845df0 --- /dev/null +++ b/arch/arm/mach-w90x900/cpu.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/cpu.h | ||
3 | * | ||
4 | * Based on linux/include/asm-arm/plat-s3c24xx/cpu.h by Ben Dooks | ||
5 | * | ||
6 | * Copyright (c) 2008 Nuvoton technology corporation | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * Header file for W90X900 CPU support | ||
10 | * | ||
11 | * Wan ZongShun <mcuos.com@gmail.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #define IODESC_ENT(y) \ | ||
20 | { \ | ||
21 | .virtual = (unsigned long)W90X900_VA_##y, \ | ||
22 | .pfn = __phys_to_pfn(W90X900_PA_##y), \ | ||
23 | .length = W90X900_SZ_##y, \ | ||
24 | .type = MT_DEVICE, \ | ||
25 | } | ||
26 | |||
27 | /*Cpu identifier register*/ | ||
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(int xtal); | ||
45 | extern void w90p910_map_io(struct map_desc *mach_desc, int size); | ||
46 | extern struct sys_timer w90x900_timer; | ||
47 | |||
48 | #define W90X900_RES(name) \ | ||
49 | struct resource w90x900_##name##_resource[] = { \ | ||
50 | [0] = { \ | ||
51 | .start = name##_PA, \ | ||
52 | .end = name##_PA + 0x0ff, \ | ||
53 | .flags = IORESOURCE_MEM, \ | ||
54 | }, \ | ||
55 | [1] = { \ | ||
56 | .start = IRQ_##name, \ | ||
57 | .end = IRQ_##name, \ | ||
58 | .flags = IORESOURCE_IRQ, \ | ||
59 | } \ | ||
60 | } | ||
61 | |||
62 | #define W90X900_DEVICE(devname, regname, devid, platdevname) \ | ||
63 | struct platform_device w90x900_##devname = { \ | ||
64 | .name = platdevname, \ | ||
65 | .id = devid, \ | ||
66 | .num_resources = ARRAY_SIZE(w90x900_##regname##_resource), \ | ||
67 | .resource = w90x900_##regname##_resource, \ | ||
68 | } | ||
69 | |||
70 | #define W90X900_UARTCFG(port, flag, uc, ulc, ufc) \ | ||
71 | { \ | ||
72 | .hwport = port, \ | ||
73 | .flags = flag, \ | ||
74 | .ucon = uc, \ | ||
75 | .ulcon = ulc, \ | ||
76 | .ufcon = ufc, \ | ||
77 | } | ||
diff --git a/arch/arm/mach-w90x900/include/mach/entry-macro.S b/arch/arm/mach-w90x900/include/mach/entry-macro.S new file mode 100644 index 000000000000..d39aca5be9ee --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/entry-macro.S | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/entry-macro.S | ||
3 | * | ||
4 | * Low-level IRQ helper macros for W90P910-based platforms | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <mach/hardware.h> | ||
13 | #include <mach/regs-irq.h> | ||
14 | |||
15 | .macro get_irqnr_preamble, base, tmp | ||
16 | .endm | ||
17 | |||
18 | .macro arch_ret_to_user, tmp1, tmp2 | ||
19 | .endm | ||
20 | |||
21 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
22 | |||
23 | mov \base, #AIC_BA | ||
24 | |||
25 | ldr \irqnr, [ \base, #AIC_IPER] | ||
26 | ldr \irqnr, [ \base, #AIC_ISNR] | ||
27 | cmp \irqnr, #0 | ||
28 | |||
29 | .endm | ||
30 | |||
31 | /* currently don't need an disable_fiq macro */ | ||
32 | |||
33 | .macro disable_fiq | ||
34 | .endm | ||
diff --git a/arch/arm/mach-w90x900/include/mach/hardware.h b/arch/arm/mach-w90x900/include/mach/hardware.h new file mode 100644 index 000000000000..fe3c6265a466 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/hardware.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/hardware.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/hardware.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_HARDWARE_H | ||
19 | #define __ASM_ARCH_HARDWARE_H | ||
20 | |||
21 | #include <asm/sizes.h> | ||
22 | #include <mach/map.h> | ||
23 | |||
24 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/io.h b/arch/arm/mach-w90x900/include/mach/io.h new file mode 100644 index 000000000000..d96ab99df05b --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/io.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/io.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARM_ARCH_IO_H | ||
19 | #define __ASM_ARM_ARCH_IO_H | ||
20 | |||
21 | #define IO_SPACE_LIMIT 0xffffffff | ||
22 | |||
23 | /* | ||
24 | * 1:1 mapping for ioremapped regions. | ||
25 | */ | ||
26 | |||
27 | #define __mem_pci(a) (a) | ||
28 | #define __io(a) __typesafe_io(a) | ||
29 | |||
30 | #endif | ||
diff --git a/arch/arm/mach-w90x900/include/mach/irqs.h b/arch/arm/mach-w90x900/include/mach/irqs.h new file mode 100644 index 000000000000..1c583f9cbcde --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/irqs.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/irqs.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/irqs.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_IRQS_H | ||
19 | #define __ASM_ARCH_IRQS_H | ||
20 | |||
21 | /* | ||
22 | * we keep the first set of CPU IRQs out of the range of | ||
23 | * the ISA space, so that the PC104 has them to itself | ||
24 | * and we don't end up having to do horrible things to the | ||
25 | * standard ISA drivers.... | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #define W90X900_IRQ(x) (x) | ||
30 | |||
31 | /* Main cpu interrupts */ | ||
32 | |||
33 | #define IRQ_WDT W90X900_IRQ(1) | ||
34 | #define IRQ_UART0 W90X900_IRQ(7) | ||
35 | #define IRQ_UART1 W90X900_IRQ(8) | ||
36 | #define IRQ_UART2 W90X900_IRQ(9) | ||
37 | #define IRQ_UART3 W90X900_IRQ(10) | ||
38 | #define IRQ_UART4 W90X900_IRQ(11) | ||
39 | #define IRQ_TIMER0 W90X900_IRQ(12) | ||
40 | #define IRQ_TIMER1 W90X900_IRQ(13) | ||
41 | #define IRQ_T_INT_GROUP W90X900_IRQ(14) | ||
42 | #define IRQ_ADC W90X900_IRQ(31) | ||
43 | #define NR_IRQS (IRQ_ADC+1) | ||
44 | |||
45 | #endif /* __ASM_ARCH_IRQ_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/map.h b/arch/arm/mach-w90x900/include/mach/map.h new file mode 100644 index 000000000000..79320ebe614b --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/map.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/map.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/map.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_MAP_H | ||
19 | #define __ASM_ARCH_MAP_H | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | #define W90X900_ADDR(x) ((void __iomem *)(0xF0000000 + (x))) | ||
23 | #else | ||
24 | #define W90X900_ADDR(x) (0xF0000000 + (x)) | ||
25 | #endif | ||
26 | |||
27 | #define AHB_IO_BASE 0xB0000000 | ||
28 | #define APB_IO_BASE 0xB8000000 | ||
29 | #define CLOCKPW_BASE (APB_IO_BASE+0x200) | ||
30 | #define AIC_IO_BASE (APB_IO_BASE+0x2000) | ||
31 | #define TIMER_IO_BASE (APB_IO_BASE+0x1000) | ||
32 | |||
33 | /* | ||
34 | * interrupt controller is the first thing we put in, to make | ||
35 | * the assembly code for the irq detection easier | ||
36 | */ | ||
37 | |||
38 | #define W90X900_VA_IRQ W90X900_ADDR(0x00000000) | ||
39 | #define W90X900_PA_IRQ (0xB8002000) | ||
40 | #define W90X900_SZ_IRQ SZ_4K | ||
41 | |||
42 | #define W90X900_VA_GCR W90X900_ADDR(0x08002000) | ||
43 | #define W90X900_PA_GCR (0xB0000000) | ||
44 | #define W90X900_SZ_GCR SZ_4K | ||
45 | |||
46 | /* Clock and Power management */ | ||
47 | |||
48 | #define W90X900_VA_CLKPWR (W90X900_VA_GCR+0x200) | ||
49 | #define W90X900_PA_CLKPWR (0xB0000200) | ||
50 | #define W90X900_SZ_CLKPWR SZ_4K | ||
51 | |||
52 | /* EBI management */ | ||
53 | |||
54 | #define W90X900_VA_EBI W90X900_ADDR(0x00001000) | ||
55 | #define W90X900_PA_EBI (0xB0001000) | ||
56 | #define W90X900_SZ_EBI SZ_4K | ||
57 | |||
58 | /* UARTs */ | ||
59 | |||
60 | #define W90X900_VA_UART W90X900_ADDR(0x08000000) | ||
61 | #define W90X900_PA_UART (0xB8000000) | ||
62 | #define W90X900_SZ_UART SZ_4K | ||
63 | |||
64 | /* Timers */ | ||
65 | |||
66 | #define W90X900_VA_TIMER W90X900_ADDR(0x08001000) | ||
67 | #define W90X900_PA_TIMER (0xB8001000) | ||
68 | #define W90X900_SZ_TIMER SZ_4K | ||
69 | |||
70 | /* GPIO ports */ | ||
71 | |||
72 | #define W90X900_VA_GPIO W90X900_ADDR(0x08003000) | ||
73 | #define W90X900_PA_GPIO (0xB8003000) | ||
74 | #define W90X900_SZ_GPIO SZ_4K | ||
75 | |||
76 | #endif /* __ASM_ARCH_MAP_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/memory.h b/arch/arm/mach-w90x900/include/mach/memory.h new file mode 100644 index 000000000000..971b80702c27 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/memory.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/memory.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/memory.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_MEMORY_H | ||
19 | #define __ASM_ARCH_MEMORY_H | ||
20 | |||
21 | #define PHYS_OFFSET UL(0x00000000) | ||
22 | |||
23 | #endif | ||
diff --git a/arch/arm/mach-w90x900/include/mach/regs-irq.h b/arch/arm/mach-w90x900/include/mach/regs-irq.h new file mode 100644 index 000000000000..8a3185fbc9cf --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-irq.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-irq.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/regs-irq.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef ___ASM_ARCH_REGS_IRQ_H | ||
19 | #define ___ASM_ARCH_REGS_IRQ_H | ||
20 | |||
21 | /* Advance Interrupt Controller (AIC) Registers */ | ||
22 | |||
23 | #define AIC_BA W90X900_VA_IRQ | ||
24 | |||
25 | #define REG_AIC_IRQSC (AIC_BA+0x80) | ||
26 | #define REG_AIC_GEN (AIC_BA+0x84) | ||
27 | #define REG_AIC_GASR (AIC_BA+0x88) | ||
28 | #define REG_AIC_GSCR (AIC_BA+0x8C) | ||
29 | #define REG_AIC_IRSR (AIC_BA+0x100) | ||
30 | #define REG_AIC_IASR (AIC_BA+0x104) | ||
31 | #define REG_AIC_ISR (AIC_BA+0x108) | ||
32 | #define REG_AIC_IPER (AIC_BA+0x10C) | ||
33 | #define REG_AIC_ISNR (AIC_BA+0x110) | ||
34 | #define REG_AIC_IMR (AIC_BA+0x114) | ||
35 | #define REG_AIC_OISR (AIC_BA+0x118) | ||
36 | #define REG_AIC_MECR (AIC_BA+0x120) | ||
37 | #define REG_AIC_MDCR (AIC_BA+0x124) | ||
38 | #define REG_AIC_SSCR (AIC_BA+0x128) | ||
39 | #define REG_AIC_SCCR (AIC_BA+0x12C) | ||
40 | #define REG_AIC_EOSCR (AIC_BA+0x130) | ||
41 | #define AIC_IPER (0x10C) | ||
42 | #define AIC_ISNR (0x110) | ||
43 | |||
44 | /*16-18 bits of REG_AIC_GEN define irq(2-4) group*/ | ||
45 | |||
46 | #define TIMER2_IRQ (1 << 16) | ||
47 | #define TIMER3_IRQ (1 << 17) | ||
48 | #define TIMER4_IRQ (1 << 18) | ||
49 | #define TIME_GROUP_IRQ (TIMER2_IRQ|TIMER3_IRQ|TIMER4_IRQ) | ||
50 | |||
51 | #endif /* ___ASM_ARCH_REGS_IRQ_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/regs-serial.h b/arch/arm/mach-w90x900/include/mach/regs-serial.h new file mode 100644 index 000000000000..f08fa0d75e11 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-serial.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-serial.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/regs-serial.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARM_REGS_SERIAL_H | ||
19 | #define __ASM_ARM_REGS_SERIAL_H | ||
20 | |||
21 | #define UART0_BA W90X900_VA_UART | ||
22 | #define UART1_BA (W90X900_VA_UART+0x100) | ||
23 | #define UART2_BA (W90X900_VA_UART+0x200) | ||
24 | #define UART3_BA (W90X900_VA_UART+0x300) | ||
25 | #define UART4_BA (W90X900_VA_UART+0x400) | ||
26 | |||
27 | #define UART0_PA W90X900_PA_UART | ||
28 | #define UART1_PA (W90X900_PA_UART+0x100) | ||
29 | #define UART2_PA (W90X900_PA_UART+0x200) | ||
30 | #define UART3_PA (W90X900_PA_UART+0x300) | ||
31 | #define UART4_PA (W90X900_PA_UART+0x400) | ||
32 | |||
33 | #ifndef __ASSEMBLY__ | ||
34 | |||
35 | struct w90x900_uart_clksrc { | ||
36 | const char *name; | ||
37 | unsigned int divisor; | ||
38 | unsigned int min_baud; | ||
39 | unsigned int max_baud; | ||
40 | }; | ||
41 | |||
42 | struct w90x900_uartcfg { | ||
43 | unsigned char hwport; | ||
44 | unsigned char unused; | ||
45 | unsigned short flags; | ||
46 | unsigned long uart_flags; | ||
47 | |||
48 | unsigned long ucon; | ||
49 | unsigned long ulcon; | ||
50 | unsigned long ufcon; | ||
51 | |||
52 | struct w90x900_uart_clksrc *clocks; | ||
53 | unsigned int clocks_size; | ||
54 | }; | ||
55 | |||
56 | #endif /* __ASSEMBLY__ */ | ||
57 | |||
58 | #endif /* __ASM_ARM_REGS_SERIAL_H */ | ||
59 | |||
diff --git a/arch/arm/mach-w90x900/include/mach/regs-timer.h b/arch/arm/mach-w90x900/include/mach/regs-timer.h new file mode 100644 index 000000000000..8f390620c0e4 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-timer.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-timer.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/regs-timer.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_REGS_TIMER_H | ||
19 | #define __ASM_ARCH_REGS_TIMER_H | ||
20 | |||
21 | /* Timer Registers */ | ||
22 | |||
23 | #define TMR_BA W90X900_VA_TIMER | ||
24 | #define REG_TCSR0 (TMR_BA+0x00) | ||
25 | #define REG_TCSR1 (TMR_BA+0x04) | ||
26 | #define REG_TICR0 (TMR_BA+0x08) | ||
27 | #define REG_TICR1 (TMR_BA+0x0C) | ||
28 | #define REG_TDR0 (TMR_BA+0x10) | ||
29 | #define REG_TDR1 (TMR_BA+0x14) | ||
30 | #define REG_TISR (TMR_BA+0x18) | ||
31 | #define REG_WTCR (TMR_BA+0x1C) | ||
32 | #define REG_TCSR2 (TMR_BA+0x20) | ||
33 | #define REG_TCSR3 (TMR_BA+0x24) | ||
34 | #define REG_TICR2 (TMR_BA+0x28) | ||
35 | #define REG_TICR3 (TMR_BA+0x2C) | ||
36 | #define REG_TDR2 (TMR_BA+0x30) | ||
37 | #define REG_TDR3 (TMR_BA+0x34) | ||
38 | #define REG_TCSR4 (TMR_BA+0x40) | ||
39 | #define REG_TICR4 (TMR_BA+0x48) | ||
40 | #define REG_TDR4 (TMR_BA+0x50) | ||
41 | |||
42 | #endif /* __ASM_ARCH_REGS_TIMER_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h new file mode 100644 index 000000000000..93753f922618 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/system.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/system.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/system.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <asm/proc-fns.h> | ||
19 | |||
20 | static void arch_idle(void) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | static void arch_reset(char mode) | ||
25 | { | ||
26 | cpu_reset(0); | ||
27 | } | ||
28 | |||
diff --git a/arch/arm/mach-w90x900/include/mach/timex.h b/arch/arm/mach-w90x900/include/mach/timex.h new file mode 100644 index 000000000000..164dce0b64db --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/timex.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/timex.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/timex.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_TIMEX_H | ||
19 | #define __ASM_ARCH_TIMEX_H | ||
20 | |||
21 | /* CLOCK_TICK_RATE Now, I don't use it. */ | ||
22 | |||
23 | #define CLOCK_TICK_RATE 15000000 | ||
24 | |||
25 | #endif /* __ASM_ARCH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/uncompress.h b/arch/arm/mach-w90x900/include/mach/uncompress.h new file mode 100644 index 000000000000..050d9fe5ae1b --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/uncompress.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/uncompress.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/uncompress.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_UNCOMPRESS_H | ||
19 | #define __ASM_ARCH_UNCOMPRESS_H | ||
20 | |||
21 | /* Defines for UART registers */ | ||
22 | |||
23 | #include <mach/regs-serial.h> | ||
24 | #include <mach/map.h> | ||
25 | |||
26 | #define arch_decomp_wdog() | ||
27 | |||
28 | static void putc(int ch) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | static inline void flush(void) | ||
33 | { | ||
34 | } | ||
35 | |||
36 | static void arch_decomp_setup(void) | ||
37 | { | ||
38 | } | ||
39 | |||
40 | #endif/* __ASM_W90X900_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/vmalloc.h b/arch/arm/mach-w90x900/include/mach/vmalloc.h new file mode 100644 index 000000000000..2f9dfb928533 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/vmalloc.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/vmalloc.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/vmalloc.h | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_VMALLOC_H | ||
19 | #define __ASM_ARCH_VMALLOC_H | ||
20 | |||
21 | #define VMALLOC_END (0xE0000000) | ||
22 | |||
23 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c new file mode 100644 index 000000000000..0b4fc194729c --- /dev/null +++ b/arch/arm/mach-w90x900/irq.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/irq.c | ||
3 | * | ||
4 | * based on linux/arch/arm/plat-s3c24xx/irq.c by Ben Dooks | ||
5 | * | ||
6 | * Copyright (c) 2008 Nuvoton technology corporation | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * Wan ZongShun <mcuos.com@gmail.com> | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/init.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/ioport.h> | ||
22 | #include <linux/ptrace.h> | ||
23 | #include <linux/sysdev.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <asm/irq.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/regs-irq.h> | ||
31 | |||
32 | static void w90x900_irq_mask(unsigned int irq) | ||
33 | { | ||
34 | __raw_writel(1 << irq, REG_AIC_MDCR); | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * By the w90p910 spec,any irq,only write 1 | ||
39 | * to REG_AIC_EOSCR for ACK | ||
40 | */ | ||
41 | |||
42 | static void w90x900_irq_ack(unsigned int irq) | ||
43 | { | ||
44 | __raw_writel(0x01, REG_AIC_EOSCR); | ||
45 | } | ||
46 | |||
47 | static void w90x900_irq_unmask(unsigned int irq) | ||
48 | { | ||
49 | unsigned long mask; | ||
50 | |||
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); | ||
57 | } | ||
58 | |||
59 | static struct irq_chip w90x900_irq_chip = { | ||
60 | .ack = w90x900_irq_ack, | ||
61 | .mask = w90x900_irq_mask, | ||
62 | .unmask = w90x900_irq_unmask, | ||
63 | }; | ||
64 | |||
65 | void __init w90x900_init_irq(void) | ||
66 | { | ||
67 | int irqno; | ||
68 | |||
69 | __raw_writel(0xFFFFFFFE, REG_AIC_MDCR); | ||
70 | |||
71 | for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) { | ||
72 | set_irq_chip(irqno, &w90x900_irq_chip); | ||
73 | set_irq_handler(irqno, handle_level_irq); | ||
74 | set_irq_flags(irqno, IRQF_VALID); | ||
75 | } | ||
76 | } | ||
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c new file mode 100644 index 000000000000..9307a2475438 --- /dev/null +++ b/arch/arm/mach-w90x900/mach-w90p910evb.c | |||
@@ -0,0 +1,72 @@ | |||
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 | * All rights reserved. | ||
8 | * | ||
9 | * Wan ZongShun <mcuos.com@gmail.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License as | ||
13 | * published by the Free Software Foundation; either version 2 of | ||
14 | * the License, or (at your option) any later version. | ||
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 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | #include <asm/mach-types.h> | ||
30 | |||
31 | #include <mach/regs-serial.h> | ||
32 | |||
33 | #include "cpu.h" | ||
34 | |||
35 | static struct map_desc w90p910_iodesc[] __initdata = { | ||
36 | }; | ||
37 | |||
38 | static struct w90x900_uartcfg w90p910_uartcfgs[] = { | ||
39 | W90X900_UARTCFG(0, 0, 0, 0, 0), | ||
40 | W90X900_UARTCFG(1, 0, 0, 0, 0), | ||
41 | W90X900_UARTCFG(2, 0, 0, 0, 0), | ||
42 | W90X900_UARTCFG(3, 0, 0, 0, 0), | ||
43 | W90X900_UARTCFG(4, 0, 0, 0, 0), | ||
44 | }; | ||
45 | |||
46 | /*Here should be your evb resourse,such as LCD*/ | ||
47 | |||
48 | static struct platform_device *w90p910evb_dev[] __initdata = { | ||
49 | }; | ||
50 | |||
51 | static void __init w90p910evb_map_io(void) | ||
52 | { | ||
53 | w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); | ||
54 | w90p910_init_clocks(0); | ||
55 | w90p910_init_uarts(w90p910_uartcfgs, ARRAY_SIZE(w90p910_uartcfgs)); | ||
56 | } | ||
57 | |||
58 | static void __init w90p910evb_init(void) | ||
59 | { | ||
60 | platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev)); | ||
61 | } | ||
62 | |||
63 | MACHINE_START(W90P910EVB, "W90P910EVB") | ||
64 | /* Maintainer: Wan ZongShun */ | ||
65 | .phys_io = W90X900_PA_UART, | ||
66 | .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc, | ||
67 | .boot_params = 0, | ||
68 | .map_io = w90p910evb_map_io, | ||
69 | .init_irq = w90x900_init_irq, | ||
70 | .init_machine = w90p910evb_init, | ||
71 | .timer = &w90x900_timer, | ||
72 | MACHINE_END | ||
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c new file mode 100644 index 000000000000..3a69e381f316 --- /dev/null +++ b/arch/arm/mach-w90x900/time.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/time.c | ||
3 | * | ||
4 | * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks | ||
5 | * | ||
6 | * Copyright (c) 2008 Nuvoton technology corporation | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * Wan ZongShun <mcuos.com@gmail.com> | ||
10 | * | ||
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 | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/err.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/io.h> | ||
25 | #include <linux/leds.h> | ||
26 | |||
27 | #include <asm/mach-types.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | #include <asm/mach/time.h> | ||
30 | |||
31 | #include <mach/system.h> | ||
32 | #include <mach/map.h> | ||
33 | #include <mach/regs-timer.h> | ||
34 | |||
35 | static unsigned long w90x900_gettimeoffset(void) | ||
36 | { | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | /*IRQ handler for the timer*/ | ||
41 | |||
42 | static irqreturn_t | ||
43 | w90x900_timer_interrupt(int irq, void *dev_id) | ||
44 | { | ||
45 | timer_tick(); | ||
46 | __raw_writel(0x01, REG_TISR); /* clear TIF0 */ | ||
47 | return IRQ_HANDLED; | ||
48 | } | ||
49 | |||
50 | static struct irqaction w90x900_timer_irq = { | ||
51 | .name = "w90x900 Timer Tick", | ||
52 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | ||
53 | .handler = w90x900_timer_interrupt, | ||
54 | }; | ||
55 | |||
56 | /*Set up timer reg.*/ | ||
57 | |||
58 | static void w90x900_timer_setup(void) | ||
59 | { | ||
60 | __raw_writel(0, REG_TCSR0); | ||
61 | __raw_writel(0, REG_TCSR1); | ||
62 | __raw_writel(0, REG_TCSR2); | ||
63 | __raw_writel(0, REG_TCSR3); | ||
64 | __raw_writel(0, REG_TCSR4); | ||
65 | __raw_writel(0x1F, REG_TISR); | ||
66 | __raw_writel(15000000/(100 * 100), REG_TICR0); | ||
67 | __raw_writel(0x68000063, REG_TCSR0); | ||
68 | } | ||
69 | |||
70 | static void __init w90x900_timer_init(void) | ||
71 | { | ||
72 | w90x900_timer_setup(); | ||
73 | setup_irq(IRQ_TIMER0, &w90x900_timer_irq); | ||
74 | } | ||
75 | |||
76 | struct sys_timer w90x900_timer = { | ||
77 | .init = w90x900_timer_init, | ||
78 | .offset = w90x900_gettimeoffset, | ||
79 | .resume = w90x900_timer_setup | ||
80 | }; | ||
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c new file mode 100644 index 000000000000..aa783bc94310 --- /dev/null +++ b/arch/arm/mach-w90x900/w90p910.c | |||
@@ -0,0 +1,134 @@ | |||
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 | * All rights reserved. | ||
8 | * | ||
9 | * Wan ZongShun <mcuos.com@gmail.com> | ||
10 | * | ||
11 | * W90P910 cpu support | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/list.h> | ||
24 | #include <linux/timer.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <asm/mach/arch.h> | ||
30 | #include <asm/mach/map.h> | ||
31 | #include <asm/mach/irq.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #include <mach/hardware.h> | ||
35 | #include <mach/regs-serial.h> | ||
36 | |||
37 | #include "cpu.h" | ||
38 | |||
39 | /*W90P910 has five uarts*/ | ||
40 | |||
41 | #define MAX_UART_COUNT 5 | ||
42 | static int uart_count; | ||
43 | static struct platform_device *uart_devs[MAX_UART_COUNT-1]; | ||
44 | |||
45 | /* Initial IO mappings */ | ||
46 | |||
47 | static struct map_desc w90p910_iodesc[] __initdata = { | ||
48 | IODESC_ENT(IRQ), | ||
49 | IODESC_ENT(GCR), | ||
50 | IODESC_ENT(UART), | ||
51 | IODESC_ENT(TIMER), | ||
52 | IODESC_ENT(EBI), | ||
53 | /*IODESC_ENT(LCD),*/ | ||
54 | }; | ||
55 | |||
56 | /*Init the dev resource*/ | ||
57 | |||
58 | static W90X900_RES(UART0); | ||
59 | static W90X900_RES(UART1); | ||
60 | static W90X900_RES(UART2); | ||
61 | static W90X900_RES(UART3); | ||
62 | static W90X900_RES(UART4); | ||
63 | static W90X900_DEVICE(uart0, UART0, 0, "w90x900-uart"); | ||
64 | static W90X900_DEVICE(uart1, UART1, 1, "w90x900-uart"); | ||
65 | static W90X900_DEVICE(uart2, UART2, 2, "w90x900-uart"); | ||
66 | static W90X900_DEVICE(uart3, UART3, 3, "w90x900-uart"); | ||
67 | static W90X900_DEVICE(uart4, UART4, 4, "w90x900-uart"); | ||
68 | |||
69 | static struct platform_device *uart_devices[] __initdata = { | ||
70 | &w90x900_uart0, | ||
71 | &w90x900_uart1, | ||
72 | &w90x900_uart2, | ||
73 | &w90x900_uart3, | ||
74 | &w90x900_uart4 | ||
75 | }; | ||
76 | |||
77 | /*Init W90P910 uart device*/ | ||
78 | |||
79 | void __init w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no) | ||
80 | { | ||
81 | struct platform_device *platdev; | ||
82 | int uart, uartdev; | ||
83 | |||
84 | /*By min() to judge count of uart be used indeed*/ | ||
85 | |||
86 | uartdev = ARRAY_SIZE(uart_devices); | ||
87 | no = min(uartdev, no); | ||
88 | |||
89 | for (uart = 0; uart < no; uart++, cfg++) { | ||
90 | if (cfg->hwport != uart) | ||
91 | printk(KERN_ERR "w90x900_uartcfg[%d] error\n", uart); | ||
92 | platdev = uart_devices[cfg->hwport]; | ||
93 | uart_devs[uart] = platdev; | ||
94 | platdev->dev.platform_data = cfg; | ||
95 | } | ||
96 | uart_count = uart; | ||
97 | } | ||
98 | |||
99 | /*Init W90P910 evb io*/ | ||
100 | |||
101 | void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size) | ||
102 | { | ||
103 | unsigned long idcode = 0x0; | ||
104 | |||
105 | iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); | ||
106 | |||
107 | idcode = __raw_readl(W90X900PDID); | ||
108 | if (idcode != W90P910_CPUID) | ||
109 | printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode); | ||
110 | } | ||
111 | |||
112 | /*Init W90P910 clock*/ | ||
113 | |||
114 | void __init w90p910_init_clocks(int xtal) | ||
115 | { | ||
116 | } | ||
117 | |||
118 | static int __init w90p910_init_cpu(void) | ||
119 | { | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static int __init w90x900_arch_init(void) | ||
124 | { | ||
125 | int ret; | ||
126 | |||
127 | ret = w90p910_init_cpu(); | ||
128 | if (ret != 0) | ||
129 | return ret; | ||
130 | |||
131 | return platform_add_devices(uart_devs, uart_count); | ||
132 | |||
133 | } | ||
134 | arch_initcall(w90x900_arch_init); | ||