[ARM] 3829/1: iop3xx: optimise irq entry macros
[deliverable/linux.git] / arch / arm / mach-iop33x / setup.c
1 /*
2 * linux/arch/arm/mach-iop33x/setup.c
3 *
4 * Author: Dave Jiang (dave.jiang@intel.com)
5 * Copyright (C) 2004 Intel Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12 #include <linux/mm.h>
13 #include <linux/init.h>
14 #include <linux/major.h>
15 #include <linux/fs.h>
16 #include <linux/platform_device.h>
17 #include <linux/serial.h>
18 #include <linux/tty.h>
19 #include <linux/serial_8250.h>
20
21 #include <asm/io.h>
22 #include <asm/pgtable.h>
23 #include <asm/page.h>
24 #include <asm/mach/map.h>
25 #include <asm/setup.h>
26 #include <asm/system.h>
27 #include <asm/memory.h>
28 #include <asm/hardware.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/time.h>
32 #include <asm/hardware/iop3xx.h>
33
34 #define IOP331_UART_XTAL 33334000
35
36 static struct resource iop33x_uart0_resources[] = {
37 [0] = {
38 .start = IOP331_UART0_PHYS,
39 .end = IOP331_UART0_PHYS + 0x3f,
40 .flags = IORESOURCE_MEM,
41 },
42 [1] = {
43 .start = IRQ_IOP331_UART0,
44 .end = IRQ_IOP331_UART0,
45 .flags = IORESOURCE_IRQ
46 }
47 };
48
49 static struct resource iop33x_uart1_resources[] = {
50 [0] = {
51 .start = IOP331_UART1_PHYS,
52 .end = IOP331_UART1_PHYS + 0x3f,
53 .flags = IORESOURCE_MEM,
54 },
55 [1] = {
56 .start = IRQ_IOP331_UART1,
57 .end = IRQ_IOP331_UART1,
58 .flags = IORESOURCE_IRQ
59 }
60 };
61
62 static struct plat_serial8250_port iop33x_uart0_data[] = {
63 {
64 .membase = (char*)(IOP331_UART0_VIRT),
65 .mapbase = (IOP331_UART0_PHYS),
66 .irq = IRQ_IOP331_UART0,
67 .uartclk = IOP331_UART_XTAL,
68 .regshift = 2,
69 .iotype = UPIO_MEM,
70 .flags = UPF_SKIP_TEST,
71 },
72 { },
73 };
74
75 static struct plat_serial8250_port iop33x_uart1_data[] = {
76 {
77 .membase = (char*)(IOP331_UART1_VIRT),
78 .mapbase = (IOP331_UART1_PHYS),
79 .irq = IRQ_IOP331_UART1,
80 .uartclk = IOP331_UART_XTAL,
81 .regshift = 2,
82 .iotype = UPIO_MEM,
83 .flags = UPF_SKIP_TEST,
84 },
85 { },
86 };
87
88 static struct platform_device iop33x_uart0 = {
89 .name = "serial8250",
90 .id = PLAT8250_DEV_PLATFORM,
91 .dev.platform_data = iop33x_uart0_data,
92 .num_resources = 2,
93 .resource = iop33x_uart0_resources,
94 };
95
96 static struct platform_device iop33x_uart1 = {
97 .name = "serial8250",
98 .id = PLAT8250_DEV_PLATFORM1,
99 .dev.platform_data = iop33x_uart1_data,
100 .num_resources = 2,
101 .resource = iop33x_uart1_resources,
102 };
103
104 static struct platform_device *iop33x_devices[] __initdata = {
105 &iop33x_uart0,
106 &iop33x_uart1,
107 };
108
109 void __init iop33x_init(void)
110 {
111 if(iop_is_331())
112 {
113 platform_add_devices(iop33x_devices,
114 ARRAY_SIZE(iop33x_devices));
115 }
116 platform_device_register(&iop3xx_i2c0_device);
117 platform_device_register(&iop3xx_i2c1_device);
118 }
119
120 #ifdef CONFIG_ARCH_IOP33X
121 extern void iop331_init_irq(void);
122 #endif
123
124 static void __init iop3xx_timer_init(void)
125 {
126 iop3xx_init_time(IOP331_TICK_RATE);
127 }
128
129 struct sys_timer iop331_timer = {
130 .init = iop3xx_timer_init,
131 .offset = iop3xx_gettimeoffset,
132 };
133
134 #if defined(CONFIG_ARCH_IQ80331)
135 MACHINE_START(IQ80331, "Intel IQ80331")
136 /* Maintainer: Intel Corp. */
137 .phys_io = 0xfefff000,
138 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
139 .map_io = iop3xx_map_io,
140 .init_irq = iop331_init_irq,
141 .timer = &iop331_timer,
142 .boot_params = 0x0100,
143 .init_machine = iop33x_init,
144 MACHINE_END
145
146 #elif defined(CONFIG_MACH_IQ80332)
147 MACHINE_START(IQ80332, "Intel IQ80332")
148 /* Maintainer: Intel Corp. */
149 .phys_io = 0xfefff000,
150 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
151 .map_io = iop3xx_map_io,
152 .init_irq = iop331_init_irq,
153 .timer = &iop331_timer,
154 .boot_params = 0x0100,
155 .init_machine = iop33x_init,
156 MACHINE_END
157
158 #else
159 #error No machine descriptor defined for this IOP3XX implementation
160 #endif
161
162
This page took 0.130491 seconds and 5 git commands to generate.