2 * Board support file for OMAP4430 SDP.
4 * Copyright (C) 2009 Texas Instruments
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
8 * Based on mach-omap2/board-3430sdp.c
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.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
19 #include <linux/gpio.h>
20 #include <linux/usb/otg.h>
21 #include <linux/spi/spi.h>
22 #include <linux/i2c/twl.h>
23 #include <linux/regulator/machine.h>
24 #include <linux/leds.h>
26 #include <mach/hardware.h>
27 #include <mach/omap4-common.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
32 #include <plat/board.h>
33 #include <plat/common.h>
34 #include <plat/control.h>
35 #include <plat/timer-gp.h>
40 #define ETH_KS8851_IRQ 34
41 #define ETH_KS8851_POWER_ON 48
42 #define ETH_KS8851_QUART 138
44 static struct gpio_led sdp4430_gpio_leds[] = {
46 .name = "omap4:green:debug0",
50 .name = "omap4:green:debug1",
54 .name = "omap4:green:debug2",
58 .name = "omap4:green:debug3",
62 .name = "omap4:green:debug4",
66 .name = "omap4:blue:user",
70 .name = "omap4:red:user",
74 .name = "omap4:green:user",
80 static struct gpio_led_platform_data sdp4430_led_data = {
81 .leds = sdp4430_gpio_leds,
82 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
85 static struct platform_device sdp4430_leds_gpio = {
89 .platform_data = &sdp4430_led_data,
92 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
97 .max_speed_hz = 24000000,
98 .irq = ETH_KS8851_IRQ,
102 static int omap_ethernet_init(void)
106 /* Request of GPIO lines */
108 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
110 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
114 status = gpio_request(ETH_KS8851_QUART, "quart");
116 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
120 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
122 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
126 /* Configuration of requested GPIO lines */
128 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
130 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
134 status = gpio_direction_output(ETH_KS8851_QUART, 1);
136 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
140 status = gpio_direction_input(ETH_KS8851_IRQ);
142 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
149 gpio_free(ETH_KS8851_IRQ);
151 gpio_free(ETH_KS8851_QUART);
153 gpio_free(ETH_KS8851_POWER_ON);
157 static struct platform_device sdp4430_lcd_device = {
158 .name = "sdp4430_lcd",
162 static struct platform_device *sdp4430_devices[] __initdata = {
167 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
168 .ctrl_name = "internal",
171 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
172 { OMAP_TAG_LCD, &sdp4430_lcd_config },
175 static void __init omap_4430sdp_init_irq(void)
177 omap_board_config = sdp4430_config;
178 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
179 omap2_init_common_hw(NULL, NULL);
180 #ifdef CONFIG_OMAP_32K_TIMER
181 omap2_gp_clockevent_set_gptimer(1);
187 static struct omap_musb_board_data musb_board_data = {
188 .interface_type = MUSB_INTERFACE_UTMI,
189 .mode = MUSB_PERIPHERAL,
193 static struct omap2_hsmmc_info mmc[] = {
204 .nonremovable = true,
209 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
212 .dev_name = "mmci-omap-hs.1",
215 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
218 .dev_name = "mmci-omap-hs.0",
222 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
225 struct platform_device *pdev = container_of(dev,
226 struct platform_device, dev);
227 struct omap_mmc_platform_data *pdata = dev->platform_data;
229 /* Setting MMC1 Card detect Irq */
231 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
232 MMCDETECT_INTR_OFFSET;
236 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
238 struct omap_mmc_platform_data *pdata = dev->platform_data;
240 pdata->init = omap4_twl6030_hsmmc_late_init;
243 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
245 struct omap2_hsmmc_info *c;
247 omap2_hsmmc_init(controllers);
248 for (c = controllers; c->mmc; c++)
249 omap4_twl6030_hsmmc_set_late_init(c->dev);
254 static struct regulator_init_data sdp4430_vaux1 = {
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,
265 .num_consumer_supplies = 1,
266 .consumer_supplies = sdp4430_vaux_supply,
269 static struct regulator_init_data sdp4430_vaux2 = {
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,
282 static struct regulator_init_data sdp4430_vaux3 = {
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,
295 /* VMMC1 for MMC1 card */
296 static struct regulator_init_data sdp4430_vmmc = {
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,
307 .num_consumer_supplies = 1,
308 .consumer_supplies = sdp4430_vmmc_supply,
311 static struct regulator_init_data sdp4430_vpp = {
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,
324 static struct regulator_init_data sdp4430_vusim = {
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,
337 static struct regulator_init_data sdp4430_vana = {
342 .valid_modes_mask = REGULATOR_MODE_NORMAL
343 | REGULATOR_MODE_STANDBY,
344 .valid_ops_mask = REGULATOR_CHANGE_MODE
345 | REGULATOR_CHANGE_STATUS,
349 static struct regulator_init_data sdp4430_vcxio = {
354 .valid_modes_mask = REGULATOR_MODE_NORMAL
355 | REGULATOR_MODE_STANDBY,
356 .valid_ops_mask = REGULATOR_CHANGE_MODE
357 | REGULATOR_CHANGE_STATUS,
361 static struct regulator_init_data sdp4430_vdac = {
366 .valid_modes_mask = REGULATOR_MODE_NORMAL
367 | REGULATOR_MODE_STANDBY,
368 .valid_ops_mask = REGULATOR_CHANGE_MODE
369 | REGULATOR_CHANGE_STATUS,
373 static struct regulator_init_data sdp4430_vusb = {
378 .valid_modes_mask = REGULATOR_MODE_NORMAL
379 | REGULATOR_MODE_STANDBY,
380 .valid_ops_mask = REGULATOR_CHANGE_MODE
381 | REGULATOR_CHANGE_STATUS,
385 static struct twl4030_platform_data sdp4430_twldata = {
386 .irq_base = TWL6030_IRQ_BASE,
387 .irq_end = TWL6030_IRQ_END,
390 .vmmc = &sdp4430_vmmc,
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,
402 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
404 I2C_BOARD_INFO("twl6030", 0x48),
405 .flags = I2C_CLIENT_WAKE,
406 .irq = OMAP44XX_IRQ_SYS_1N,
407 .platform_data = &sdp4430_twldata,
410 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
412 I2C_BOARD_INFO("tmp105", 0x48),
415 static int __init omap4_i2c_init(void)
418 * Phoenix Audio IC needs I2C1 to
419 * start with 400 KHz or less
421 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
422 ARRAY_SIZE(sdp4430_i2c_boardinfo));
423 omap_register_i2c_bus(2, 400, NULL, 0);
424 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
425 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
426 omap_register_i2c_bus(4, 400, NULL, 0);
429 static void __init omap_4430sdp_init(void)
434 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
436 omap4_twl6030_hsmmc_init(mmc);
437 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
438 usb_nop_xceiv_register();
439 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
440 if (!cpu_is_omap44xx())
441 usb_musb_init(&musb_board_data);
443 status = omap_ethernet_init();
445 pr_err("Ethernet initialization failed: %d\n", status);
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));
453 static void __init omap_4430sdp_map_io(void)
455 omap2_set_globals_443x();
456 omap44xx_map_common_io();
459 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
460 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
461 .phys_io = 0x48000000,
462 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
463 .boot_params = 0x80000100,
464 .map_io = omap_4430sdp_map_io,
465 .reserve = omap_reserve,
466 .init_irq = omap_4430sdp_init_irq,
467 .init_machine = omap_4430sdp_init,
468 .timer = &omap_timer,