Merge branch 'idle-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb...
[deliverable/linux.git] / arch / arm / mach-ep93xx / edb93xx.c
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>
29 #include <linux/platform_device.h>
30 #include <linux/gpio.h>
31 #include <linux/i2c.h>
32 #include <linux/i2c-gpio.h>
33 #include <linux/spi/spi.h>
34
35 #include <sound/cs4271.h>
36
37 #include <mach/hardware.h>
38 #include <mach/fb.h>
39 #include <mach/ep93xx_spi.h>
40
41 #include <asm/mach-types.h>
42 #include <asm/mach/arch.h>
43
44
45 static void __init edb93xx_register_flash(void)
46 {
47 if (machine_is_edb9307() || machine_is_edb9312() ||
48 machine_is_edb9315()) {
49 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
50 } else {
51 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
52 }
53 }
54
55 static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
56 .phy_id = 1,
57 };
58
59
60 /*************************************************************************
61 * EDB93xx i2c peripheral handling
62 *************************************************************************/
63 static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
64 .sda_pin = EP93XX_GPIO_LINE_EEDAT,
65 .sda_is_open_drain = 0,
66 .scl_pin = EP93XX_GPIO_LINE_EECLK,
67 .scl_is_open_drain = 0,
68 .udelay = 0, /* default to 100 kHz */
69 .timeout = 0, /* default to 100 ms */
70 };
71
72 static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
73 {
74 I2C_BOARD_INFO("isl1208", 0x6f),
75 },
76 };
77
78 static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
79 {
80 I2C_BOARD_INFO("ds1337", 0x68),
81 },
82 };
83
84 static void __init edb93xx_register_i2c(void)
85 {
86 if (machine_is_edb9302a() || machine_is_edb9307a() ||
87 machine_is_edb9315a()) {
88 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
89 edb93xxa_i2c_board_info,
90 ARRAY_SIZE(edb93xxa_i2c_board_info));
91 } else if (machine_is_edb9307() || machine_is_edb9312() ||
92 machine_is_edb9315()) {
93 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
94 edb93xx_i2c_board_info,
95 ARRAY_SIZE(edb93xx_i2c_board_info));
96 }
97 }
98
99
100 /*************************************************************************
101 * EDB93xx SPI peripheral handling
102 *************************************************************************/
103 static struct cs4271_platform_data edb93xx_cs4271_data = {
104 .gpio_nreset = -EINVAL, /* filled in later */
105 };
106
107 static int edb93xx_cs4271_hw_setup(struct spi_device *spi)
108 {
109 return gpio_request_one(EP93XX_GPIO_LINE_EGPIO6,
110 GPIOF_OUT_INIT_HIGH, spi->modalias);
111 }
112
113 static void edb93xx_cs4271_hw_cleanup(struct spi_device *spi)
114 {
115 gpio_free(EP93XX_GPIO_LINE_EGPIO6);
116 }
117
118 static void edb93xx_cs4271_hw_cs_control(struct spi_device *spi, int value)
119 {
120 gpio_set_value(EP93XX_GPIO_LINE_EGPIO6, value);
121 }
122
123 static struct ep93xx_spi_chip_ops edb93xx_cs4271_hw = {
124 .setup = edb93xx_cs4271_hw_setup,
125 .cleanup = edb93xx_cs4271_hw_cleanup,
126 .cs_control = edb93xx_cs4271_hw_cs_control,
127 };
128
129 static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
130 {
131 .modalias = "cs4271",
132 .platform_data = &edb93xx_cs4271_data,
133 .controller_data = &edb93xx_cs4271_hw,
134 .max_speed_hz = 6000000,
135 .bus_num = 0,
136 .chip_select = 0,
137 .mode = SPI_MODE_3,
138 },
139 };
140
141 static struct ep93xx_spi_info edb93xx_spi_info __initdata = {
142 .num_chipselect = ARRAY_SIZE(edb93xx_spi_board_info),
143 };
144
145 static void __init edb93xx_register_spi(void)
146 {
147 if (machine_is_edb9301() || machine_is_edb9302())
148 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1;
149 else if (machine_is_edb9302a() || machine_is_edb9307a())
150 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2);
151 else if (machine_is_edb9315a())
152 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14;
153
154 ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
155 ARRAY_SIZE(edb93xx_spi_board_info));
156 }
157
158
159 /*************************************************************************
160 * EDB93xx I2S
161 *************************************************************************/
162 static int __init edb93xx_has_audio(void)
163 {
164 return (machine_is_edb9301() || machine_is_edb9302() ||
165 machine_is_edb9302a() || machine_is_edb9307a() ||
166 machine_is_edb9315a());
167 }
168
169 static void __init edb93xx_register_i2s(void)
170 {
171 if (edb93xx_has_audio()) {
172 ep93xx_register_i2s();
173 }
174 }
175
176
177 /*************************************************************************
178 * EDB93xx pwm
179 *************************************************************************/
180 static void __init edb93xx_register_pwm(void)
181 {
182 if (machine_is_edb9301() ||
183 machine_is_edb9302() || machine_is_edb9302a()) {
184 /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
185 ep93xx_register_pwm(0, 1);
186 } else if (machine_is_edb9307() || machine_is_edb9307a()) {
187 /* EP9307 only has pwm.0 (PWMOUT) */
188 ep93xx_register_pwm(1, 0);
189 } else {
190 /* EP9312 and EP9315 have both */
191 ep93xx_register_pwm(1, 1);
192 }
193 }
194
195
196 /*************************************************************************
197 * EDB93xx framebuffer
198 *************************************************************************/
199 static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
200 .num_modes = EP93XXFB_USE_MODEDB,
201 .bpp = 16,
202 .flags = 0,
203 };
204
205 static int __init edb93xx_has_fb(void)
206 {
207 /* These platforms have an ep93xx with video capability */
208 return machine_is_edb9307() || machine_is_edb9307a() ||
209 machine_is_edb9312() || machine_is_edb9315() ||
210 machine_is_edb9315a();
211 }
212
213 static void __init edb93xx_register_fb(void)
214 {
215 if (!edb93xx_has_fb())
216 return;
217
218 if (machine_is_edb9307a() || machine_is_edb9315a())
219 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
220 else
221 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
222
223 ep93xx_register_fb(&edb93xxfb_info);
224 }
225
226
227 static void __init edb93xx_init_machine(void)
228 {
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 }
238
239
240 #ifdef CONFIG_MACH_EDB9301
241 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
242 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
243 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
244 .map_io = ep93xx_map_io,
245 .init_irq = ep93xx_init_irq,
246 .timer = &ep93xx_timer,
247 .init_machine = edb93xx_init_machine,
248 MACHINE_END
249 #endif
250
251 #ifdef CONFIG_MACH_EDB9302
252 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
253 /* Maintainer: George Kashperko <george@chas.com.ua> */
254 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
255 .map_io = ep93xx_map_io,
256 .init_irq = ep93xx_init_irq,
257 .timer = &ep93xx_timer,
258 .init_machine = edb93xx_init_machine,
259 MACHINE_END
260 #endif
261
262 #ifdef CONFIG_MACH_EDB9302A
263 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
264 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
265 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
266 .map_io = ep93xx_map_io,
267 .init_irq = ep93xx_init_irq,
268 .timer = &ep93xx_timer,
269 .init_machine = edb93xx_init_machine,
270 MACHINE_END
271 #endif
272
273 #ifdef CONFIG_MACH_EDB9307
274 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
275 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
276 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
277 .map_io = ep93xx_map_io,
278 .init_irq = ep93xx_init_irq,
279 .timer = &ep93xx_timer,
280 .init_machine = edb93xx_init_machine,
281 MACHINE_END
282 #endif
283
284 #ifdef CONFIG_MACH_EDB9307A
285 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
286 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
287 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
288 .map_io = ep93xx_map_io,
289 .init_irq = ep93xx_init_irq,
290 .timer = &ep93xx_timer,
291 .init_machine = edb93xx_init_machine,
292 MACHINE_END
293 #endif
294
295 #ifdef CONFIG_MACH_EDB9312
296 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
297 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
298 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
299 .map_io = ep93xx_map_io,
300 .init_irq = ep93xx_init_irq,
301 .timer = &ep93xx_timer,
302 .init_machine = edb93xx_init_machine,
303 MACHINE_END
304 #endif
305
306 #ifdef CONFIG_MACH_EDB9315
307 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
308 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
309 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
310 .map_io = ep93xx_map_io,
311 .init_irq = ep93xx_init_irq,
312 .timer = &ep93xx_timer,
313 .init_machine = edb93xx_init_machine,
314 MACHINE_END
315 #endif
316
317 #ifdef CONFIG_MACH_EDB9315A
318 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
319 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
320 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
321 .map_io = ep93xx_map_io,
322 .init_irq = ep93xx_init_irq,
323 .timer = &ep93xx_timer,
324 .init_machine = edb93xx_init_machine,
325 MACHINE_END
326 #endif
This page took 0.038714 seconds and 6 git commands to generate.