1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * arch/arm/mach-ep93xx/edb93xx.c
4 * Cirrus Logic EDB93xx Development Board support.
6 * EDB93XX, EDB9301, EDB9307A
7 * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com>
10 * Copyright (C) 2006 George Kashperko <george@chas.com.ua>
12 * EDB9302A, EDB9315, EDB9315A
13 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
16 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
19 * Copyright (C) 2006 Infosys Technologies Limited
20 * Toufeeq Hussain <toufeeq_hussain@infosys.com>
23 #include <linux/kernel.h>
24 #include <linux/init.h>
25 #include <linux/platform_device.h>
26 #include <linux/i2c.h>
27 #include <linux/spi/spi.h>
28 #include <linux/gpio/machine.h>
30 #include <sound/cs4271.h>
33 #include <linux/platform_data/video-ep93xx.h>
34 #include <linux/platform_data/spi-ep93xx.h>
35 #include "gpio-ep93xx.h"
37 #include <asm/mach-types.h>
38 #include <asm/mach/arch.h>
42 static void __init edb93xx_register_flash(void)
44 if (machine_is_edb9307() || machine_is_edb9312() ||
45 machine_is_edb9315()) {
46 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
48 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
52 static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
57 /*************************************************************************
58 * EDB93xx i2c peripheral handling
59 *************************************************************************/
61 static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
63 I2C_BOARD_INFO("isl1208", 0x6f),
67 static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
69 I2C_BOARD_INFO("ds1337", 0x68),
73 static void __init edb93xx_register_i2c(void)
75 if (machine_is_edb9302a() || machine_is_edb9307a() ||
76 machine_is_edb9315a()) {
77 ep93xx_register_i2c(edb93xxa_i2c_board_info,
78 ARRAY_SIZE(edb93xxa_i2c_board_info));
79 } else if (machine_is_edb9302() || machine_is_edb9307()
80 || machine_is_edb9312() || machine_is_edb9315()) {
81 ep93xx_register_i2c(edb93xx_i2c_board_info,
82 ARRAY_SIZE(edb93xx_i2c_board_info));
87 /*************************************************************************
88 * EDB93xx SPI peripheral handling
89 *************************************************************************/
90 static struct cs4271_platform_data edb93xx_cs4271_data = {
91 .gpio_nreset = -EINVAL, /* filled in later */
94 static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
97 .platform_data = &edb93xx_cs4271_data,
98 .max_speed_hz = 6000000,
105 static struct gpiod_lookup_table edb93xx_spi_cs_gpio_table = {
108 GPIO_LOOKUP("A", 6, "cs", GPIO_ACTIVE_LOW),
113 static struct ep93xx_spi_info edb93xx_spi_info __initdata = {
114 /* Intentionally left blank */
117 static void __init edb93xx_register_spi(void)
119 if (machine_is_edb9301() || machine_is_edb9302())
120 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1;
121 else if (machine_is_edb9302a() || machine_is_edb9307a())
122 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2);
123 else if (machine_is_edb9315a())
124 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14;
126 gpiod_add_lookup_table(&edb93xx_spi_cs_gpio_table);
127 ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
128 ARRAY_SIZE(edb93xx_spi_board_info));
132 /*************************************************************************
134 *************************************************************************/
135 static struct platform_device edb93xx_audio_device = {
136 .name = "edb93xx-audio",
140 static int __init edb93xx_has_audio(void)
142 return (machine_is_edb9301() || machine_is_edb9302() ||
143 machine_is_edb9302a() || machine_is_edb9307a() ||
144 machine_is_edb9315a());
147 static void __init edb93xx_register_i2s(void)
149 if (edb93xx_has_audio()) {
150 ep93xx_register_i2s();
151 platform_device_register(&edb93xx_audio_device);
156 /*************************************************************************
158 *************************************************************************/
159 static void __init edb93xx_register_pwm(void)
161 if (machine_is_edb9301() ||
162 machine_is_edb9302() || machine_is_edb9302a()) {
163 /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
164 ep93xx_register_pwm(0, 1);
165 } else if (machine_is_edb9307() || machine_is_edb9307a()) {
166 /* EP9307 only has pwm.0 (PWMOUT) */
167 ep93xx_register_pwm(1, 0);
169 /* EP9312 and EP9315 have both */
170 ep93xx_register_pwm(1, 1);
175 /*************************************************************************
176 * EDB93xx framebuffer
177 *************************************************************************/
178 static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
182 static int __init edb93xx_has_fb(void)
184 /* These platforms have an ep93xx with video capability */
185 return machine_is_edb9307() || machine_is_edb9307a() ||
186 machine_is_edb9312() || machine_is_edb9315() ||
187 machine_is_edb9315a();
190 static void __init edb93xx_register_fb(void)
192 if (!edb93xx_has_fb())
195 if (machine_is_edb9307a() || machine_is_edb9315a())
196 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
198 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
200 ep93xx_register_fb(&edb93xxfb_info);
204 /*************************************************************************
206 *************************************************************************/
207 static int __init edb93xx_has_ide(void)
210 * Although EDB9312 and EDB9315 do have IDE capability, they have
211 * INTRQ line wired as pull-up, which makes using IDE interface
214 return machine_is_edb9312() || machine_is_edb9315() ||
215 machine_is_edb9315a();
218 static void __init edb93xx_register_ide(void)
220 if (!edb93xx_has_ide())
223 ep93xx_register_ide();
227 static void __init edb93xx_init_machine(void)
229 ep93xx_init_devices();
230 edb93xx_register_flash();
231 ep93xx_register_eth(&edb93xx_eth_data, 1);
232 edb93xx_register_i2c();
233 edb93xx_register_spi();
234 edb93xx_register_i2s();
235 edb93xx_register_pwm();
236 edb93xx_register_fb();
237 edb93xx_register_ide();
238 ep93xx_register_adc();
242 #ifdef CONFIG_MACH_EDB9301
243 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
244 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
245 .atag_offset = 0x100,
246 .map_io = ep93xx_map_io,
247 .init_irq = ep93xx_init_irq,
248 .init_time = ep93xx_timer_init,
249 .init_machine = edb93xx_init_machine,
250 .restart = ep93xx_restart,
254 #ifdef CONFIG_MACH_EDB9302
255 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
256 /* Maintainer: George Kashperko <george@chas.com.ua> */
257 .atag_offset = 0x100,
258 .map_io = ep93xx_map_io,
259 .init_irq = ep93xx_init_irq,
260 .init_time = ep93xx_timer_init,
261 .init_machine = edb93xx_init_machine,
262 .restart = ep93xx_restart,
266 #ifdef CONFIG_MACH_EDB9302A
267 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
268 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
269 .atag_offset = 0x100,
270 .map_io = ep93xx_map_io,
271 .init_irq = ep93xx_init_irq,
272 .init_time = ep93xx_timer_init,
273 .init_machine = edb93xx_init_machine,
274 .restart = ep93xx_restart,
278 #ifdef CONFIG_MACH_EDB9307
279 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
280 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
281 .atag_offset = 0x100,
282 .map_io = ep93xx_map_io,
283 .init_irq = ep93xx_init_irq,
284 .init_time = ep93xx_timer_init,
285 .init_machine = edb93xx_init_machine,
286 .restart = ep93xx_restart,
290 #ifdef CONFIG_MACH_EDB9307A
291 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
292 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
293 .atag_offset = 0x100,
294 .map_io = ep93xx_map_io,
295 .init_irq = ep93xx_init_irq,
296 .init_time = ep93xx_timer_init,
297 .init_machine = edb93xx_init_machine,
298 .restart = ep93xx_restart,
302 #ifdef CONFIG_MACH_EDB9312
303 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
304 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
305 .atag_offset = 0x100,
306 .map_io = ep93xx_map_io,
307 .init_irq = ep93xx_init_irq,
308 .init_time = ep93xx_timer_init,
309 .init_machine = edb93xx_init_machine,
310 .restart = ep93xx_restart,
314 #ifdef CONFIG_MACH_EDB9315
315 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
316 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
317 .atag_offset = 0x100,
318 .map_io = ep93xx_map_io,
319 .init_irq = ep93xx_init_irq,
320 .init_time = ep93xx_timer_init,
321 .init_machine = edb93xx_init_machine,
322 .restart = ep93xx_restart,
326 #ifdef CONFIG_MACH_EDB9315A
327 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
328 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
329 .atag_offset = 0x100,
330 .map_io = ep93xx_map_io,
331 .init_irq = ep93xx_init_irq,
332 .init_time = ep93xx_timer_init,
333 .init_machine = edb93xx_init_machine,
334 .restart = ep93xx_restart,