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>
26 #include <linux/leds_pwm.h>
28 #include <mach/hardware.h>
29 #include <mach/omap4-common.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
34 #include <plat/board.h>
35 #include <plat/common.h>
44 #define ETH_KS8851_IRQ 34
45 #define ETH_KS8851_POWER_ON 48
46 #define ETH_KS8851_QUART 138
47 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
48 #define OMAP4_SFH7741_ENABLE_GPIO 188
50 static struct gpio_led sdp4430_gpio_leds[] = {
52 .name = "omap4:green:debug0",
56 .name = "omap4:green:debug1",
60 .name = "omap4:green:debug2",
64 .name = "omap4:green:debug3",
68 .name = "omap4:green:debug4",
72 .name = "omap4:blue:user",
76 .name = "omap4:red:user",
80 .name = "omap4:green:user",
86 static struct gpio_keys_button sdp4430_gpio_keys[] = {
88 .desc = "Proximity Sensor",
90 .code = SW_FRONT_PROXIMITY,
91 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
96 static struct gpio_led_platform_data sdp4430_led_data = {
97 .leds = sdp4430_gpio_leds,
98 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
101 static struct led_pwm sdp4430_pwm_leds[] = {
103 .name = "omap4:green:chrg",
105 .max_brightness = 255,
106 .pwm_period_ns = 7812500,
110 static struct led_pwm_platform_data sdp4430_pwm_data = {
111 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
112 .leds = sdp4430_pwm_leds,
115 static struct platform_device sdp4430_leds_pwm = {
119 .platform_data = &sdp4430_pwm_data,
123 static int omap_prox_activate(struct device *dev)
125 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
129 static void omap_prox_deactivate(struct device *dev)
131 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
134 static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
135 .buttons = sdp4430_gpio_keys,
136 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
137 .enable = omap_prox_activate,
138 .disable = omap_prox_deactivate,
141 static struct platform_device sdp4430_gpio_keys_device = {
145 .platform_data = &sdp4430_gpio_keys_data,
149 static struct platform_device sdp4430_leds_gpio = {
153 .platform_data = &sdp4430_led_data,
156 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
158 .modalias = "ks8851",
161 .max_speed_hz = 24000000,
162 .irq = ETH_KS8851_IRQ,
166 static int omap_ethernet_init(void)
170 /* Request of GPIO lines */
172 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
174 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
178 status = gpio_request(ETH_KS8851_QUART, "quart");
180 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
184 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
186 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
190 /* Configuration of requested GPIO lines */
192 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
194 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
198 status = gpio_direction_output(ETH_KS8851_QUART, 1);
200 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
204 status = gpio_direction_input(ETH_KS8851_IRQ);
206 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
213 gpio_free(ETH_KS8851_IRQ);
215 gpio_free(ETH_KS8851_QUART);
217 gpio_free(ETH_KS8851_POWER_ON);
221 static struct platform_device sdp4430_lcd_device = {
222 .name = "sdp4430_lcd",
226 static struct platform_device *sdp4430_devices[] __initdata = {
228 &sdp4430_gpio_keys_device,
233 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
234 .ctrl_name = "internal",
237 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
238 { OMAP_TAG_LCD, &sdp4430_lcd_config },
241 static void __init omap_4430sdp_init_irq(void)
243 omap_board_config = sdp4430_config;
244 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
245 omap2_init_common_infrastructure();
246 omap2_init_common_devices(NULL, NULL);
247 #ifdef CONFIG_OMAP_32K_TIMER
248 omap2_gp_clockevent_set_gptimer(1);
253 static struct omap_musb_board_data musb_board_data = {
254 .interface_type = MUSB_INTERFACE_UTMI,
259 static struct twl4030_usb_data omap4_usbphy_data = {
260 .phy_init = omap4430_phy_init,
261 .phy_exit = omap4430_phy_exit,
262 .phy_power = omap4430_phy_power,
263 .phy_set_clock = omap4430_phy_set_clk,
264 .phy_suspend = omap4430_phy_suspend,
267 static struct omap2_hsmmc_info mmc[] = {
270 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
275 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
278 .nonremovable = true,
279 .ocr_mask = MMC_VDD_29_30,
284 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
287 .dev_name = "mmci-omap-hs.1",
290 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
293 .dev_name = "mmci-omap-hs.0",
297 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
300 struct platform_device *pdev = container_of(dev,
301 struct platform_device, dev);
302 struct omap_mmc_platform_data *pdata = dev->platform_data;
304 /* Setting MMC1 Card detect Irq */
306 ret = twl6030_mmc_card_detect_config();
308 pr_err("Failed configuring MMC1 card detect\n");
309 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
310 MMCDETECT_INTR_OFFSET;
311 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
316 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
318 struct omap_mmc_platform_data *pdata;
320 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
322 pr_err("Failed %s\n", __func__);
325 pdata = dev->platform_data;
326 pdata->init = omap4_twl6030_hsmmc_late_init;
329 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
331 struct omap2_hsmmc_info *c;
333 omap2_hsmmc_init(controllers);
334 for (c = controllers; c->mmc; c++)
335 omap4_twl6030_hsmmc_set_late_init(c->dev);
340 static struct regulator_init_data sdp4430_vaux1 = {
345 .valid_modes_mask = REGULATOR_MODE_NORMAL
346 | REGULATOR_MODE_STANDBY,
347 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
348 | REGULATOR_CHANGE_MODE
349 | REGULATOR_CHANGE_STATUS,
351 .num_consumer_supplies = 1,
352 .consumer_supplies = sdp4430_vaux_supply,
355 static struct regulator_init_data sdp4430_vaux2 = {
360 .valid_modes_mask = REGULATOR_MODE_NORMAL
361 | REGULATOR_MODE_STANDBY,
362 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
363 | REGULATOR_CHANGE_MODE
364 | REGULATOR_CHANGE_STATUS,
368 static struct regulator_init_data sdp4430_vaux3 = {
373 .valid_modes_mask = REGULATOR_MODE_NORMAL
374 | REGULATOR_MODE_STANDBY,
375 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
376 | REGULATOR_CHANGE_MODE
377 | REGULATOR_CHANGE_STATUS,
381 /* VMMC1 for MMC1 card */
382 static struct regulator_init_data sdp4430_vmmc = {
387 .valid_modes_mask = REGULATOR_MODE_NORMAL
388 | REGULATOR_MODE_STANDBY,
389 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
390 | REGULATOR_CHANGE_MODE
391 | REGULATOR_CHANGE_STATUS,
393 .num_consumer_supplies = 1,
394 .consumer_supplies = sdp4430_vmmc_supply,
397 static struct regulator_init_data sdp4430_vpp = {
402 .valid_modes_mask = REGULATOR_MODE_NORMAL
403 | REGULATOR_MODE_STANDBY,
404 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
405 | REGULATOR_CHANGE_MODE
406 | REGULATOR_CHANGE_STATUS,
410 static struct regulator_init_data sdp4430_vusim = {
415 .valid_modes_mask = REGULATOR_MODE_NORMAL
416 | REGULATOR_MODE_STANDBY,
417 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
418 | REGULATOR_CHANGE_MODE
419 | REGULATOR_CHANGE_STATUS,
423 static struct regulator_init_data sdp4430_vana = {
428 .valid_modes_mask = REGULATOR_MODE_NORMAL
429 | REGULATOR_MODE_STANDBY,
430 .valid_ops_mask = REGULATOR_CHANGE_MODE
431 | REGULATOR_CHANGE_STATUS,
435 static struct regulator_init_data sdp4430_vcxio = {
440 .valid_modes_mask = REGULATOR_MODE_NORMAL
441 | REGULATOR_MODE_STANDBY,
442 .valid_ops_mask = REGULATOR_CHANGE_MODE
443 | REGULATOR_CHANGE_STATUS,
447 static struct regulator_init_data sdp4430_vdac = {
452 .valid_modes_mask = REGULATOR_MODE_NORMAL
453 | REGULATOR_MODE_STANDBY,
454 .valid_ops_mask = REGULATOR_CHANGE_MODE
455 | REGULATOR_CHANGE_STATUS,
459 static struct regulator_init_data sdp4430_vusb = {
464 .valid_modes_mask = REGULATOR_MODE_NORMAL
465 | REGULATOR_MODE_STANDBY,
466 .valid_ops_mask = REGULATOR_CHANGE_MODE
467 | REGULATOR_CHANGE_STATUS,
471 static struct twl4030_platform_data sdp4430_twldata = {
472 .irq_base = TWL6030_IRQ_BASE,
473 .irq_end = TWL6030_IRQ_END,
476 .vmmc = &sdp4430_vmmc,
478 .vusim = &sdp4430_vusim,
479 .vana = &sdp4430_vana,
480 .vcxio = &sdp4430_vcxio,
481 .vdac = &sdp4430_vdac,
482 .vusb = &sdp4430_vusb,
483 .vaux1 = &sdp4430_vaux1,
484 .vaux2 = &sdp4430_vaux2,
485 .vaux3 = &sdp4430_vaux3,
486 .usb = &omap4_usbphy_data
489 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
491 I2C_BOARD_INFO("twl6030", 0x48),
492 .flags = I2C_CLIENT_WAKE,
493 .irq = OMAP44XX_IRQ_SYS_1N,
494 .platform_data = &sdp4430_twldata,
497 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
499 I2C_BOARD_INFO("tmp105", 0x48),
502 I2C_BOARD_INFO("bh1780", 0x29),
505 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
507 I2C_BOARD_INFO("hmc5843", 0x1e),
510 static int __init omap4_i2c_init(void)
513 * Phoenix Audio IC needs I2C1 to
514 * start with 400 KHz or less
516 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
517 ARRAY_SIZE(sdp4430_i2c_boardinfo));
518 omap_register_i2c_bus(2, 400, NULL, 0);
519 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
520 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
521 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
522 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
526 static void __init omap_sfh7741prox_init(void)
530 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
532 pr_err("%s:failed to request GPIO %d, error %d\n",
533 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
537 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
539 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
540 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
541 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
545 #ifdef CONFIG_OMAP_MUX
546 static struct omap_board_mux board_mux[] __initdata = {
547 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
548 { .reg_offset = OMAP_MUX_TERMINATOR },
551 #define board_mux NULL
554 static void __init omap_4430sdp_init(void)
557 int package = OMAP_PACKAGE_CBS;
559 if (omap_rev() == OMAP4430_REV_ES1_0)
560 package = OMAP_PACKAGE_CBL;
561 omap4_mux_init(board_mux, package);
564 omap_sfh7741prox_init();
565 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
567 omap4_twl6030_hsmmc_init(mmc);
569 usb_musb_init(&musb_board_data);
571 status = omap_ethernet_init();
573 pr_err("Ethernet initialization failed: %d\n", status);
575 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
576 spi_register_board_info(sdp4430_spi_board_info,
577 ARRAY_SIZE(sdp4430_spi_board_info));
581 static void __init omap_4430sdp_map_io(void)
583 omap2_set_globals_443x();
584 omap44xx_map_common_io();
587 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
588 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
589 .boot_params = 0x80000100,
590 .map_io = omap_4430sdp_map_io,
591 .reserve = omap_reserve,
592 .init_irq = omap_4430sdp_init_irq,
593 .init_machine = omap_4430sdp_init,
594 .timer = &omap_timer,