blob: fad371df40edfe75164f522d0432bbad809f10dc [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/gpio.h>
31#include <linux/i2c.h>
32#include <linux/i2c-gpio.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010033
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010034#include <mach/hardware.h>
Hartley Sweeten13055192011-01-27 17:50:53 +010035#include <mach/fb.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010036
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010037#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010040
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010041static void __init edb93xx_register_flash(void)
42{
43 if (machine_is_edb9307() || machine_is_edb9312() ||
44 machine_is_edb9315()) {
Hartley Sweeten16bcf782010-06-10 16:19:08 +010045 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010046 } else {
Hartley Sweeten16bcf782010-06-10 16:19:08 +010047 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010048 }
49}
50
Hartley Sweetenb370e082010-03-18 18:04:06 +010051static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010052 .phy_id = 1,
53};
54
Hartley Sweeten6531a992009-10-08 00:45:00 +010055
56/*************************************************************************
57 * EDB93xx i2c peripheral handling
58 *************************************************************************/
Hartley Sweetenb370e082010-03-18 18:04:06 +010059static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
Hartley Sweeten6531a992009-10-08 00:45:00 +010060 .sda_pin = EP93XX_GPIO_LINE_EEDAT,
61 .sda_is_open_drain = 0,
62 .scl_pin = EP93XX_GPIO_LINE_EECLK,
63 .scl_is_open_drain = 0,
64 .udelay = 0, /* default to 100 kHz */
65 .timeout = 0, /* default to 100 ms */
66};
67
68static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010069 {
70 I2C_BOARD_INFO("isl1208", 0x6f),
71 },
72};
73
Hartley Sweeten6531a992009-10-08 00:45:00 +010074static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010075 {
76 I2C_BOARD_INFO("ds1337", 0x68),
77 },
78};
79
80static void __init edb93xx_register_i2c(void)
81{
82 if (machine_is_edb9302a() || machine_is_edb9307a() ||
83 machine_is_edb9315a()) {
Hartley Sweeten6531a992009-10-08 00:45:00 +010084 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
85 edb93xxa_i2c_board_info,
86 ARRAY_SIZE(edb93xxa_i2c_board_info));
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010087 } else if (machine_is_edb9307() || machine_is_edb9312() ||
88 machine_is_edb9315()) {
Hartley Sweeten3d977c02009-10-14 01:56:10 +010089 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
Hartley Sweeten6531a992009-10-08 00:45:00 +010090 edb93xx_i2c_board_info,
91 ARRAY_SIZE(edb93xx_i2c_board_info));
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010092 }
93}
94
Hartley Sweeten1fbd9722010-01-11 21:38:00 +010095
96/*************************************************************************
97 * EDB93xx pwm
98 *************************************************************************/
99static void __init edb93xx_register_pwm(void)
100{
101 if (machine_is_edb9301() ||
102 machine_is_edb9302() || machine_is_edb9302a()) {
103 /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
104 ep93xx_register_pwm(0, 1);
105 } else if (machine_is_edb9307() || machine_is_edb9307a()) {
106 /* EP9307 only has pwm.0 (PWMOUT) */
107 ep93xx_register_pwm(1, 0);
108 } else {
109 /* EP9312 and EP9315 have both */
110 ep93xx_register_pwm(1, 1);
111 }
112}
113
114
Hartley Sweeten13055192011-01-27 17:50:53 +0100115/*************************************************************************
116 * EDB93xx framebuffer
117 *************************************************************************/
118static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
119 .num_modes = EP93XXFB_USE_MODEDB,
120 .bpp = 16,
121 .flags = 0,
122};
123
124static int __init edb93xx_has_fb(void)
125{
126 /* These platforms have an ep93xx with video capability */
127 return machine_is_edb9307() || machine_is_edb9307a() ||
128 machine_is_edb9312() || machine_is_edb9315() ||
129 machine_is_edb9315a();
130}
131
132static void __init edb93xx_register_fb(void)
133{
134 if (!edb93xx_has_fb())
135 return;
136
137 if (machine_is_edb9307a() || machine_is_edb9315a())
138 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
139 else
140 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
141
142 ep93xx_register_fb(&edb93xxfb_info);
143}
144
145
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100146static void __init edb93xx_init_machine(void)
147{
148 ep93xx_init_devices();
149 edb93xx_register_flash();
150 ep93xx_register_eth(&edb93xx_eth_data, 1);
151 edb93xx_register_i2c();
Hartley Sweeten1fbd9722010-01-11 21:38:00 +0100152 edb93xx_register_pwm();
Hartley Sweeten13055192011-01-27 17:50:53 +0100153 edb93xx_register_fb();
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100154}
155
156
157#ifdef CONFIG_MACH_EDB9301
158MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
159 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100160 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
161 .map_io = ep93xx_map_io,
162 .init_irq = ep93xx_init_irq,
163 .timer = &ep93xx_timer,
164 .init_machine = edb93xx_init_machine,
165MACHINE_END
166#endif
167
168#ifdef CONFIG_MACH_EDB9302
169MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
170 /* Maintainer: George Kashperko <george@chas.com.ua> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100171 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
172 .map_io = ep93xx_map_io,
173 .init_irq = ep93xx_init_irq,
174 .timer = &ep93xx_timer,
175 .init_machine = edb93xx_init_machine,
176MACHINE_END
177#endif
178
179#ifdef CONFIG_MACH_EDB9302A
180MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
181 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100182 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
183 .map_io = ep93xx_map_io,
184 .init_irq = ep93xx_init_irq,
185 .timer = &ep93xx_timer,
186 .init_machine = edb93xx_init_machine,
187MACHINE_END
188#endif
189
190#ifdef CONFIG_MACH_EDB9307
191MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
192 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100193 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
194 .map_io = ep93xx_map_io,
195 .init_irq = ep93xx_init_irq,
196 .timer = &ep93xx_timer,
197 .init_machine = edb93xx_init_machine,
198MACHINE_END
199#endif
200
201#ifdef CONFIG_MACH_EDB9307A
202MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
203 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100204 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
205 .map_io = ep93xx_map_io,
206 .init_irq = ep93xx_init_irq,
207 .timer = &ep93xx_timer,
208 .init_machine = edb93xx_init_machine,
209MACHINE_END
210#endif
211
212#ifdef CONFIG_MACH_EDB9312
213MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
214 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100215 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
216 .map_io = ep93xx_map_io,
217 .init_irq = ep93xx_init_irq,
218 .timer = &ep93xx_timer,
219 .init_machine = edb93xx_init_machine,
220MACHINE_END
221#endif
222
223#ifdef CONFIG_MACH_EDB9315
224MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
225 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100226 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
227 .map_io = ep93xx_map_io,
228 .init_irq = ep93xx_init_irq,
229 .timer = &ep93xx_timer,
230 .init_machine = edb93xx_init_machine,
231MACHINE_END
232#endif
233
234#ifdef CONFIG_MACH_EDB9315A
235MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
236 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100237 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
238 .map_io = ep93xx_map_io,
239 .init_irq = ep93xx_init_irq,
240 .timer = &ep93xx_timer,
241 .init_machine = edb93xx_init_machine,
242MACHINE_END
243#endif