MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / arm / mach-moxart / arch.c
blob2ff988de2914758fe1fbdd4f6ec39d26e90ec1d9
1 /*
2 * linux/arch/arm/mach-cpe/arch.c
3 * modified by ivan wang 2004/8/18 01:35pm
4 */
5 #include <linux/tty.h>
6 #include <linux/delay.h>
7 #include <linux/pm.h>
8 #include <linux/init.h>
10 #include <asm/io.h>
11 #include <asm/elf.h>
12 #include <asm/setup.h>
13 #include <asm/mach-types.h>
14 #include <asm/mach/arch.h>
15 #include <asm/arch/hardware.h>
16 #include <asm/sizes.h>
17 #include <asm/mach/map.h>
18 #include <asm/arch/time.h> /*Calling moxa_timer_init*/
19 #include <asm/arch/irq.h> /*Calling moxa_irq_init*/
20 #include <asm/arch/moxa.h>
21 #include <linux/serial.h>
22 #include <linux/serial_core.h>
23 #include <asm/arch/moxa.h>
25 #if 0 // mask by Victor Yu. 02-12-2007
26 static struct uart_port moxa_serial_ports[] = {
28 .iobase = CPE_UART1_BASE,
29 .mapbase = CPE_UART1_BASE,
30 .irq = IRQ_UART,
31 .flags = UPF_SKIP_TEST|UPF_SHARE_IRQ,
32 .iotype = UPIO_PORT,
33 .regshift = 2,
34 .uartclk = CONFIG_UART_CLK,
35 .line = 0,
36 .type = PORT_16550A,
37 .fifosize = 16
40 .mapbase = CPE_UART2_BASE,
41 .iobase = CPE_UART2_BASE,
42 .irq = IRQ_UART,
43 .flags = UPF_SKIP_TEST|UPF_SHARE_IRQ,
44 .iotype = UPIO_PORT,
45 .regshift = 2,
46 .uartclk = CONFIG_UART_CLK,
47 .line = 1,
48 .type = PORT_16550A,
49 .fifosize = 16
52 #else
53 static struct uart_port moxa_serial_ports[2];
54 #endif
56 #if 0 // mask by Victor Yu. 02-08-2007
57 static int __init moxa_serial_init(void)
59 early_serial_setup(&moxa_serial_ports[0]);
60 early_serial_setup(&moxa_serial_ports[1]);
61 return 0;
63 __initcall(moxa_serial_init);
64 #endif
66 #if 1 // add by Victor Yu, 03-15-2007
67 #include <linux/interrupt.h>
68 extern void cpe_mask_irq(unsigned int irq);
69 extern void cpe_unmask_irq(unsigned int irq);
70 extern void cpe_mask_ack_irq(unsigned int irq);
71 extern void cpe_clear_irq(unsigned int intNum);
72 extern void cpe_int_init(void);
73 static struct irqchip cpe_irq_chip;
74 static void irq_init_irq(void)
76 unsigned long flags;
77 int irq;
79 save_and_cli(flags);
80 cpe_int_init();
81 restore_flags(flags);
82 cpe_irq_chip.ack = cpe_mask_ack_irq;
83 cpe_irq_chip.mask = cpe_mask_irq;
84 cpe_irq_chip.unmask = cpe_unmask_irq;
85 for (irq = 0; irq < NR_IRQS; irq++) {
86 set_irq_chip(irq, &cpe_irq_chip);
87 set_irq_handler(irq, do_level_IRQ);
88 set_irq_flags(irq, IRQF_VALID);
91 #endif
93 static void __init
94 fixup_uc711x(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi)
96 mi->nr_banks = 1;
97 mi->bank[0].start = CONFIG_DRAM_BASE;
98 mi->bank[0].size = CONFIG_DRAM_SIZE;
99 mi->bank[0].node = 0;
101 #if 1 // add by Victor Yu. 02-12-2007
102 moxa_serial_ports[0].iobase = CPE_UART1_BASE;
103 moxa_serial_ports[0].mapbase = CPE_UART1_BASE;
104 moxa_serial_ports[0].irq = IRQ_UART;
105 moxa_serial_ports[0].flags = UPF_SKIP_TEST|UPF_SHARE_IRQ;
106 moxa_serial_ports[0].iotype = UPIO_PORT;
107 moxa_serial_ports[0].regshift = 2;
108 moxa_serial_ports[0].uartclk = CONFIG_UART_CLK;
109 moxa_serial_ports[0].line = 0;
110 moxa_serial_ports[0].type = PORT_16550A;
111 moxa_serial_ports[0].fifosize = 16;
113 moxa_serial_ports[1].iobase = CPE_UART2_BASE;
114 moxa_serial_ports[1].mapbase = CPE_UART2_BASE;
115 moxa_serial_ports[1].irq = IRQ_UART;
116 moxa_serial_ports[1].flags = UPF_SKIP_TEST|UPF_SHARE_IRQ;
117 moxa_serial_ports[1].iotype = UPIO_PORT;
118 moxa_serial_ports[1].regshift = 2;
119 moxa_serial_ports[1].uartclk = CONFIG_UART_CLK;
120 moxa_serial_ports[1].line = 1;
121 moxa_serial_ports[1].type = PORT_16550A;
122 moxa_serial_ports[1].fifosize = 16;
124 early_serial_setup(&moxa_serial_ports[0]);
125 early_serial_setup(&moxa_serial_ports[1]);
126 #endif
129 extern struct sys_timer moxa_timer;
131 #ifdef CONFIG_ARCH_UC7110
132 MACHINE_START(MOXART, "UC7110")
133 .fixup = fixup_uc711x,
134 .init_irq = irq_init_irq,
135 .timer = &moxa_timer,
136 MACHINE_END
137 #endif
139 #ifdef CONFIG_ARCH_UC7112
140 MACHINE_START(MOXART, "UC7112")
141 .fixup = fixup_uc711x,
142 .init_irq = irq_init_irq,
143 .timer = &moxa_timer,
144 MACHINE_END
145 #endif
147 #ifdef CONFIG_ARCH_EM1220
148 MACHINE_START(MOXART, "EM1220")
149 .fixup = fixup_uc711x,
150 .init_irq = irq_init_irq,
151 .timer = &moxa_timer,
152 MACHINE_END
153 #endif
155 #ifdef CONFIG_ARCH_EM1220_DLIN
156 MACHINE_START(MOXART, "EM1220 DLIN")
157 .fixup = fixup_uc711x,
158 .init_irq = irq_init_irq,
159 .timer = &moxa_timer,
160 MACHINE_END
161 #endif
163 #ifdef CONFIG_ARCH_EM1220_APIT
164 MACHINE_START(MOXART, "EM1220 APIT")
165 .fixup = fixup_uc711x,
166 .init_irq = irq_init_irq,
167 .timer = &moxa_timer,
168 MACHINE_END
169 #endif
171 #ifdef CONFIG_ARCH_EM1240
172 MACHINE_START(MOXART, "EM1240")
173 .fixup = fixup_uc711x,
174 .init_irq = irq_init_irq,
175 .timer = &moxa_timer,
176 MACHINE_END
177 #endif
179 #ifdef CONFIG_ARCH_EM1240_IVTC
180 MACHINE_START(MOXART, "EM1240 IVTC")
181 .fixup = fixup_uc711x,
182 .init_irq = irq_init_irq,
183 .timer = &moxa_timer,
184 MACHINE_END
185 #endif
187 #ifdef CONFIG_ARCH_EM1240_MT
188 MACHINE_START(MOXART, "EM1240 MT")
189 .fixup = fixup_uc711x,
190 .init_irq = irq_init_irq,
191 .timer = &moxa_timer,
192 MACHINE_END
193 #endif
195 #ifdef CONFIG_ARCH_W321_GL2
196 MACHINE_START(MOXART, "W321 GL2")
197 .fixup = fixup_uc711x,
198 .init_irq = irq_init_irq,
199 .timer = &moxa_timer,
200 MACHINE_END
201 #endif
203 #ifdef CONFIG_ARCH_W315_EC
204 MACHINE_START(MOXART, "W315_EC")
205 .fixup = fixup_uc711x,
206 .init_irq = irq_init_irq,
207 .timer = &moxa_timer,
208 MACHINE_END
209 #endif
211 #ifdef CONFIG_ARCH_UC7101
212 MACHINE_START(MOXART, "UC7101")
213 .fixup = fixup_uc711x,
214 .init_irq = irq_init_irq,
215 .timer = &moxa_timer,
216 MACHINE_END
217 #endif
219 #ifdef CONFIG_ARCH_W311_TEST
220 MACHINE_START(MOXART, "W311_TEST")
221 .fixup = fixup_uc711x,
222 .init_irq = irq_init_irq,
223 .timer = &moxa_timer,
224 MACHINE_END
225 #endif
227 #ifdef CONFIG_ARCH_EM1110
228 MACHINE_START(MOXART, "EM1110")
229 .fixup = fixup_uc711x,
230 .init_irq = irq_init_irq,
231 .timer = &moxa_timer,
232 MACHINE_END
233 #endif