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>
43 #define ETH_KS8851_IRQ 34
44 #define ETH_KS8851_POWER_ON 48
45 #define ETH_KS8851_QUART 138
46 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
47 #define OMAP4_SFH7741_ENABLE_GPIO 188
49 static struct gpio_led sdp4430_gpio_leds[] = {
51 .name = "omap4:green:debug0",
55 .name = "omap4:green:debug1",
59 .name = "omap4:green:debug2",
63 .name = "omap4:green:debug3",
67 .name = "omap4:green:debug4",
71 .name = "omap4:blue:user",
75 .name = "omap4:red:user",
79 .name = "omap4:green:user",
85 static struct gpio_keys_button sdp4430_gpio_keys[] = {
87 .desc = "Proximity Sensor",
89 .code = SW_FRONT_PROXIMITY,
90 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
95 static struct gpio_led_platform_data sdp4430_led_data = {
96 .leds = sdp4430_gpio_leds,
97 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
100 static int omap_prox_activate(struct device *dev)
102 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
106 static void omap_prox_deactivate(struct device *dev)
108 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
111 static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
112 .buttons = sdp4430_gpio_keys,
113 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
114 .enable = omap_prox_activate,
115 .disable = omap_prox_deactivate,
118 static struct platform_device sdp4430_gpio_keys_device = {
122 .platform_data = &sdp4430_gpio_keys_data,
126 static struct platform_device sdp4430_leds_gpio = {
130 .platform_data = &sdp4430_led_data,
133 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
135 .modalias = "ks8851",
138 .max_speed_hz = 24000000,
139 .irq = ETH_KS8851_IRQ,
143 static int omap_ethernet_init(void)
147 /* Request of GPIO lines */
149 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
151 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
155 status = gpio_request(ETH_KS8851_QUART, "quart");
157 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
161 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
163 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
167 /* Configuration of requested GPIO lines */
169 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
171 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
175 status = gpio_direction_output(ETH_KS8851_QUART, 1);
177 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
181 status = gpio_direction_input(ETH_KS8851_IRQ);
183 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
190 gpio_free(ETH_KS8851_IRQ);
192 gpio_free(ETH_KS8851_QUART);
194 gpio_free(ETH_KS8851_POWER_ON);
198 static struct platform_device sdp4430_lcd_device = {
199 .name = "sdp4430_lcd",
203 static struct platform_device *sdp4430_devices[] __initdata = {
205 &sdp4430_gpio_keys_device,
209 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
210 .ctrl_name = "internal",
213 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
214 { OMAP_TAG_LCD, &sdp4430_lcd_config },
217 static void __init omap_4430sdp_init_irq(void)
219 omap_board_config = sdp4430_config;
220 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
221 omap2_init_common_hw(NULL, NULL);
222 #ifdef CONFIG_OMAP_32K_TIMER
223 omap2_gp_clockevent_set_gptimer(1);
229 static struct omap_musb_board_data musb_board_data = {
230 .interface_type = MUSB_INTERFACE_UTMI,
231 .mode = MUSB_PERIPHERAL,
235 static struct omap2_hsmmc_info mmc[] = {
238 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
243 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
246 .nonremovable = true,
247 .ocr_mask = MMC_VDD_29_30,
252 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
255 .dev_name = "mmci-omap-hs.1",
258 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
261 .dev_name = "mmci-omap-hs.0",
265 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
268 struct platform_device *pdev = container_of(dev,
269 struct platform_device, dev);
270 struct omap_mmc_platform_data *pdata = dev->platform_data;
272 /* Setting MMC1 Card detect Irq */
274 ret = twl6030_mmc_card_detect_config();
276 pr_err("Failed configuring MMC1 card detect\n");
277 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
278 MMCDETECT_INTR_OFFSET;
279 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
284 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
286 struct omap_mmc_platform_data *pdata;
288 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
290 pr_err("Failed %s\n", __func__);
293 pdata = dev->platform_data;
294 pdata->init = omap4_twl6030_hsmmc_late_init;
297 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
299 struct omap2_hsmmc_info *c;
301 omap2_hsmmc_init(controllers);
302 for (c = controllers; c->mmc; c++)
303 omap4_twl6030_hsmmc_set_late_init(c->dev);
308 static struct regulator_init_data sdp4430_vaux1 = {
313 .valid_modes_mask = REGULATOR_MODE_NORMAL
314 | REGULATOR_MODE_STANDBY,
315 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
316 | REGULATOR_CHANGE_MODE
317 | REGULATOR_CHANGE_STATUS,
319 .num_consumer_supplies = 1,
320 .consumer_supplies = sdp4430_vaux_supply,
323 static struct regulator_init_data sdp4430_vaux2 = {
328 .valid_modes_mask = REGULATOR_MODE_NORMAL
329 | REGULATOR_MODE_STANDBY,
330 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
331 | REGULATOR_CHANGE_MODE
332 | REGULATOR_CHANGE_STATUS,
336 static struct regulator_init_data sdp4430_vaux3 = {
341 .valid_modes_mask = REGULATOR_MODE_NORMAL
342 | REGULATOR_MODE_STANDBY,
343 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
344 | REGULATOR_CHANGE_MODE
345 | REGULATOR_CHANGE_STATUS,
349 /* VMMC1 for MMC1 card */
350 static struct regulator_init_data sdp4430_vmmc = {
355 .valid_modes_mask = REGULATOR_MODE_NORMAL
356 | REGULATOR_MODE_STANDBY,
357 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
358 | REGULATOR_CHANGE_MODE
359 | REGULATOR_CHANGE_STATUS,
361 .num_consumer_supplies = 1,
362 .consumer_supplies = sdp4430_vmmc_supply,
365 static struct regulator_init_data sdp4430_vpp = {
370 .valid_modes_mask = REGULATOR_MODE_NORMAL
371 | REGULATOR_MODE_STANDBY,
372 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
373 | REGULATOR_CHANGE_MODE
374 | REGULATOR_CHANGE_STATUS,
378 static struct regulator_init_data sdp4430_vusim = {
383 .valid_modes_mask = REGULATOR_MODE_NORMAL
384 | REGULATOR_MODE_STANDBY,
385 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
386 | REGULATOR_CHANGE_MODE
387 | REGULATOR_CHANGE_STATUS,
391 static struct regulator_init_data sdp4430_vana = {
396 .valid_modes_mask = REGULATOR_MODE_NORMAL
397 | REGULATOR_MODE_STANDBY,
398 .valid_ops_mask = REGULATOR_CHANGE_MODE
399 | REGULATOR_CHANGE_STATUS,
403 static struct regulator_init_data sdp4430_vcxio = {
408 .valid_modes_mask = REGULATOR_MODE_NORMAL
409 | REGULATOR_MODE_STANDBY,
410 .valid_ops_mask = REGULATOR_CHANGE_MODE
411 | REGULATOR_CHANGE_STATUS,
415 static struct regulator_init_data sdp4430_vdac = {
420 .valid_modes_mask = REGULATOR_MODE_NORMAL
421 | REGULATOR_MODE_STANDBY,
422 .valid_ops_mask = REGULATOR_CHANGE_MODE
423 | REGULATOR_CHANGE_STATUS,
427 static struct regulator_init_data sdp4430_vusb = {
432 .valid_modes_mask = REGULATOR_MODE_NORMAL
433 | REGULATOR_MODE_STANDBY,
434 .valid_ops_mask = REGULATOR_CHANGE_MODE
435 | REGULATOR_CHANGE_STATUS,
439 static struct twl4030_platform_data sdp4430_twldata = {
440 .irq_base = TWL6030_IRQ_BASE,
441 .irq_end = TWL6030_IRQ_END,
444 .vmmc = &sdp4430_vmmc,
446 .vusim = &sdp4430_vusim,
447 .vana = &sdp4430_vana,
448 .vcxio = &sdp4430_vcxio,
449 .vdac = &sdp4430_vdac,
450 .vusb = &sdp4430_vusb,
451 .vaux1 = &sdp4430_vaux1,
452 .vaux2 = &sdp4430_vaux2,
453 .vaux3 = &sdp4430_vaux3,
456 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
458 I2C_BOARD_INFO("twl6030", 0x48),
459 .flags = I2C_CLIENT_WAKE,
460 .irq = OMAP44XX_IRQ_SYS_1N,
461 .platform_data = &sdp4430_twldata,
464 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
466 I2C_BOARD_INFO("tmp105", 0x48),
469 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
471 I2C_BOARD_INFO("hmc5843", 0x1e),
474 static int __init omap4_i2c_init(void)
477 * Phoenix Audio IC needs I2C1 to
478 * start with 400 KHz or less
480 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
481 ARRAY_SIZE(sdp4430_i2c_boardinfo));
482 omap_register_i2c_bus(2, 400, NULL, 0);
483 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
484 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
485 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
486 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
490 static void __init omap_sfh7741prox_init(void)
494 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
496 pr_err("%s:failed to request GPIO %d, error %d\n",
497 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
501 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
503 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
504 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
505 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
509 #ifdef CONFIG_OMAP_MUX
510 static struct omap_board_mux board_mux[] __initdata = {
511 { .reg_offset = OMAP_MUX_TERMINATOR },
514 #define board_mux NULL
517 static void __init omap_4430sdp_init(void)
520 int package = OMAP_PACKAGE_CBS;
522 if (omap_rev() == OMAP4430_REV_ES1_0)
523 package = OMAP_PACKAGE_CBL;
524 omap4_mux_init(board_mux, package);
527 omap_sfh7741prox_init();
528 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
530 omap4_twl6030_hsmmc_init(mmc);
531 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
532 usb_nop_xceiv_register();
533 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
534 if (!cpu_is_omap44xx())
535 usb_musb_init(&musb_board_data);
537 status = omap_ethernet_init();
539 pr_err("Ethernet initialization failed: %d\n", status);
541 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
542 spi_register_board_info(sdp4430_spi_board_info,
543 ARRAY_SIZE(sdp4430_spi_board_info));
547 static void __init omap_4430sdp_map_io(void)
549 omap2_set_globals_443x();
550 omap44xx_map_common_io();
553 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
554 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
555 .boot_params = 0x80000100,
556 .map_io = omap_4430sdp_map_io,
557 .reserve = omap_reserve,
558 .init_irq = omap_4430sdp_init_irq,
559 .init_machine = omap_4430sdp_init,
560 .timer = &omap_timer,