blob: f287461bb0385223965da73ecdcae4ff426d92e8 [file] [log] [blame]
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -07001/*
2 * Board support file for OMAP4430 SDP.
3 *
4 * Copyright (C) 2009 Texas Instruments
5 *
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Based on mach-omap2/board-3430sdp.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080020#include <linux/usb/otg.h>
Abraham Arceb2aa5e52010-05-14 12:05:26 -070021#include <linux/spi/spi.h>
Balaji T K6e30a7d2010-05-12 08:27:30 +000022#include <linux/i2c/twl.h>
23#include <linux/regulator/machine.h>
Hemanth V509b6d92010-08-02 13:18:04 +030024#include <linux/leds.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070025
26#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070027#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070028#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31
Tony Lindgrence491cf2009-10-20 09:40:47 -070032#include <plat/board.h>
33#include <plat/common.h>
34#include <plat/control.h>
35#include <plat/timer-gp.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080036#include <plat/usb.h>
kishore kadiyala717c1fb2010-05-15 18:21:06 +000037#include <plat/mmc.h>
38#include "hsmmc.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070039
Abraham Arceb2aa5e52010-05-14 12:05:26 -070040#define ETH_KS8851_IRQ 34
41#define ETH_KS8851_POWER_ON 48
42#define ETH_KS8851_QUART 138
43
Hemanth V509b6d92010-08-02 13:18:04 +030044static struct gpio_led sdp4430_gpio_leds[] = {
45 {
46 .name = "omap4:green:debug0",
47 .gpio = 61,
48 },
49 {
50 .name = "omap4:green:debug1",
51 .gpio = 30,
52 },
53 {
54 .name = "omap4:green:debug2",
55 .gpio = 7,
56 },
57 {
58 .name = "omap4:green:debug3",
59 .gpio = 8,
60 },
61 {
62 .name = "omap4:green:debug4",
63 .gpio = 50,
64 },
65 {
66 .name = "omap4:blue:user",
67 .gpio = 169,
68 },
69 {
70 .name = "omap4:red:user",
71 .gpio = 170,
72 },
73 {
74 .name = "omap4:green:user",
75 .gpio = 139,
76 },
77
78};
79
80static struct gpio_led_platform_data sdp4430_led_data = {
81 .leds = sdp4430_gpio_leds,
82 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
83};
84
85static struct platform_device sdp4430_leds_gpio = {
86 .name = "leds-gpio",
87 .id = -1,
88 .dev = {
89 .platform_data = &sdp4430_led_data,
90 },
91};
Abraham Arceb2aa5e52010-05-14 12:05:26 -070092static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
93 {
94 .modalias = "ks8851",
95 .bus_num = 1,
96 .chip_select = 0,
97 .max_speed_hz = 24000000,
98 .irq = ETH_KS8851_IRQ,
99 },
100};
101
102static int omap_ethernet_init(void)
103{
104 int status;
105
106 /* Request of GPIO lines */
107
108 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
109 if (status) {
110 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
111 return status;
112 }
113
114 status = gpio_request(ETH_KS8851_QUART, "quart");
115 if (status) {
116 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
117 goto error1;
118 }
119
120 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
121 if (status) {
122 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
123 goto error2;
124 }
125
126 /* Configuration of requested GPIO lines */
127
128 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
129 if (status) {
130 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
131 goto error3;
132 }
133
134 status = gpio_direction_output(ETH_KS8851_QUART, 1);
135 if (status) {
136 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
137 goto error3;
138 }
139
140 status = gpio_direction_input(ETH_KS8851_IRQ);
141 if (status) {
142 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
143 goto error3;
144 }
145
146 return 0;
147
148error3:
149 gpio_free(ETH_KS8851_IRQ);
150error2:
151 gpio_free(ETH_KS8851_QUART);
152error1:
153 gpio_free(ETH_KS8851_POWER_ON);
154 return status;
155}
156
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700157static struct platform_device sdp4430_lcd_device = {
158 .name = "sdp4430_lcd",
159 .id = -1,
160};
161
162static struct platform_device *sdp4430_devices[] __initdata = {
163 &sdp4430_lcd_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300164 &sdp4430_leds_gpio,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700165};
166
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700167static struct omap_lcd_config sdp4430_lcd_config __initdata = {
168 .ctrl_name = "internal",
169};
170
171static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700172 { OMAP_TAG_LCD, &sdp4430_lcd_config },
173};
174
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700175static void __init omap_4430sdp_init_irq(void)
176{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700177 omap_board_config = sdp4430_config;
178 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600179 omap2_init_common_hw(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700180#ifdef CONFIG_OMAP_32K_TIMER
181 omap2_gp_clockevent_set_gptimer(1);
182#endif
183 gic_init_irq();
184 omap_gpio_init();
185}
186
Maulik Mankadbce06682010-02-17 14:09:32 -0800187static struct omap_musb_board_data musb_board_data = {
188 .interface_type = MUSB_INTERFACE_UTMI,
189 .mode = MUSB_PERIPHERAL,
190 .power = 100,
191};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000192
193static struct omap2_hsmmc_info mmc[] = {
194 {
195 .mmc = 1,
196 .wires = 8,
197 .gpio_wp = -EINVAL,
198 },
199 {
200 .mmc = 2,
201 .wires = 8,
202 .gpio_cd = -EINVAL,
203 .gpio_wp = -EINVAL,
204 .nonremovable = true,
205 },
206 {} /* Terminator */
207};
208
Santosh Shilimkar50263912010-08-02 13:18:03 +0300209static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
210 {
211 .supply = "vmmc",
212 .dev_name = "mmci-omap-hs.1",
213 },
214};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000215static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
216 {
217 .supply = "vmmc",
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000218 .dev_name = "mmci-omap-hs.0",
Balaji T K6e30a7d2010-05-12 08:27:30 +0000219 },
Balaji T K6e30a7d2010-05-12 08:27:30 +0000220};
221
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000222static int omap4_twl6030_hsmmc_late_init(struct device *dev)
223{
224 int ret = 0;
225 struct platform_device *pdev = container_of(dev,
226 struct platform_device, dev);
227 struct omap_mmc_platform_data *pdata = dev->platform_data;
228
229 /* Setting MMC1 Card detect Irq */
230 if (pdev->id == 0)
231 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
232 MMCDETECT_INTR_OFFSET;
233 return ret;
234}
235
236static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
237{
238 struct omap_mmc_platform_data *pdata = dev->platform_data;
239
240 pdata->init = omap4_twl6030_hsmmc_late_init;
241}
242
243static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
244{
245 struct omap2_hsmmc_info *c;
246
247 omap2_hsmmc_init(controllers);
248 for (c = controllers; c->mmc; c++)
249 omap4_twl6030_hsmmc_set_late_init(c->dev);
250
251 return 0;
252}
253
Balaji T K6e30a7d2010-05-12 08:27:30 +0000254static struct regulator_init_data sdp4430_vaux1 = {
255 .constraints = {
256 .min_uV = 1000000,
257 .max_uV = 3000000,
258 .apply_uV = true,
259 .valid_modes_mask = REGULATOR_MODE_NORMAL
260 | REGULATOR_MODE_STANDBY,
261 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
262 | REGULATOR_CHANGE_MODE
263 | REGULATOR_CHANGE_STATUS,
264 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300265 .num_consumer_supplies = 1,
266 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000267};
268
269static struct regulator_init_data sdp4430_vaux2 = {
270 .constraints = {
271 .min_uV = 1200000,
272 .max_uV = 2800000,
273 .apply_uV = true,
274 .valid_modes_mask = REGULATOR_MODE_NORMAL
275 | REGULATOR_MODE_STANDBY,
276 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
277 | REGULATOR_CHANGE_MODE
278 | REGULATOR_CHANGE_STATUS,
279 },
280};
281
282static struct regulator_init_data sdp4430_vaux3 = {
283 .constraints = {
284 .min_uV = 1000000,
285 .max_uV = 3000000,
286 .apply_uV = true,
287 .valid_modes_mask = REGULATOR_MODE_NORMAL
288 | REGULATOR_MODE_STANDBY,
289 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
290 | REGULATOR_CHANGE_MODE
291 | REGULATOR_CHANGE_STATUS,
292 },
293};
294
295/* VMMC1 for MMC1 card */
296static struct regulator_init_data sdp4430_vmmc = {
297 .constraints = {
298 .min_uV = 1200000,
299 .max_uV = 3000000,
300 .apply_uV = true,
301 .valid_modes_mask = REGULATOR_MODE_NORMAL
302 | REGULATOR_MODE_STANDBY,
303 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
304 | REGULATOR_CHANGE_MODE
305 | REGULATOR_CHANGE_STATUS,
306 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300307 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000308 .consumer_supplies = sdp4430_vmmc_supply,
309};
310
311static struct regulator_init_data sdp4430_vpp = {
312 .constraints = {
313 .min_uV = 1800000,
314 .max_uV = 2500000,
315 .apply_uV = true,
316 .valid_modes_mask = REGULATOR_MODE_NORMAL
317 | REGULATOR_MODE_STANDBY,
318 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
319 | REGULATOR_CHANGE_MODE
320 | REGULATOR_CHANGE_STATUS,
321 },
322};
323
324static struct regulator_init_data sdp4430_vusim = {
325 .constraints = {
326 .min_uV = 1200000,
327 .max_uV = 2900000,
328 .apply_uV = true,
329 .valid_modes_mask = REGULATOR_MODE_NORMAL
330 | REGULATOR_MODE_STANDBY,
331 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
332 | REGULATOR_CHANGE_MODE
333 | REGULATOR_CHANGE_STATUS,
334 },
335};
336
337static struct regulator_init_data sdp4430_vana = {
338 .constraints = {
339 .min_uV = 2100000,
340 .max_uV = 2100000,
341 .apply_uV = true,
342 .valid_modes_mask = REGULATOR_MODE_NORMAL
343 | REGULATOR_MODE_STANDBY,
344 .valid_ops_mask = REGULATOR_CHANGE_MODE
345 | REGULATOR_CHANGE_STATUS,
346 },
347};
348
349static struct regulator_init_data sdp4430_vcxio = {
350 .constraints = {
351 .min_uV = 1800000,
352 .max_uV = 1800000,
353 .apply_uV = true,
354 .valid_modes_mask = REGULATOR_MODE_NORMAL
355 | REGULATOR_MODE_STANDBY,
356 .valid_ops_mask = REGULATOR_CHANGE_MODE
357 | REGULATOR_CHANGE_STATUS,
358 },
359};
360
361static struct regulator_init_data sdp4430_vdac = {
362 .constraints = {
363 .min_uV = 1800000,
364 .max_uV = 1800000,
365 .apply_uV = true,
366 .valid_modes_mask = REGULATOR_MODE_NORMAL
367 | REGULATOR_MODE_STANDBY,
368 .valid_ops_mask = REGULATOR_CHANGE_MODE
369 | REGULATOR_CHANGE_STATUS,
370 },
371};
372
373static struct regulator_init_data sdp4430_vusb = {
374 .constraints = {
375 .min_uV = 3300000,
376 .max_uV = 3300000,
377 .apply_uV = true,
378 .valid_modes_mask = REGULATOR_MODE_NORMAL
379 | REGULATOR_MODE_STANDBY,
380 .valid_ops_mask = REGULATOR_CHANGE_MODE
381 | REGULATOR_CHANGE_STATUS,
382 },
383};
384
385static struct twl4030_platform_data sdp4430_twldata = {
386 .irq_base = TWL6030_IRQ_BASE,
387 .irq_end = TWL6030_IRQ_END,
388
389 /* Regulators */
390 .vmmc = &sdp4430_vmmc,
391 .vpp = &sdp4430_vpp,
392 .vusim = &sdp4430_vusim,
393 .vana = &sdp4430_vana,
394 .vcxio = &sdp4430_vcxio,
395 .vdac = &sdp4430_vdac,
396 .vusb = &sdp4430_vusb,
397 .vaux1 = &sdp4430_vaux1,
398 .vaux2 = &sdp4430_vaux2,
399 .vaux3 = &sdp4430_vaux3,
400};
401
402static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
403 {
404 I2C_BOARD_INFO("twl6030", 0x48),
405 .flags = I2C_CLIENT_WAKE,
406 .irq = OMAP44XX_IRQ_SYS_1N,
407 .platform_data = &sdp4430_twldata,
408 },
409};
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300410static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
411 {
412 I2C_BOARD_INFO("tmp105", 0x48),
413 },
414};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000415static int __init omap4_i2c_init(void)
416{
417 /*
418 * Phoenix Audio IC needs I2C1 to
419 * start with 400 KHz or less
420 */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000421 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
422 ARRAY_SIZE(sdp4430_i2c_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000423 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300424 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
425 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000426 omap_register_i2c_bus(4, 400, NULL, 0);
427 return 0;
428}
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700429static void __init omap_4430sdp_init(void)
430{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700431 int status;
432
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000433 omap4_i2c_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700434 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700435 omap_serial_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000436 omap4_twl6030_hsmmc_init(mmc);
Maulik Mankadbce06682010-02-17 14:09:32 -0800437 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
438 usb_nop_xceiv_register();
Santosh Shilimkarae46ec772010-02-16 19:29:20 +0530439 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
440 if (!cpu_is_omap44xx())
441 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700442
443 status = omap_ethernet_init();
444 if (status) {
445 pr_err("Ethernet initialization failed: %d\n", status);
446 } else {
447 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
448 spi_register_board_info(sdp4430_spi_board_info,
449 ARRAY_SIZE(sdp4430_spi_board_info));
450 }
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700451}
452
453static void __init omap_4430sdp_map_io(void)
454{
455 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800456 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700457}
458
459MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
460 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
461 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700462 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700463 .boot_params = 0x80000100,
464 .map_io = omap_4430sdp_map_io,
465 .init_irq = omap_4430sdp_init_irq,
466 .init_machine = omap_4430sdp_init,
467 .timer = &omap_timer,
468MACHINE_END