blob: 7a7f280b07d75af54b6fec1e32b84384a3c6ad25 [file] [log] [blame]
Hartley Sweetena2bd40d2009-05-04 19:09:25 +01001/*
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>
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010029#include <linux/platform_device.h>
Hartley Sweeten6531a992009-10-08 00:45:00 +010030#include <linux/i2c.h>
31#include <linux/i2c-gpio.h>
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +010032#include <linux/spi/spi.h>
33
34#include <sound/cs4271.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010035
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010036#include <mach/hardware.h>
Arnd Bergmanna3b29242012-08-24 15:12:11 +020037#include <linux/platform_data/video-ep93xx.h>
38#include <linux/platform_data/spi-ep93xx.h>
Linus Walleijbd5f12a2011-09-22 08:07:00 +010039#include <mach/gpio-ep93xx.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010040
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010041#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43
Ryan Mallon258249e2012-01-11 09:06:08 +110044#include "soc.h"
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010045
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010046static void __init edb93xx_register_flash(void)
47{
48 if (machine_is_edb9307() || machine_is_edb9312() ||
49 machine_is_edb9315()) {
Hartley Sweeten16bcf782010-06-10 16:19:08 +010050 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010051 } else {
Hartley Sweeten16bcf782010-06-10 16:19:08 +010052 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010053 }
54}
55
Hartley Sweetenb370e082010-03-18 18:04:06 +010056static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010057 .phy_id = 1,
58};
59
Hartley Sweeten6531a992009-10-08 00:45:00 +010060
61/*************************************************************************
62 * EDB93xx i2c peripheral handling
63 *************************************************************************/
Hartley Sweetenb370e082010-03-18 18:04:06 +010064static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
Hartley Sweeten6531a992009-10-08 00:45:00 +010065 .sda_pin = EP93XX_GPIO_LINE_EEDAT,
66 .sda_is_open_drain = 0,
67 .scl_pin = EP93XX_GPIO_LINE_EECLK,
68 .scl_is_open_drain = 0,
69 .udelay = 0, /* default to 100 kHz */
70 .timeout = 0, /* default to 100 ms */
71};
72
73static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010074 {
75 I2C_BOARD_INFO("isl1208", 0x6f),
76 },
77};
78
Hartley Sweeten6531a992009-10-08 00:45:00 +010079static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010080 {
81 I2C_BOARD_INFO("ds1337", 0x68),
82 },
83};
84
85static void __init edb93xx_register_i2c(void)
86{
87 if (machine_is_edb9302a() || machine_is_edb9307a() ||
88 machine_is_edb9315a()) {
Hartley Sweeten6531a992009-10-08 00:45:00 +010089 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
90 edb93xxa_i2c_board_info,
91 ARRAY_SIZE(edb93xxa_i2c_board_info));
Todor Colov688df8f2012-06-10 15:44:08 +030092 } else if (machine_is_edb9302() || machine_is_edb9307()
93 || machine_is_edb9312() || machine_is_edb9315()) {
Hartley Sweeten3d977c02009-10-14 01:56:10 +010094 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
Hartley Sweeten6531a992009-10-08 00:45:00 +010095 edb93xx_i2c_board_info,
96 ARRAY_SIZE(edb93xx_i2c_board_info));
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010097 }
98}
99
Hartley Sweeten1fbd9722010-01-11 21:38:00 +0100100
101/*************************************************************************
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100102 * EDB93xx SPI peripheral handling
103 *************************************************************************/
104static struct cs4271_platform_data edb93xx_cs4271_data = {
105 .gpio_nreset = -EINVAL, /* filled in later */
106};
107
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100108static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
109 {
110 .modalias = "cs4271",
111 .platform_data = &edb93xx_cs4271_data,
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100112 .max_speed_hz = 6000000,
113 .bus_num = 0,
114 .chip_select = 0,
115 .mode = SPI_MODE_3,
116 },
117};
118
H Hartley Sweeten55f0cd3f2017-02-16 13:07:37 -0700119static int edb93xx_spi_chipselects[] __initdata = {
120 EP93XX_GPIO_LINE_EGPIO6,
121};
122
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100123static struct ep93xx_spi_info edb93xx_spi_info __initdata = {
H Hartley Sweeten55f0cd3f2017-02-16 13:07:37 -0700124 .chipselect = edb93xx_spi_chipselects,
125 .num_chipselect = ARRAY_SIZE(edb93xx_spi_chipselects),
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100126};
127
128static void __init edb93xx_register_spi(void)
129{
130 if (machine_is_edb9301() || machine_is_edb9302())
131 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1;
132 else if (machine_is_edb9302a() || machine_is_edb9307a())
133 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2);
134 else if (machine_is_edb9315a())
135 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14;
136
137 ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
138 ARRAY_SIZE(edb93xx_spi_board_info));
139}
140
141
142/*************************************************************************
143 * EDB93xx I2S
144 *************************************************************************/
Mika Westerberg075b20b2011-09-11 12:28:54 +0300145static struct platform_device edb93xx_audio_device = {
146 .name = "edb93xx-audio",
147 .id = -1,
148};
149
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100150static int __init edb93xx_has_audio(void)
151{
152 return (machine_is_edb9301() || machine_is_edb9302() ||
153 machine_is_edb9302a() || machine_is_edb9307a() ||
154 machine_is_edb9315a());
155}
156
157static void __init edb93xx_register_i2s(void)
158{
159 if (edb93xx_has_audio()) {
160 ep93xx_register_i2s();
Mika Westerberg075b20b2011-09-11 12:28:54 +0300161 platform_device_register(&edb93xx_audio_device);
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100162 }
163}
164
165
166/*************************************************************************
Hartley Sweeten1fbd9722010-01-11 21:38:00 +0100167 * EDB93xx pwm
168 *************************************************************************/
169static void __init edb93xx_register_pwm(void)
170{
171 if (machine_is_edb9301() ||
172 machine_is_edb9302() || machine_is_edb9302a()) {
173 /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
174 ep93xx_register_pwm(0, 1);
175 } else if (machine_is_edb9307() || machine_is_edb9307a()) {
176 /* EP9307 only has pwm.0 (PWMOUT) */
177 ep93xx_register_pwm(1, 0);
178 } else {
179 /* EP9312 and EP9315 have both */
180 ep93xx_register_pwm(1, 1);
181 }
182}
183
184
Hartley Sweeten13055192011-01-27 17:50:53 +0100185/*************************************************************************
186 * EDB93xx framebuffer
187 *************************************************************************/
188static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
Hartley Sweeten13055192011-01-27 17:50:53 +0100189 .flags = 0,
190};
191
192static int __init edb93xx_has_fb(void)
193{
194 /* These platforms have an ep93xx with video capability */
195 return machine_is_edb9307() || machine_is_edb9307a() ||
196 machine_is_edb9312() || machine_is_edb9315() ||
197 machine_is_edb9315a();
198}
199
200static void __init edb93xx_register_fb(void)
201{
202 if (!edb93xx_has_fb())
203 return;
204
205 if (machine_is_edb9307a() || machine_is_edb9315a())
206 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
207 else
208 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
209
210 ep93xx_register_fb(&edb93xxfb_info);
211}
212
213
Rafal Prylowski762be292012-04-12 14:15:15 +0200214/*************************************************************************
215 * EDB93xx IDE
216 *************************************************************************/
217static int __init edb93xx_has_ide(void)
218{
219 /*
220 * Although EDB9312 and EDB9315 do have IDE capability, they have
221 * INTRQ line wired as pull-up, which makes using IDE interface
222 * problematic.
223 */
224 return machine_is_edb9312() || machine_is_edb9315() ||
225 machine_is_edb9315a();
226}
227
228static void __init edb93xx_register_ide(void)
229{
230 if (!edb93xx_has_ide())
231 return;
232
233 ep93xx_register_ide();
234}
235
236
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100237static void __init edb93xx_init_machine(void)
238{
239 ep93xx_init_devices();
240 edb93xx_register_flash();
241 ep93xx_register_eth(&edb93xx_eth_data, 1);
242 edb93xx_register_i2c();
Alexander Sverdlin31bb68a2011-03-03 10:53:52 +0100243 edb93xx_register_spi();
244 edb93xx_register_i2s();
Hartley Sweeten1fbd9722010-01-11 21:38:00 +0100245 edb93xx_register_pwm();
Hartley Sweeten13055192011-01-27 17:50:53 +0100246 edb93xx_register_fb();
Rafal Prylowski762be292012-04-12 14:15:15 +0200247 edb93xx_register_ide();
Alexander Sverdlin57f3b7c2015-11-22 09:52:03 +0100248 ep93xx_register_adc();
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100249}
250
251
252#ifdef CONFIG_MACH_EDB9301
253MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
254 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400255 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100256 .map_io = ep93xx_map_io,
257 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700258 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100259 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800260 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000261 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100262MACHINE_END
263#endif
264
265#ifdef CONFIG_MACH_EDB9302
266MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
267 /* Maintainer: George Kashperko <george@chas.com.ua> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400268 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100269 .map_io = ep93xx_map_io,
270 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700271 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100272 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800273 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000274 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100275MACHINE_END
276#endif
277
278#ifdef CONFIG_MACH_EDB9302A
279MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
280 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400281 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100282 .map_io = ep93xx_map_io,
283 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700284 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100285 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800286 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000287 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100288MACHINE_END
289#endif
290
291#ifdef CONFIG_MACH_EDB9307
292MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
293 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400294 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100295 .map_io = ep93xx_map_io,
296 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700297 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100298 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800299 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000300 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100301MACHINE_END
302#endif
303
304#ifdef CONFIG_MACH_EDB9307A
305MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
306 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400307 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100308 .map_io = ep93xx_map_io,
309 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700310 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100311 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800312 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000313 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100314MACHINE_END
315#endif
316
317#ifdef CONFIG_MACH_EDB9312
318MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
319 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400320 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100321 .map_io = ep93xx_map_io,
322 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700323 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100324 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800325 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000326 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100327MACHINE_END
328#endif
329
330#ifdef CONFIG_MACH_EDB9315
331MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
332 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400333 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100334 .map_io = ep93xx_map_io,
335 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700336 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100337 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800338 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000339 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100340MACHINE_END
341#endif
342
343#ifdef CONFIG_MACH_EDB9315A
344MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
345 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
Nicolas Pitree562cf12011-07-05 22:38:11 -0400346 .atag_offset = 0x100,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100347 .map_io = ep93xx_map_io,
348 .init_irq = ep93xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700349 .init_time = ep93xx_timer_init,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100350 .init_machine = edb93xx_init_machine,
Shawn Guoc9142832012-04-26 10:05:15 +0800351 .init_late = ep93xx_init_late,
Russell King32751662011-11-05 09:54:14 +0000352 .restart = ep93xx_restart,
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100353MACHINE_END
354#endif