]>
Commit | Line | Data |
---|---|---|
a2bd40d2 HS |
1 | /* |
2 | * arch/arm/mach-ep93xx/edb93xx.c | |
3 | * Cirrus Logic EDB93xx Development Board support. | |
4 | * | |
5 | * EDB93XX, EDB9301, EDB9307A | |
6 | * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com> | |
7 | * | |
8 | * EDB9302 | |
9 | * Copyright (C) 2006 George Kashperko <george@chas.com.ua> | |
10 | * | |
11 | * EDB9302A, EDB9315, EDB9315A | |
12 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
13 | * | |
14 | * EDB9307 | |
15 | * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org> | |
16 | * | |
17 | * EDB9312 | |
18 | * Copyright (C) 2006 Infosys Technologies Limited | |
19 | * Toufeeq Hussain <toufeeq_hussain@infosys.com> | |
20 | * | |
21 | * This program is free software; you can redistribute it and/or modify | |
22 | * it under the terms of the GNU General Public License as published by | |
23 | * the Free Software Foundation; either version 2 of the License, or (at | |
24 | * your option) any later version. | |
25 | */ | |
26 | ||
27 | #include <linux/kernel.h> | |
28 | #include <linux/init.h> | |
a2bd40d2 | 29 | #include <linux/platform_device.h> |
6531a991 | 30 | #include <linux/i2c.h> |
31bb68a3 | 31 | #include <linux/spi/spi.h> |
1dfbf334 | 32 | #include <linux/gpio/machine.h> |
31bb68a3 AS |
33 | |
34 | #include <sound/cs4271.h> | |
583ddafe | 35 | |
5b7cc904 | 36 | #include "hardware.h" |
a3b29245 AB |
37 | #include <linux/platform_data/video-ep93xx.h> |
38 | #include <linux/platform_data/spi-ep93xx.h> | |
5b7cc904 | 39 | #include "gpio-ep93xx.h" |
583ddafe | 40 | |
a2bd40d2 HS |
41 | #include <asm/mach-types.h> |
42 | #include <asm/mach/arch.h> | |
43 | ||
258249ec | 44 | #include "soc.h" |
583ddafe | 45 | |
a2bd40d2 HS |
46 | static void __init edb93xx_register_flash(void) |
47 | { | |
48 | if (machine_is_edb9307() || machine_is_edb9312() || | |
49 | machine_is_edb9315()) { | |
16bcf78f | 50 | ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); |
a2bd40d2 | 51 | } else { |
16bcf78f | 52 | ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); |
a2bd40d2 HS |
53 | } |
54 | } | |
55 | ||
b370e082 | 56 | static struct ep93xx_eth_data __initdata edb93xx_eth_data = { |
a2bd40d2 HS |
57 | .phy_id = 1, |
58 | }; | |
59 | ||
6531a991 HS |
60 | |
61 | /************************************************************************* | |
62 | * EDB93xx i2c peripheral handling | |
63 | *************************************************************************/ | |
6531a991 HS |
64 | |
65 | static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { | |
a2bd40d2 HS |
66 | { |
67 | I2C_BOARD_INFO("isl1208", 0x6f), | |
68 | }, | |
69 | }; | |
70 | ||
6531a991 | 71 | static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = { |
a2bd40d2 HS |
72 | { |
73 | I2C_BOARD_INFO("ds1337", 0x68), | |
74 | }, | |
75 | }; | |
76 | ||
77 | static void __init edb93xx_register_i2c(void) | |
78 | { | |
79 | if (machine_is_edb9302a() || machine_is_edb9307a() || | |
80 | machine_is_edb9315a()) { | |
b2e63555 | 81 | ep93xx_register_i2c(edb93xxa_i2c_board_info, |
6531a991 | 82 | ARRAY_SIZE(edb93xxa_i2c_board_info)); |
688df8f0 TC |
83 | } else if (machine_is_edb9302() || machine_is_edb9307() |
84 | || machine_is_edb9312() || machine_is_edb9315()) { | |
b2e63555 | 85 | ep93xx_register_i2c(edb93xx_i2c_board_info, |
6531a991 | 86 | ARRAY_SIZE(edb93xx_i2c_board_info)); |
a2bd40d2 HS |
87 | } |
88 | } | |
89 | ||
1fbd972a | 90 | |
31bb68a3 AS |
91 | /************************************************************************* |
92 | * EDB93xx SPI peripheral handling | |
93 | *************************************************************************/ | |
94 | static struct cs4271_platform_data edb93xx_cs4271_data = { | |
95 | .gpio_nreset = -EINVAL, /* filled in later */ | |
96 | }; | |
97 | ||
31bb68a3 AS |
98 | static struct spi_board_info edb93xx_spi_board_info[] __initdata = { |
99 | { | |
100 | .modalias = "cs4271", | |
101 | .platform_data = &edb93xx_cs4271_data, | |
31bb68a3 AS |
102 | .max_speed_hz = 6000000, |
103 | .bus_num = 0, | |
104 | .chip_select = 0, | |
105 | .mode = SPI_MODE_3, | |
106 | }, | |
107 | }; | |
108 | ||
1dfbf334 LW |
109 | static struct gpiod_lookup_table edb93xx_spi_cs_gpio_table = { |
110 | .dev_id = "ep93xx-spi.0", | |
111 | .table = { | |
112 | GPIO_LOOKUP("A", 6, "cs", GPIO_ACTIVE_LOW), | |
113 | { }, | |
114 | }, | |
55f0cd3f HS |
115 | }; |
116 | ||
31bb68a3 | 117 | static struct ep93xx_spi_info edb93xx_spi_info __initdata = { |
1dfbf334 | 118 | /* Intentionally left blank */ |
31bb68a3 AS |
119 | }; |
120 | ||
121 | static void __init edb93xx_register_spi(void) | |
122 | { | |
123 | if (machine_is_edb9301() || machine_is_edb9302()) | |
124 | edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1; | |
125 | else if (machine_is_edb9302a() || machine_is_edb9307a()) | |
126 | edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2); | |
127 | else if (machine_is_edb9315a()) | |
128 | edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14; | |
129 | ||
1dfbf334 | 130 | gpiod_add_lookup_table(&edb93xx_spi_cs_gpio_table); |
31bb68a3 AS |
131 | ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info, |
132 | ARRAY_SIZE(edb93xx_spi_board_info)); | |
133 | } | |
134 | ||
135 | ||
136 | /************************************************************************* | |
137 | * EDB93xx I2S | |
138 | *************************************************************************/ | |
075b20b0 MW |
139 | static struct platform_device edb93xx_audio_device = { |
140 | .name = "edb93xx-audio", | |
141 | .id = -1, | |
142 | }; | |
143 | ||
31bb68a3 AS |
144 | static int __init edb93xx_has_audio(void) |
145 | { | |
146 | return (machine_is_edb9301() || machine_is_edb9302() || | |
147 | machine_is_edb9302a() || machine_is_edb9307a() || | |
148 | machine_is_edb9315a()); | |
149 | } | |
150 | ||
151 | static void __init edb93xx_register_i2s(void) | |
152 | { | |
153 | if (edb93xx_has_audio()) { | |
154 | ep93xx_register_i2s(); | |
075b20b0 | 155 | platform_device_register(&edb93xx_audio_device); |
31bb68a3 AS |
156 | } |
157 | } | |
158 | ||
159 | ||
1fbd972a HS |
160 | /************************************************************************* |
161 | * EDB93xx pwm | |
162 | *************************************************************************/ | |
163 | static void __init edb93xx_register_pwm(void) | |
164 | { | |
165 | if (machine_is_edb9301() || | |
166 | machine_is_edb9302() || machine_is_edb9302a()) { | |
167 | /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */ | |
168 | ep93xx_register_pwm(0, 1); | |
169 | } else if (machine_is_edb9307() || machine_is_edb9307a()) { | |
170 | /* EP9307 only has pwm.0 (PWMOUT) */ | |
171 | ep93xx_register_pwm(1, 0); | |
172 | } else { | |
173 | /* EP9312 and EP9315 have both */ | |
174 | ep93xx_register_pwm(1, 1); | |
175 | } | |
176 | } | |
177 | ||
178 | ||
13055192 HS |
179 | /************************************************************************* |
180 | * EDB93xx framebuffer | |
181 | *************************************************************************/ | |
182 | static struct ep93xxfb_mach_info __initdata edb93xxfb_info = { | |
13055192 HS |
183 | .flags = 0, |
184 | }; | |
185 | ||
186 | static int __init edb93xx_has_fb(void) | |
187 | { | |
188 | /* These platforms have an ep93xx with video capability */ | |
189 | return machine_is_edb9307() || machine_is_edb9307a() || | |
190 | machine_is_edb9312() || machine_is_edb9315() || | |
191 | machine_is_edb9315a(); | |
192 | } | |
193 | ||
194 | static void __init edb93xx_register_fb(void) | |
195 | { | |
196 | if (!edb93xx_has_fb()) | |
197 | return; | |
198 | ||
199 | if (machine_is_edb9307a() || machine_is_edb9315a()) | |
200 | edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0; | |
201 | else | |
202 | edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3; | |
203 | ||
204 | ep93xx_register_fb(&edb93xxfb_info); | |
205 | } | |
206 | ||
207 | ||
762be297 RP |
208 | /************************************************************************* |
209 | * EDB93xx IDE | |
210 | *************************************************************************/ | |
211 | static int __init edb93xx_has_ide(void) | |
212 | { | |
213 | /* | |
214 | * Although EDB9312 and EDB9315 do have IDE capability, they have | |
215 | * INTRQ line wired as pull-up, which makes using IDE interface | |
216 | * problematic. | |
217 | */ | |
218 | return machine_is_edb9312() || machine_is_edb9315() || | |
219 | machine_is_edb9315a(); | |
220 | } | |
221 | ||
222 | static void __init edb93xx_register_ide(void) | |
223 | { | |
224 | if (!edb93xx_has_ide()) | |
225 | return; | |
226 | ||
227 | ep93xx_register_ide(); | |
228 | } | |
229 | ||
230 | ||
a2bd40d2 HS |
231 | static void __init edb93xx_init_machine(void) |
232 | { | |
233 | ep93xx_init_devices(); | |
234 | edb93xx_register_flash(); | |
235 | ep93xx_register_eth(&edb93xx_eth_data, 1); | |
236 | edb93xx_register_i2c(); | |
31bb68a3 AS |
237 | edb93xx_register_spi(); |
238 | edb93xx_register_i2s(); | |
1fbd972a | 239 | edb93xx_register_pwm(); |
13055192 | 240 | edb93xx_register_fb(); |
762be297 | 241 | edb93xx_register_ide(); |
57f3b7c7 | 242 | ep93xx_register_adc(); |
a2bd40d2 HS |
243 | } |
244 | ||
245 | ||
246 | #ifdef CONFIG_MACH_EDB9301 | |
247 | MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board") | |
248 | /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ | |
e562cf17 | 249 | .atag_offset = 0x100, |
a2bd40d2 HS |
250 | .map_io = ep93xx_map_io, |
251 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 252 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 253 | .init_machine = edb93xx_init_machine, |
c914283f | 254 | .init_late = ep93xx_init_late, |
3275166e | 255 | .restart = ep93xx_restart, |
a2bd40d2 HS |
256 | MACHINE_END |
257 | #endif | |
258 | ||
259 | #ifdef CONFIG_MACH_EDB9302 | |
260 | MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board") | |
261 | /* Maintainer: George Kashperko <george@chas.com.ua> */ | |
e562cf17 | 262 | .atag_offset = 0x100, |
a2bd40d2 HS |
263 | .map_io = ep93xx_map_io, |
264 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 265 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 266 | .init_machine = edb93xx_init_machine, |
c914283f | 267 | .init_late = ep93xx_init_late, |
3275166e | 268 | .restart = ep93xx_restart, |
a2bd40d2 HS |
269 | MACHINE_END |
270 | #endif | |
271 | ||
272 | #ifdef CONFIG_MACH_EDB9302A | |
273 | MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board") | |
274 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
e562cf17 | 275 | .atag_offset = 0x100, |
a2bd40d2 HS |
276 | .map_io = ep93xx_map_io, |
277 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 278 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 279 | .init_machine = edb93xx_init_machine, |
c914283f | 280 | .init_late = ep93xx_init_late, |
3275166e | 281 | .restart = ep93xx_restart, |
a2bd40d2 HS |
282 | MACHINE_END |
283 | #endif | |
284 | ||
285 | #ifdef CONFIG_MACH_EDB9307 | |
286 | MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board") | |
287 | /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */ | |
e562cf17 | 288 | .atag_offset = 0x100, |
a2bd40d2 HS |
289 | .map_io = ep93xx_map_io, |
290 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 291 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 292 | .init_machine = edb93xx_init_machine, |
c914283f | 293 | .init_late = ep93xx_init_late, |
3275166e | 294 | .restart = ep93xx_restart, |
a2bd40d2 HS |
295 | MACHINE_END |
296 | #endif | |
297 | ||
298 | #ifdef CONFIG_MACH_EDB9307A | |
299 | MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board") | |
300 | /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ | |
e562cf17 | 301 | .atag_offset = 0x100, |
a2bd40d2 HS |
302 | .map_io = ep93xx_map_io, |
303 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 304 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 305 | .init_machine = edb93xx_init_machine, |
c914283f | 306 | .init_late = ep93xx_init_late, |
3275166e | 307 | .restart = ep93xx_restart, |
a2bd40d2 HS |
308 | MACHINE_END |
309 | #endif | |
310 | ||
311 | #ifdef CONFIG_MACH_EDB9312 | |
312 | MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board") | |
313 | /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */ | |
e562cf17 | 314 | .atag_offset = 0x100, |
a2bd40d2 HS |
315 | .map_io = ep93xx_map_io, |
316 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 317 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 318 | .init_machine = edb93xx_init_machine, |
c914283f | 319 | .init_late = ep93xx_init_late, |
3275166e | 320 | .restart = ep93xx_restart, |
a2bd40d2 HS |
321 | MACHINE_END |
322 | #endif | |
323 | ||
324 | #ifdef CONFIG_MACH_EDB9315 | |
325 | MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board") | |
326 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
e562cf17 | 327 | .atag_offset = 0x100, |
a2bd40d2 HS |
328 | .map_io = ep93xx_map_io, |
329 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 330 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 331 | .init_machine = edb93xx_init_machine, |
c914283f | 332 | .init_late = ep93xx_init_late, |
3275166e | 333 | .restart = ep93xx_restart, |
a2bd40d2 HS |
334 | MACHINE_END |
335 | #endif | |
336 | ||
337 | #ifdef CONFIG_MACH_EDB9315A | |
338 | MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board") | |
339 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
e562cf17 | 340 | .atag_offset = 0x100, |
a2bd40d2 HS |
341 | .map_io = ep93xx_map_io, |
342 | .init_irq = ep93xx_init_irq, | |
6bb27d73 | 343 | .init_time = ep93xx_timer_init, |
a2bd40d2 | 344 | .init_machine = edb93xx_init_machine, |
c914283f | 345 | .init_late = ep93xx_init_late, |
3275166e | 346 | .restart = ep93xx_restart, |
a2bd40d2 HS |
347 | MACHINE_END |
348 | #endif |