[ARM] remove duplicate #includes
[linux-3.10.git] / arch / arm / mach-iop3xx / iop331-setup.c
1 /*
2  * linux/arch/arm/mach-iop3xx/iop331-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/config.h>
15 #include <linux/major.h>
16 #include <linux/fs.h>
17 #include <linux/platform_device.h>
18 #include <linux/serial.h>
19 #include <linux/tty.h>
20 #include <linux/serial_8250.h>
21
22 #include <asm/io.h>
23 #include <asm/pgtable.h>
24 #include <asm/page.h>
25 #include <asm/mach/map.h>
26 #include <asm/setup.h>
27 #include <asm/system.h>
28 #include <asm/memory.h>
29 #include <asm/hardware.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32
33 #define IOP331_UART_XTAL 33334000
34
35 /*
36  * Standard IO mapping for all IOP331 based systems
37  */
38 static struct map_desc iop331_std_desc[] __initdata = {
39         {       /* mem mapped registers */
40                 .virtual        = IOP331_VIRT_MEM_BASE,
41                 .pfn            = __phys_to_pfn(IOP331_PHYS_MEM_BASE),
42                 .length         = 0x00002000,
43                 .type           = MT_DEVICE
44         }, {    /* PCI IO space */
45                 .virtual        = IOP331_PCI_LOWER_IO_VA,
46                 .pfn            = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA),
47                 .length         = IOP331_PCI_IO_WINDOW_SIZE,
48                 .type           = MT_DEVICE
49         }
50 };
51
52 static struct resource iop33x_uart0_resources[] = {
53         [0] = {
54                 .start = IOP331_UART0_PHYS,
55                 .end = IOP331_UART0_PHYS + 0x3f,
56                 .flags = IORESOURCE_MEM,
57         },
58         [1] = {
59                 .start = IRQ_IOP331_UART0,
60                 .end = IRQ_IOP331_UART0,
61                 .flags = IORESOURCE_IRQ
62         }
63 };
64
65 static struct resource iop33x_uart1_resources[] = {
66         [0] = {
67                 .start = IOP331_UART1_PHYS,
68                 .end = IOP331_UART1_PHYS + 0x3f,
69                 .flags = IORESOURCE_MEM,
70         },
71         [1] = {
72                 .start = IRQ_IOP331_UART1,
73                 .end = IRQ_IOP331_UART1,
74                 .flags = IORESOURCE_IRQ
75         }
76 };
77
78 static struct plat_serial8250_port iop33x_uart0_data[] = {
79         {
80        .membase     = (char*)(IOP331_UART0_VIRT),
81        .mapbase     = (IOP331_UART0_PHYS),
82        .irq         = IRQ_IOP331_UART0,
83        .uartclk     = IOP331_UART_XTAL,
84        .regshift    = 2,
85        .iotype      = UPIO_MEM,
86        .flags       = UPF_SKIP_TEST,
87         },
88         {  },
89 };
90
91 static struct plat_serial8250_port iop33x_uart1_data[] = {
92         {
93        .membase     = (char*)(IOP331_UART1_VIRT),
94        .mapbase     = (IOP331_UART1_PHYS),
95        .irq         = IRQ_IOP331_UART1,
96        .uartclk     = IOP331_UART_XTAL,
97        .regshift    = 2,
98        .iotype      = UPIO_MEM,
99        .flags       = UPF_SKIP_TEST,
100         },
101         {  },
102 };
103
104 static struct platform_device iop33x_uart0 = {
105        .name = "serial8250",
106        .id = 0,
107        .dev.platform_data = iop33x_uart0_data,
108        .num_resources = 2,
109        .resource = iop33x_uart0_resources,
110 };
111
112 static struct platform_device iop33x_uart1 = {
113        .name = "serial8250",
114        .id = 1,
115        .dev.platform_data = iop33x_uart1_data,
116        .num_resources = 2,
117        .resource = iop33x_uart1_resources,
118 };
119
120 static struct resource iop33x_i2c_0_resources[] = {
121         [0] = {
122                 .start = 0xfffff680,
123                 .end = 0xfffff698,
124                 .flags = IORESOURCE_MEM,
125         },
126         [1] = {
127                 .start = IRQ_IOP331_I2C_0,
128                 .end = IRQ_IOP331_I2C_0,
129                 .flags = IORESOURCE_IRQ
130         }
131 };
132
133 static struct resource iop33x_i2c_1_resources[] = {
134         [0] = {
135                 .start = 0xfffff6a0,
136                 .end = 0xfffff6b8,
137                 .flags = IORESOURCE_MEM,
138         },
139         [1] = {
140                 .start = IRQ_IOP331_I2C_1,
141                 .end = IRQ_IOP331_I2C_1,
142                 .flags = IORESOURCE_IRQ
143         }
144 };
145
146 static struct platform_device iop33x_i2c_0_controller = {
147         .name = "IOP3xx-I2C",
148         .id = 0,
149         .num_resources = 2,
150         .resource = iop33x_i2c_0_resources
151 };
152
153 static struct platform_device iop33x_i2c_1_controller = {
154         .name = "IOP3xx-I2C",
155         .id = 1,
156         .num_resources = 2,
157         .resource = iop33x_i2c_1_resources
158 };
159
160 static struct platform_device *iop33x_devices[] __initdata = {
161         &iop33x_uart0,
162         &iop33x_uart1,
163         &iop33x_i2c_0_controller,
164         &iop33x_i2c_1_controller
165 };
166
167 void __init iop33x_init(void)
168 {
169         if(iop_is_331())
170         {
171                 platform_add_devices(iop33x_devices,
172                                 ARRAY_SIZE(iop33x_devices));
173         }
174 }
175
176 void __init iop331_map_io(void)
177 {
178         iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
179 }
180
181 #ifdef CONFIG_ARCH_IOP331
182 extern void iop331_init_irq(void);
183 extern struct sys_timer iop331_timer;
184 #endif
185
186 #ifdef CONFIG_ARCH_IQ80331
187 extern void iq80331_map_io(void);
188 #endif
189
190 #ifdef CONFIG_MACH_IQ80332
191 extern void iq80332_map_io(void);
192 #endif
193
194 #if defined(CONFIG_ARCH_IQ80331)
195 MACHINE_START(IQ80331, "Intel IQ80331")
196         /* Maintainer: Intel Corp. */
197         .phys_io        = 0xfefff000,
198         .io_pg_offst    = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
199         .map_io         = iq80331_map_io,
200         .init_irq       = iop331_init_irq,
201         .timer          = &iop331_timer,
202         .boot_params    = 0x0100,
203         .init_machine   = iop33x_init,
204 MACHINE_END
205
206 #elif defined(CONFIG_MACH_IQ80332)
207 MACHINE_START(IQ80332, "Intel IQ80332")
208         /* Maintainer: Intel Corp. */
209         .phys_io        = 0xfefff000,
210         .io_pg_offst    = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
211         .map_io         = iq80332_map_io,
212         .init_irq       = iop331_init_irq,
213         .timer          = &iop331_timer,
214         .boot_params    = 0x0100,
215         .init_machine   = iop33x_init,
216 MACHINE_END
217
218 #else
219 #error No machine descriptor defined for this IOP3XX implementation
220 #endif
221
222