2 * arch/arm/mach-ep93xx/edb93xx.c
3 * Cirrus Logic EDB93xx Development Board support.
5 * EDB93XX, EDB9301, EDB9307A
6 * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com>
9 * Copyright (C) 2006 George Kashperko <george@chas.com.ua>
11 * EDB9302A, EDB9315, EDB9315A
12 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
15 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
18 * Copyright (C) 2006 Infosys Technologies Limited
19 * Toufeeq Hussain <toufeeq_hussain@infosys.com>
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.
27 #include <linux/kernel.h>
28 #include <linux/init.h>
29 #include <linux/platform_device.h>
30 #include <linux/i2c.h>
31 #include <linux/spi/spi.h>
32 #include <linux/gpio/machine.h>
34 #include <sound/cs4271.h>
36 #include <mach/hardware.h>
37 #include <linux/platform_data/video-ep93xx.h>
38 #include <linux/platform_data/spi-ep93xx.h>
39 #include <mach/gpio-ep93xx.h>
41 #include <asm/mach-types.h>
42 #include <asm/mach/arch.h>
46 static void __init edb93xx_register_flash(void)
48 if (machine_is_edb9307() || machine_is_edb9312() ||
49 machine_is_edb9315()) {
50 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
52 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
56 static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
61 /*************************************************************************
62 * EDB93xx i2c peripheral handling
63 *************************************************************************/
65 static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
67 I2C_BOARD_INFO("isl1208", 0x6f),
71 static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
73 I2C_BOARD_INFO("ds1337", 0x68),
77 static void __init edb93xx_register_i2c(void)
79 if (machine_is_edb9302a() || machine_is_edb9307a() ||
80 machine_is_edb9315a()) {
81 ep93xx_register_i2c(edb93xxa_i2c_board_info,
82 ARRAY_SIZE(edb93xxa_i2c_board_info));
83 } else if (machine_is_edb9302() || machine_is_edb9307()
84 || machine_is_edb9312() || machine_is_edb9315()) {
85 ep93xx_register_i2c(edb93xx_i2c_board_info,
86 ARRAY_SIZE(edb93xx_i2c_board_info));
91 /*************************************************************************
92 * EDB93xx SPI peripheral handling
93 *************************************************************************/
94 static struct cs4271_platform_data edb93xx_cs4271_data = {
95 .gpio_nreset = -EINVAL, /* filled in later */
98 static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
100 .modalias = "cs4271",
101 .platform_data = &edb93xx_cs4271_data,
102 .max_speed_hz = 6000000,
109 static struct gpiod_lookup_table edb93xx_spi_cs_gpio_table = {
110 .dev_id = "ep93xx-spi.0",
112 GPIO_LOOKUP("A", 6, "cs", GPIO_ACTIVE_LOW),
117 static struct ep93xx_spi_info edb93xx_spi_info __initdata = {
118 /* Intentionally left blank */
121 static void __init edb93xx_register_spi(void)
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;
130 gpiod_add_lookup_table(&edb93xx_spi_cs_gpio_table);
131 ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
132 ARRAY_SIZE(edb93xx_spi_board_info));
136 /*************************************************************************
138 *************************************************************************/
139 static struct platform_device edb93xx_audio_device = {
140 .name = "edb93xx-audio",
144 static int __init edb93xx_has_audio(void)
146 return (machine_is_edb9301() || machine_is_edb9302() ||
147 machine_is_edb9302a() || machine_is_edb9307a() ||
148 machine_is_edb9315a());
151 static void __init edb93xx_register_i2s(void)
153 if (edb93xx_has_audio()) {
154 ep93xx_register_i2s();
155 platform_device_register(&edb93xx_audio_device);
160 /*************************************************************************
162 *************************************************************************/
163 static void __init edb93xx_register_pwm(void)
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);
173 /* EP9312 and EP9315 have both */
174 ep93xx_register_pwm(1, 1);
179 /*************************************************************************
180 * EDB93xx framebuffer
181 *************************************************************************/
182 static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
186 static int __init edb93xx_has_fb(void)
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();
194 static void __init edb93xx_register_fb(void)
196 if (!edb93xx_has_fb())
199 if (machine_is_edb9307a() || machine_is_edb9315a())
200 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
202 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
204 ep93xx_register_fb(&edb93xxfb_info);
208 /*************************************************************************
210 *************************************************************************/
211 static int __init edb93xx_has_ide(void)
214 * Although EDB9312 and EDB9315 do have IDE capability, they have
215 * INTRQ line wired as pull-up, which makes using IDE interface
218 return machine_is_edb9312() || machine_is_edb9315() ||
219 machine_is_edb9315a();
222 static void __init edb93xx_register_ide(void)
224 if (!edb93xx_has_ide())
227 ep93xx_register_ide();
231 static void __init edb93xx_init_machine(void)
233 ep93xx_init_devices();
234 edb93xx_register_flash();
235 ep93xx_register_eth(&edb93xx_eth_data, 1);
236 edb93xx_register_i2c();
237 edb93xx_register_spi();
238 edb93xx_register_i2s();
239 edb93xx_register_pwm();
240 edb93xx_register_fb();
241 edb93xx_register_ide();
242 ep93xx_register_adc();
246 #ifdef CONFIG_MACH_EDB9301
247 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
248 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
249 .atag_offset = 0x100,
250 .map_io = ep93xx_map_io,
251 .init_irq = ep93xx_init_irq,
252 .init_time = ep93xx_timer_init,
253 .init_machine = edb93xx_init_machine,
254 .init_late = ep93xx_init_late,
255 .restart = ep93xx_restart,
259 #ifdef CONFIG_MACH_EDB9302
260 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
261 /* Maintainer: George Kashperko <george@chas.com.ua> */
262 .atag_offset = 0x100,
263 .map_io = ep93xx_map_io,
264 .init_irq = ep93xx_init_irq,
265 .init_time = ep93xx_timer_init,
266 .init_machine = edb93xx_init_machine,
267 .init_late = ep93xx_init_late,
268 .restart = ep93xx_restart,
272 #ifdef CONFIG_MACH_EDB9302A
273 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
274 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
275 .atag_offset = 0x100,
276 .map_io = ep93xx_map_io,
277 .init_irq = ep93xx_init_irq,
278 .init_time = ep93xx_timer_init,
279 .init_machine = edb93xx_init_machine,
280 .init_late = ep93xx_init_late,
281 .restart = ep93xx_restart,
285 #ifdef CONFIG_MACH_EDB9307
286 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
287 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
288 .atag_offset = 0x100,
289 .map_io = ep93xx_map_io,
290 .init_irq = ep93xx_init_irq,
291 .init_time = ep93xx_timer_init,
292 .init_machine = edb93xx_init_machine,
293 .init_late = ep93xx_init_late,
294 .restart = ep93xx_restart,
298 #ifdef CONFIG_MACH_EDB9307A
299 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
300 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
301 .atag_offset = 0x100,
302 .map_io = ep93xx_map_io,
303 .init_irq = ep93xx_init_irq,
304 .init_time = ep93xx_timer_init,
305 .init_machine = edb93xx_init_machine,
306 .init_late = ep93xx_init_late,
307 .restart = ep93xx_restart,
311 #ifdef CONFIG_MACH_EDB9312
312 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
313 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
314 .atag_offset = 0x100,
315 .map_io = ep93xx_map_io,
316 .init_irq = ep93xx_init_irq,
317 .init_time = ep93xx_timer_init,
318 .init_machine = edb93xx_init_machine,
319 .init_late = ep93xx_init_late,
320 .restart = ep93xx_restart,
324 #ifdef CONFIG_MACH_EDB9315
325 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
326 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
327 .atag_offset = 0x100,
328 .map_io = ep93xx_map_io,
329 .init_irq = ep93xx_init_irq,
330 .init_time = ep93xx_timer_init,
331 .init_machine = edb93xx_init_machine,
332 .init_late = ep93xx_init_late,
333 .restart = ep93xx_restart,
337 #ifdef CONFIG_MACH_EDB9315A
338 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
339 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
340 .atag_offset = 0x100,
341 .map_io = ep93xx_map_io,
342 .init_irq = ep93xx_init_irq,
343 .init_time = ep93xx_timer_init,
344 .init_machine = edb93xx_init_machine,
345 .init_late = ep93xx_init_late,
346 .restart = ep93xx_restart,