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>
38 #include <plat/omap4-keypad.h>
39 #include <video/omapdss.h>
44 #include "common-board-devices.h"
46 #define ETH_KS8851_IRQ 34
47 #define ETH_KS8851_POWER_ON 48
48 #define ETH_KS8851_QUART 138
49 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
50 #define OMAP4_SFH7741_ENABLE_GPIO 188
51 #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
52 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
54 static const int sdp4430_keymap[] = {
60 KEY(0, 5, KEY_UNKNOWN),
62 KEY(0, 7, KEY_LEFTSHIFT),
69 KEY(1, 5, KEY_UNKNOWN),
78 KEY(2, 5, KEY_UNKNOWN),
80 KEY(2, 7, KEY_CAPSLOCK),
83 KEY(3, 1, KEY_KPPLUS),
87 KEY(3, 5, KEY_UNKNOWN),
95 KEY(4, 4, KEY_VOLUMEUP),
96 KEY(4, 5, KEY_UNKNOWN),
105 KEY(5, 5, KEY_VOLUMEDOWN),
107 KEY(5, 7, KEY_RIGHT),
113 KEY(6, 4, KEY_BACKSPACE),
114 KEY(6, 5, KEY_UNKNOWN),
118 KEY(7, 0, KEY_PROG1),
119 KEY(7, 1, KEY_PROG2),
120 KEY(7, 2, KEY_PROG3),
121 KEY(7, 3, KEY_PROG4),
123 KEY(7, 5, KEY_UNKNOWN),
128 static struct matrix_keymap_data sdp4430_keymap_data = {
129 .keymap = sdp4430_keymap,
130 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
133 static struct omap4_keypad_platform_data sdp4430_keypad_data = {
134 .keymap_data = &sdp4430_keymap_data,
138 static struct gpio_led sdp4430_gpio_leds[] = {
140 .name = "omap4:green:debug0",
144 .name = "omap4:green:debug1",
148 .name = "omap4:green:debug2",
152 .name = "omap4:green:debug3",
156 .name = "omap4:green:debug4",
160 .name = "omap4:blue:user",
164 .name = "omap4:red:user",
168 .name = "omap4:green:user",
174 static struct gpio_keys_button sdp4430_gpio_keys[] = {
176 .desc = "Proximity Sensor",
178 .code = SW_FRONT_PROXIMITY,
179 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
184 static struct gpio_led_platform_data sdp4430_led_data = {
185 .leds = sdp4430_gpio_leds,
186 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
189 static struct led_pwm sdp4430_pwm_leds[] = {
191 .name = "omap4:green:chrg",
193 .max_brightness = 255,
194 .pwm_period_ns = 7812500,
198 static struct led_pwm_platform_data sdp4430_pwm_data = {
199 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
200 .leds = sdp4430_pwm_leds,
203 static struct platform_device sdp4430_leds_pwm = {
207 .platform_data = &sdp4430_pwm_data,
211 static int omap_prox_activate(struct device *dev)
213 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
217 static void omap_prox_deactivate(struct device *dev)
219 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
222 static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
223 .buttons = sdp4430_gpio_keys,
224 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
225 .enable = omap_prox_activate,
226 .disable = omap_prox_deactivate,
229 static struct platform_device sdp4430_gpio_keys_device = {
233 .platform_data = &sdp4430_gpio_keys_data,
237 static struct platform_device sdp4430_leds_gpio = {
241 .platform_data = &sdp4430_led_data,
244 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
246 .modalias = "ks8851",
249 .max_speed_hz = 24000000,
250 .irq = ETH_KS8851_IRQ,
254 static struct gpio sdp4430_eth_gpios[] __initdata = {
255 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
256 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
257 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
260 static int __init omap_ethernet_init(void)
264 /* Request of GPIO lines */
265 status = gpio_request_array(sdp4430_eth_gpios,
266 ARRAY_SIZE(sdp4430_eth_gpios));
268 pr_err("Cannot request ETH GPIOs\n");
273 static struct platform_device sdp4430_lcd_device = {
274 .name = "sdp4430_lcd",
278 static struct platform_device *sdp4430_devices[] __initdata = {
280 &sdp4430_gpio_keys_device,
285 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
286 .ctrl_name = "internal",
289 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
290 { OMAP_TAG_LCD, &sdp4430_lcd_config },
293 static void __init omap_4430sdp_init_early(void)
295 omap2_init_common_infrastructure();
296 omap2_init_common_devices(NULL, NULL);
299 static struct omap_musb_board_data musb_board_data = {
300 .interface_type = MUSB_INTERFACE_UTMI,
305 static struct omap2_hsmmc_info mmc[] = {
308 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
311 .nonremovable = true,
312 .ocr_mask = MMC_VDD_29_30,
317 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
323 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
324 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
327 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
330 struct platform_device *pdev = container_of(dev,
331 struct platform_device, dev);
332 struct omap_mmc_platform_data *pdata = dev->platform_data;
334 /* Setting MMC1 Card detect Irq */
336 ret = twl6030_mmc_card_detect_config();
338 pr_err("Failed configuring MMC1 card detect\n");
339 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
340 MMCDETECT_INTR_OFFSET;
341 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
346 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
348 struct omap_mmc_platform_data *pdata;
350 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
352 pr_err("Failed %s\n", __func__);
355 pdata = dev->platform_data;
356 pdata->init = omap4_twl6030_hsmmc_late_init;
359 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
361 struct omap2_hsmmc_info *c;
363 omap2_hsmmc_init(controllers);
364 for (c = controllers; c->mmc; c++)
365 omap4_twl6030_hsmmc_set_late_init(c->dev);
370 static struct regulator_init_data sdp4430_vaux1 = {
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,
381 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vaux_supply),
382 .consumer_supplies = sdp4430_vaux_supply,
385 static struct regulator_init_data sdp4430_vusim = {
390 .valid_modes_mask = REGULATOR_MODE_NORMAL
391 | REGULATOR_MODE_STANDBY,
392 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
393 | REGULATOR_CHANGE_MODE
394 | REGULATOR_CHANGE_STATUS,
398 static struct twl4030_platform_data sdp4430_twldata = {
400 .vusim = &sdp4430_vusim,
401 .vaux1 = &sdp4430_vaux1,
404 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
406 I2C_BOARD_INFO("tmp105", 0x48),
409 I2C_BOARD_INFO("bh1780", 0x29),
412 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
414 I2C_BOARD_INFO("hmc5843", 0x1e),
417 static int __init omap4_i2c_init(void)
419 omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
420 TWL_COMMON_REGULATOR_VDAC |
421 TWL_COMMON_REGULATOR_VAUX2 |
422 TWL_COMMON_REGULATOR_VAUX3 |
423 TWL_COMMON_REGULATOR_VMMC |
424 TWL_COMMON_REGULATOR_VPP |
425 TWL_COMMON_REGULATOR_VANA |
426 TWL_COMMON_REGULATOR_VCXIO |
427 TWL_COMMON_REGULATOR_VUSB |
428 TWL_COMMON_REGULATOR_CLK32KG);
429 omap4_pmic_init("twl6030", &sdp4430_twldata);
430 omap_register_i2c_bus(2, 400, NULL, 0);
431 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
432 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
433 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
434 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
438 static void __init omap_sfh7741prox_init(void)
442 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
443 GPIOF_OUT_INIT_LOW, "sfh7741");
445 pr_err("%s:failed to request GPIO %d, error %d\n",
446 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
449 static void sdp4430_hdmi_mux_init(void)
451 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
452 omap_mux_init_signal("hdmi_hpd",
453 OMAP_PIN_INPUT_PULLUP);
454 omap_mux_init_signal("hdmi_cec",
455 OMAP_PIN_INPUT_PULLUP);
456 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
457 omap_mux_init_signal("hdmi_ddc_scl",
458 OMAP_PIN_INPUT_PULLUP);
459 omap_mux_init_signal("hdmi_ddc_sda",
460 OMAP_PIN_INPUT_PULLUP);
463 static struct gpio sdp4430_hdmi_gpios[] = {
464 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
465 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
468 static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
472 status = gpio_request_array(sdp4430_hdmi_gpios,
473 ARRAY_SIZE(sdp4430_hdmi_gpios));
475 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
480 static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
482 gpio_free(HDMI_GPIO_LS_OE);
483 gpio_free(HDMI_GPIO_HPD);
486 static struct omap_dss_device sdp4430_hdmi_device = {
488 .driver_name = "hdmi_panel",
489 .type = OMAP_DISPLAY_TYPE_HDMI,
492 .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
499 .platform_enable = sdp4430_panel_enable_hdmi,
500 .platform_disable = sdp4430_panel_disable_hdmi,
501 .channel = OMAP_DSS_CHANNEL_DIGIT,
504 static struct omap_dss_device *sdp4430_dss_devices[] = {
505 &sdp4430_hdmi_device,
508 static struct omap_dss_board_info sdp4430_dss_data = {
509 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
510 .devices = sdp4430_dss_devices,
511 .default_device = &sdp4430_hdmi_device,
514 void omap_4430sdp_display_init(void)
516 sdp4430_hdmi_mux_init();
517 omap_display_init(&sdp4430_dss_data);
520 #ifdef CONFIG_OMAP_MUX
521 static struct omap_board_mux board_mux[] __initdata = {
522 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
523 { .reg_offset = OMAP_MUX_TERMINATOR },
526 static struct omap_device_pad serial2_pads[] __initdata = {
527 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
528 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
529 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
530 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
531 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
532 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
533 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
534 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
537 static struct omap_device_pad serial3_pads[] __initdata = {
538 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
539 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
540 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
541 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
542 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
543 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
544 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
545 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
548 static struct omap_device_pad serial4_pads[] __initdata = {
549 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
550 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
551 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
552 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
555 static struct omap_board_data serial2_data __initdata = {
557 .pads = serial2_pads,
558 .pads_cnt = ARRAY_SIZE(serial2_pads),
561 static struct omap_board_data serial3_data __initdata = {
563 .pads = serial3_pads,
564 .pads_cnt = ARRAY_SIZE(serial3_pads),
567 static struct omap_board_data serial4_data __initdata = {
569 .pads = serial4_pads,
570 .pads_cnt = ARRAY_SIZE(serial4_pads),
573 static inline void board_serial_init(void)
575 struct omap_board_data bdata;
580 /* pass dummy data for UART1 */
581 omap_serial_init_port(&bdata);
583 omap_serial_init_port(&serial2_data);
584 omap_serial_init_port(&serial3_data);
585 omap_serial_init_port(&serial4_data);
588 #define board_mux NULL
590 static inline void board_serial_init(void)
596 static void __init omap_4430sdp_init(void)
599 int package = OMAP_PACKAGE_CBS;
601 if (omap_rev() == OMAP4430_REV_ES1_0)
602 package = OMAP_PACKAGE_CBL;
603 omap4_mux_init(board_mux, NULL, package);
605 omap_board_config = sdp4430_config;
606 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
609 omap_sfh7741prox_init();
610 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
612 omap4_twl6030_hsmmc_init(mmc);
614 usb_musb_init(&musb_board_data);
616 status = omap_ethernet_init();
618 pr_err("Ethernet initialization failed: %d\n", status);
620 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
621 spi_register_board_info(sdp4430_spi_board_info,
622 ARRAY_SIZE(sdp4430_spi_board_info));
625 status = omap4_keyboard_init(&sdp4430_keypad_data);
627 pr_err("Keypad initialization failed: %d\n", status);
629 omap_4430sdp_display_init();
632 static void __init omap_4430sdp_map_io(void)
634 omap2_set_globals_443x();
635 omap44xx_map_common_io();
638 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
639 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
640 .boot_params = 0x80000100,
641 .reserve = omap_reserve,
642 .map_io = omap_4430sdp_map_io,
643 .init_early = omap_4430sdp_init_early,
644 .init_irq = gic_init_irq,
645 .init_machine = omap_4430sdp_init,
646 .timer = &omap4_timer,