Commit | Line | Data |
---|---|---|
1da177e4 LT |
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/init.h> | |
16 | #include <linux/major.h> | |
17 | #include <linux/fs.h> | |
d052d1be | 18 | #include <linux/platform_device.h> |
1da177e4 LT |
19 | #include <linux/serial.h> |
20 | #include <linux/tty.h> | |
21 | #include <linux/serial_core.h> | |
22 | ||
23 | #include <asm/io.h> | |
24 | #include <asm/pgtable.h> | |
25 | #include <asm/page.h> | |
26 | #include <asm/mach/map.h> | |
27 | #include <asm/setup.h> | |
28 | #include <asm/system.h> | |
29 | #include <asm/memory.h> | |
30 | #include <asm/hardware.h> | |
31 | #include <asm/mach-types.h> | |
32 | #include <asm/mach/arch.h> | |
33 | ||
34 | #define IOP331_UART_XTAL 33334000 | |
35 | ||
36 | /* | |
37 | * Standard IO mapping for all IOP331 based systems | |
38 | */ | |
39 | static struct map_desc iop331_std_desc[] __initdata = { | |
4835e64a DS |
40 | { /* mem mapped registers */ |
41 | .virtual = IOP331_VIRT_MEM_BASE, | |
42 | .pfn = __phys_to_pfn(IOP331_PHYS_MEM_BASE), | |
43 | .length = 0x00002000, | |
44 | .type = MT_DEVICE | |
45 | }, { /* PCI IO space */ | |
46 | .virtual = IOP331_PCI_LOWER_IO_VA, | |
47 | .pfn = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA), | |
48 | .length = IOP331_PCI_IO_WINDOW_SIZE, | |
49 | .type = MT_DEVICE | |
50 | } | |
1da177e4 LT |
51 | }; |
52 | ||
53 | static struct uart_port iop331_serial_ports[] = { | |
54 | { | |
55 | .membase = (char*)(IOP331_UART0_VIRT), | |
56 | .mapbase = (IOP331_UART0_PHYS), | |
57 | .irq = IRQ_IOP331_UART0, | |
58 | .flags = UPF_SKIP_TEST, | |
59 | .iotype = UPIO_MEM, | |
60 | .regshift = 2, | |
61 | .uartclk = IOP331_UART_XTAL, | |
62 | .line = 0, | |
63 | .type = PORT_XSCALE, | |
64 | .fifosize = 32 | |
65 | } , { | |
66 | .membase = (char*)(IOP331_UART1_VIRT), | |
67 | .mapbase = (IOP331_UART1_PHYS), | |
68 | .irq = IRQ_IOP331_UART1, | |
69 | .flags = UPF_SKIP_TEST, | |
70 | .iotype = UPIO_MEM, | |
71 | .regshift = 2, | |
72 | .uartclk = IOP331_UART_XTAL, | |
73 | .line = 1, | |
74 | .type = PORT_XSCALE, | |
75 | .fifosize = 32 | |
76 | } | |
77 | }; | |
78 | ||
79 | static struct resource iop33x_i2c_0_resources[] = { | |
80 | [0] = { | |
81 | .start = 0xfffff680, | |
82 | .end = 0xfffff698, | |
83 | .flags = IORESOURCE_MEM, | |
84 | }, | |
85 | [1] = { | |
86 | .start = IRQ_IOP331_I2C_0, | |
87 | .end = IRQ_IOP331_I2C_0, | |
88 | .flags = IORESOURCE_IRQ | |
89 | } | |
90 | }; | |
91 | ||
92 | static struct resource iop33x_i2c_1_resources[] = { | |
93 | [0] = { | |
94 | .start = 0xfffff6a0, | |
95 | .end = 0xfffff6b8, | |
96 | .flags = IORESOURCE_MEM, | |
97 | }, | |
98 | [1] = { | |
99 | .start = IRQ_IOP331_I2C_1, | |
100 | .end = IRQ_IOP331_I2C_1, | |
101 | .flags = IORESOURCE_IRQ | |
102 | } | |
103 | }; | |
104 | ||
105 | static struct platform_device iop33x_i2c_0_controller = { | |
106 | .name = "IOP3xx-I2C", | |
107 | .id = 0, | |
108 | .num_resources = 2, | |
109 | .resource = iop33x_i2c_0_resources | |
110 | }; | |
111 | ||
112 | static struct platform_device iop33x_i2c_1_controller = { | |
113 | .name = "IOP3xx-I2C", | |
114 | .id = 1, | |
115 | .num_resources = 2, | |
116 | .resource = iop33x_i2c_1_resources | |
117 | }; | |
118 | ||
119 | static struct platform_device *iop33x_devices[] __initdata = { | |
120 | &iop33x_i2c_0_controller, | |
121 | &iop33x_i2c_1_controller | |
122 | }; | |
123 | ||
124 | void __init iop33x_init(void) | |
125 | { | |
126 | if(iop_is_331()) | |
127 | { | |
128 | platform_add_devices(iop33x_devices, | |
129 | ARRAY_SIZE(iop33x_devices)); | |
130 | } | |
131 | } | |
132 | ||
133 | void __init iop331_map_io(void) | |
134 | { | |
135 | iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc)); | |
136 | early_serial_setup(&iop331_serial_ports[0]); | |
137 | early_serial_setup(&iop331_serial_ports[1]); | |
138 | } | |
139 | ||
140 | #ifdef CONFIG_ARCH_IOP331 | |
141 | extern void iop331_init_irq(void); | |
142 | extern struct sys_timer iop331_timer; | |
143 | #endif | |
144 | ||
145 | #ifdef CONFIG_ARCH_IQ80331 | |
146 | extern void iq80331_map_io(void); | |
147 | #endif | |
148 | ||
149 | #ifdef CONFIG_MACH_IQ80332 | |
150 | extern void iq80332_map_io(void); | |
151 | #endif | |
152 | ||
153 | #if defined(CONFIG_ARCH_IQ80331) | |
154 | MACHINE_START(IQ80331, "Intel IQ80331") | |
e9dea0c6 RK |
155 | /* Maintainer: Intel Corp. */ |
156 | .phys_ram = PHYS_OFFSET, | |
157 | .phys_io = 0xfefff000, | |
158 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical | |
159 | .map_io = iq80331_map_io, | |
160 | .init_irq = iop331_init_irq, | |
1da177e4 | 161 | .timer = &iop331_timer, |
e9dea0c6 RK |
162 | .boot_params = 0x0100, |
163 | .init_machine = iop33x_init, | |
1da177e4 LT |
164 | MACHINE_END |
165 | ||
166 | #elif defined(CONFIG_MACH_IQ80332) | |
167 | MACHINE_START(IQ80332, "Intel IQ80332") | |
e9dea0c6 RK |
168 | /* Maintainer: Intel Corp. */ |
169 | .phys_ram = PHYS_OFFSET, | |
170 | .phys_io = 0xfefff000, | |
171 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical | |
172 | .map_io = iq80332_map_io, | |
173 | .init_irq = iop331_init_irq, | |
1da177e4 | 174 | .timer = &iop331_timer, |
e9dea0c6 RK |
175 | .boot_params = 0x0100, |
176 | .init_machine = iop33x_init, | |
1da177e4 LT |
177 | MACHINE_END |
178 | ||
179 | #else | |
180 | #error No machine descriptor defined for this IOP3XX implementation | |
181 | #endif | |
182 | ||
183 |