[ARM] 3818/1: iop3xx: introduce arch/arm/plat-iop for shared iop32x/iop33x code
[pandora-kernel.git] / arch / arm / mach-iop32x / setup.c
1 /*
2  * linux/arch/arm/mach-iop32x/setup.c
3  *
4  * Author: Nicolas Pitre <nico@cam.org>
5  * Copyright (C) 2001 MontaVista Software, Inc.
6  * Copyright (C) 2004 Intel Corporation.
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 version 2 as
10  * published by the Free Software Foundation.
11  *
12  */
13 #include <linux/mm.h>
14 #include <linux/init.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_core.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 IOP321_UART_XTAL 1843200
34
35 #ifdef CONFIG_ARCH_IQ80321
36 #define UARTBASE IQ80321_UART
37 #define IRQ_UART IRQ_IQ80321_UART
38 #endif
39
40 #ifdef CONFIG_ARCH_IQ31244
41 #define UARTBASE IQ31244_UART
42 #define IRQ_UART IRQ_IQ31244_UART
43 #endif
44
45 static struct uart_port iop321_serial_ports[] = {
46         {
47                 .membase        = (char*)(UARTBASE),
48                 .mapbase        = (UARTBASE),
49                 .irq            = IRQ_UART,
50                 .flags          = UPF_SKIP_TEST,
51                 .iotype         = UPIO_MEM,
52                 .regshift       = 0,
53                 .uartclk        = IOP321_UART_XTAL,
54                 .line           = 0,
55                 .type           = PORT_16550A,
56                 .fifosize       = 16
57         }
58 };
59
60 static struct resource iop32x_i2c_0_resources[] = {
61         [0] = {
62                 .start = 0xfffff680,
63                 .end = 0xfffff698,
64                 .flags = IORESOURCE_MEM,
65         },
66         [1] = {
67                 .start = IRQ_IOP321_I2C_0,
68                 .end = IRQ_IOP321_I2C_0,
69                 .flags = IORESOURCE_IRQ
70         }
71 };
72
73 static struct resource iop32x_i2c_1_resources[] = {
74         [0] = {
75                 .start = 0xfffff6a0,
76                 .end = 0xfffff6b8,
77                 .flags = IORESOURCE_MEM,
78         },
79         [1] = {
80                 .start = IRQ_IOP321_I2C_1,
81                 .end = IRQ_IOP321_I2C_1,
82                 .flags = IORESOURCE_IRQ
83         }
84 };
85
86 static struct platform_device iop32x_i2c_0_controller = {
87         .name = "IOP3xx-I2C",
88         .id = 0,
89         .num_resources = 2,
90         .resource = iop32x_i2c_0_resources
91 };
92
93 static struct platform_device iop32x_i2c_1_controller = {
94         .name = "IOP3xx-I2C",
95         .id = 1,
96         .num_resources = 2,
97         .resource = iop32x_i2c_1_resources
98 };
99
100 static struct platform_device *iop32x_devices[] __initdata = {
101         &iop32x_i2c_0_controller,
102         &iop32x_i2c_1_controller
103 };
104
105 void __init iop32x_init(void)
106 {
107         if(iop_is_321())
108         {
109                 platform_add_devices(iop32x_devices,
110                                 ARRAY_SIZE(iop32x_devices));
111         }
112         early_serial_setup(&iop321_serial_ports[0]);
113 }
114
115 #ifdef CONFIG_ARCH_IQ80321
116 extern void iq80321_map_io(void);
117 extern struct sys_timer iop321_timer;
118 extern void iop321_init_time(void);
119 #endif
120
121 #ifdef CONFIG_ARCH_IQ31244
122 extern void iq31244_map_io(void);
123 extern struct sys_timer iop321_timer;
124 extern void iop321_init_time(void);
125 #endif
126
127 #if defined(CONFIG_ARCH_IQ80321)
128 MACHINE_START(IQ80321, "Intel IQ80321")
129         /* Maintainer: Intel Corporation */
130         .phys_io        = IQ80321_UART,
131         .io_pg_offst    = ((IQ80321_UART) >> 18) & 0xfffc,
132         .map_io         = iq80321_map_io,
133         .init_irq       = iop321_init_irq,
134         .timer          = &iop321_timer,
135         .boot_params    = 0xa0000100,
136         .init_machine   = iop32x_init,
137 MACHINE_END
138 #elif defined(CONFIG_ARCH_IQ31244)
139 MACHINE_START(IQ31244, "Intel IQ31244")
140         /* Maintainer: Intel Corp. */
141         .phys_io        = IQ31244_UART,
142         .io_pg_offst    = ((IQ31244_UART) >> 18) & 0xfffc,
143         .map_io         = iq31244_map_io,
144         .init_irq       = iop321_init_irq,
145         .timer          = &iop321_timer,
146         .boot_params    = 0xa0000100,
147         .init_machine   = iop32x_init,
148 MACHINE_END
149 #else
150 #error No machine descriptor defined for this IOP3XX implementation
151 #endif