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/gpio_keys.h>
24 #include <linux/regulator/machine.h>
25 #include <linux/leds.h>
27 #include <mach/hardware.h>
28 #include <mach/omap4-common.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
33 #include <plat/board.h>
34 #include <plat/common.h>
35 #include <plat/control.h>
36 #include <plat/timer-gp.h>
41 #define ETH_KS8851_IRQ 34
42 #define ETH_KS8851_POWER_ON 48
43 #define ETH_KS8851_QUART 138
44 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
45 #define OMAP4_SFH7741_ENABLE_GPIO 188
47 static struct gpio_led sdp4430_gpio_leds[] = {
49 .name = "omap4:green:debug0",
53 .name = "omap4:green:debug1",
57 .name = "omap4:green:debug2",
61 .name = "omap4:green:debug3",
65 .name = "omap4:green:debug4",
69 .name = "omap4:blue:user",
73 .name = "omap4:red:user",
77 .name = "omap4:green:user",
83 static struct gpio_keys_button sdp4430_gpio_keys[] = {
85 .desc = "Proximity Sensor",
87 .code = SW_FRONT_PROXIMITY,
88 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
93 static struct gpio_led_platform_data sdp4430_led_data = {
94 .leds = sdp4430_gpio_leds,
95 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
98 static int omap_prox_activate(struct device *dev)
100 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
104 static void omap_prox_deactivate(struct device *dev)
106 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
109 static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
110 .buttons = sdp4430_gpio_keys,
111 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
112 .enable = omap_prox_activate,
113 .disable = omap_prox_deactivate,
116 static struct platform_device sdp4430_gpio_keys_device = {
120 .platform_data = &sdp4430_gpio_keys_data,
124 static struct platform_device sdp4430_leds_gpio = {
128 .platform_data = &sdp4430_led_data,
131 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
133 .modalias = "ks8851",
136 .max_speed_hz = 24000000,
137 .irq = ETH_KS8851_IRQ,
141 static int omap_ethernet_init(void)
145 /* Request of GPIO lines */
147 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
149 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
153 status = gpio_request(ETH_KS8851_QUART, "quart");
155 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
159 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
161 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
165 /* Configuration of requested GPIO lines */
167 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
169 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
173 status = gpio_direction_output(ETH_KS8851_QUART, 1);
175 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
179 status = gpio_direction_input(ETH_KS8851_IRQ);
181 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
188 gpio_free(ETH_KS8851_IRQ);
190 gpio_free(ETH_KS8851_QUART);
192 gpio_free(ETH_KS8851_POWER_ON);
196 static struct platform_device sdp4430_lcd_device = {
197 .name = "sdp4430_lcd",
201 static struct platform_device *sdp4430_devices[] __initdata = {
203 &sdp4430_gpio_keys_device,
207 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
208 .ctrl_name = "internal",
211 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
212 { OMAP_TAG_LCD, &sdp4430_lcd_config },
215 static void __init omap_4430sdp_init_irq(void)
217 omap_board_config = sdp4430_config;
218 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
219 omap2_init_common_hw(NULL, NULL);
220 #ifdef CONFIG_OMAP_32K_TIMER
221 omap2_gp_clockevent_set_gptimer(1);
227 static struct omap_musb_board_data musb_board_data = {
228 .interface_type = MUSB_INTERFACE_UTMI,
229 .mode = MUSB_PERIPHERAL,
233 static struct omap2_hsmmc_info mmc[] = {
236 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
241 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
244 .nonremovable = true,
249 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
252 .dev_name = "mmci-omap-hs.1",
255 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
258 .dev_name = "mmci-omap-hs.0",
262 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
265 struct platform_device *pdev = container_of(dev,
266 struct platform_device, dev);
267 struct omap_mmc_platform_data *pdata = dev->platform_data;
269 /* Setting MMC1 Card detect Irq */
271 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
272 MMCDETECT_INTR_OFFSET;
276 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
278 struct omap_mmc_platform_data *pdata;
280 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
282 pr_err("Failed %s\n", __func__);
285 pdata = dev->platform_data;
286 pdata->init = omap4_twl6030_hsmmc_late_init;
289 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
291 struct omap2_hsmmc_info *c;
293 omap2_hsmmc_init(controllers);
294 for (c = controllers; c->mmc; c++)
295 omap4_twl6030_hsmmc_set_late_init(c->dev);
300 static struct regulator_init_data sdp4430_vaux1 = {
305 .valid_modes_mask = REGULATOR_MODE_NORMAL
306 | REGULATOR_MODE_STANDBY,
307 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
308 | REGULATOR_CHANGE_MODE
309 | REGULATOR_CHANGE_STATUS,
311 .num_consumer_supplies = 1,
312 .consumer_supplies = sdp4430_vaux_supply,
315 static struct regulator_init_data sdp4430_vaux2 = {
320 .valid_modes_mask = REGULATOR_MODE_NORMAL
321 | REGULATOR_MODE_STANDBY,
322 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
323 | REGULATOR_CHANGE_MODE
324 | REGULATOR_CHANGE_STATUS,
328 static struct regulator_init_data sdp4430_vaux3 = {
333 .valid_modes_mask = REGULATOR_MODE_NORMAL
334 | REGULATOR_MODE_STANDBY,
335 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
336 | REGULATOR_CHANGE_MODE
337 | REGULATOR_CHANGE_STATUS,
341 /* VMMC1 for MMC1 card */
342 static struct regulator_init_data sdp4430_vmmc = {
347 .valid_modes_mask = REGULATOR_MODE_NORMAL
348 | REGULATOR_MODE_STANDBY,
349 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
350 | REGULATOR_CHANGE_MODE
351 | REGULATOR_CHANGE_STATUS,
353 .num_consumer_supplies = 1,
354 .consumer_supplies = sdp4430_vmmc_supply,
357 static struct regulator_init_data sdp4430_vpp = {
362 .valid_modes_mask = REGULATOR_MODE_NORMAL
363 | REGULATOR_MODE_STANDBY,
364 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
365 | REGULATOR_CHANGE_MODE
366 | REGULATOR_CHANGE_STATUS,
370 static struct regulator_init_data sdp4430_vusim = {
375 .valid_modes_mask = REGULATOR_MODE_NORMAL
376 | REGULATOR_MODE_STANDBY,
377 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
378 | REGULATOR_CHANGE_MODE
379 | REGULATOR_CHANGE_STATUS,
383 static struct regulator_init_data sdp4430_vana = {
388 .valid_modes_mask = REGULATOR_MODE_NORMAL
389 | REGULATOR_MODE_STANDBY,
390 .valid_ops_mask = REGULATOR_CHANGE_MODE
391 | REGULATOR_CHANGE_STATUS,
395 static struct regulator_init_data sdp4430_vcxio = {
400 .valid_modes_mask = REGULATOR_MODE_NORMAL
401 | REGULATOR_MODE_STANDBY,
402 .valid_ops_mask = REGULATOR_CHANGE_MODE
403 | REGULATOR_CHANGE_STATUS,
407 static struct regulator_init_data sdp4430_vdac = {
412 .valid_modes_mask = REGULATOR_MODE_NORMAL
413 | REGULATOR_MODE_STANDBY,
414 .valid_ops_mask = REGULATOR_CHANGE_MODE
415 | REGULATOR_CHANGE_STATUS,
419 static struct regulator_init_data sdp4430_vusb = {
424 .valid_modes_mask = REGULATOR_MODE_NORMAL
425 | REGULATOR_MODE_STANDBY,
426 .valid_ops_mask = REGULATOR_CHANGE_MODE
427 | REGULATOR_CHANGE_STATUS,
431 static struct twl4030_platform_data sdp4430_twldata = {
432 .irq_base = TWL6030_IRQ_BASE,
433 .irq_end = TWL6030_IRQ_END,
436 .vmmc = &sdp4430_vmmc,
438 .vusim = &sdp4430_vusim,
439 .vana = &sdp4430_vana,
440 .vcxio = &sdp4430_vcxio,
441 .vdac = &sdp4430_vdac,
442 .vusb = &sdp4430_vusb,
443 .vaux1 = &sdp4430_vaux1,
444 .vaux2 = &sdp4430_vaux2,
445 .vaux3 = &sdp4430_vaux3,
448 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
450 I2C_BOARD_INFO("twl6030", 0x48),
451 .flags = I2C_CLIENT_WAKE,
452 .irq = OMAP44XX_IRQ_SYS_1N,
453 .platform_data = &sdp4430_twldata,
456 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
458 I2C_BOARD_INFO("tmp105", 0x48),
461 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
463 I2C_BOARD_INFO("hmc5843", 0x1e),
466 static int __init omap4_i2c_init(void)
469 * Phoenix Audio IC needs I2C1 to
470 * start with 400 KHz or less
472 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
473 ARRAY_SIZE(sdp4430_i2c_boardinfo));
474 omap_register_i2c_bus(2, 400, NULL, 0);
475 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
476 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
477 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
478 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
482 static void __init omap_sfh7741prox_init(void)
486 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
488 pr_err("%s:failed to request GPIO %d, error %d\n",
489 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
493 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
495 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
496 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
497 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
501 static void __init omap_4430sdp_init(void)
506 omap_sfh7741prox_init();
507 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
509 omap4_twl6030_hsmmc_init(mmc);
510 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
511 usb_nop_xceiv_register();
512 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
513 if (!cpu_is_omap44xx())
514 usb_musb_init(&musb_board_data);
516 status = omap_ethernet_init();
518 pr_err("Ethernet initialization failed: %d\n", status);
520 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
521 spi_register_board_info(sdp4430_spi_board_info,
522 ARRAY_SIZE(sdp4430_spi_board_info));
526 static void __init omap_4430sdp_map_io(void)
528 omap2_set_globals_443x();
529 omap44xx_map_common_io();
532 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
533 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
534 .phys_io = 0x48000000,
535 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
536 .boot_params = 0x80000100,
537 .map_io = omap_4430sdp_map_io,
538 .reserve = omap_reserve,
539 .init_irq = omap_4430sdp_init_irq,
540 .init_machine = omap_4430sdp_init,
541 .timer = &omap_timer,