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 OMAP4SDP_MDM_PWR_EN_GPIO 157
48 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
49 #define OMAP4_SFH7741_ENABLE_GPIO 188
51 static struct gpio_led sdp4430_gpio_leds
[] = {
53 .name
= "omap4:green:debug0",
57 .name
= "omap4:green:debug1",
61 .name
= "omap4:green:debug2",
65 .name
= "omap4:green:debug3",
69 .name
= "omap4:green:debug4",
73 .name
= "omap4:blue:user",
77 .name
= "omap4:red:user",
81 .name
= "omap4:green:user",
87 static struct gpio_keys_button sdp4430_gpio_keys
[] = {
89 .desc
= "Proximity Sensor",
91 .code
= SW_FRONT_PROXIMITY
,
92 .gpio
= OMAP4_SFH7741_SENSOR_OUTPUT_GPIO
,
97 static struct gpio_led_platform_data sdp4430_led_data
= {
98 .leds
= sdp4430_gpio_leds
,
99 .num_leds
= ARRAY_SIZE(sdp4430_gpio_leds
),
102 static struct led_pwm sdp4430_pwm_leds
[] = {
104 .name
= "omap4:green:chrg",
106 .max_brightness
= 255,
107 .pwm_period_ns
= 7812500,
111 static struct led_pwm_platform_data sdp4430_pwm_data
= {
112 .num_leds
= ARRAY_SIZE(sdp4430_pwm_leds
),
113 .leds
= sdp4430_pwm_leds
,
116 static struct platform_device sdp4430_leds_pwm
= {
120 .platform_data
= &sdp4430_pwm_data
,
124 static int omap_prox_activate(struct device
*dev
)
126 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO
, 1);
130 static void omap_prox_deactivate(struct device
*dev
)
132 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO
, 0);
135 static struct gpio_keys_platform_data sdp4430_gpio_keys_data
= {
136 .buttons
= sdp4430_gpio_keys
,
137 .nbuttons
= ARRAY_SIZE(sdp4430_gpio_keys
),
138 .enable
= omap_prox_activate
,
139 .disable
= omap_prox_deactivate
,
142 static struct platform_device sdp4430_gpio_keys_device
= {
146 .platform_data
= &sdp4430_gpio_keys_data
,
150 static struct platform_device sdp4430_leds_gpio
= {
154 .platform_data
= &sdp4430_led_data
,
157 static struct spi_board_info sdp4430_spi_board_info
[] __initdata
= {
159 .modalias
= "ks8851",
162 .max_speed_hz
= 24000000,
163 .irq
= ETH_KS8851_IRQ
,
167 static int omap_ethernet_init(void)
171 /* Request of GPIO lines */
173 status
= gpio_request(ETH_KS8851_POWER_ON
, "eth_power");
175 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON
);
179 status
= gpio_request(ETH_KS8851_QUART
, "quart");
181 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART
);
185 status
= gpio_request(ETH_KS8851_IRQ
, "eth_irq");
187 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ
);
191 /* Configuration of requested GPIO lines */
193 status
= gpio_direction_output(ETH_KS8851_POWER_ON
, 1);
195 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ
);
199 status
= gpio_direction_output(ETH_KS8851_QUART
, 1);
201 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART
);
205 status
= gpio_direction_input(ETH_KS8851_IRQ
);
207 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ
);
214 gpio_free(ETH_KS8851_IRQ
);
216 gpio_free(ETH_KS8851_QUART
);
218 gpio_free(ETH_KS8851_POWER_ON
);
222 static struct platform_device sdp4430_lcd_device
= {
223 .name
= "sdp4430_lcd",
227 static struct platform_device
*sdp4430_devices
[] __initdata
= {
229 &sdp4430_gpio_keys_device
,
234 static struct omap_lcd_config sdp4430_lcd_config __initdata
= {
235 .ctrl_name
= "internal",
238 static struct omap_board_config_kernel sdp4430_config
[] __initdata
= {
239 { OMAP_TAG_LCD
, &sdp4430_lcd_config
},
242 static void __init
omap_4430sdp_init_irq(void)
244 omap_board_config
= sdp4430_config
;
245 omap_board_config_size
= ARRAY_SIZE(sdp4430_config
);
246 omap2_init_common_infrastructure();
247 omap2_init_common_devices(NULL
, NULL
);
248 #ifdef CONFIG_OMAP_32K_TIMER
249 omap2_gp_clockevent_set_gptimer(1);
254 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst
= {
255 .port_mode
[0] = EHCI_HCD_OMAP_MODE_PHY
,
256 .port_mode
[1] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
257 .port_mode
[2] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
259 .reset_gpio_port
[0] = -EINVAL
,
260 .reset_gpio_port
[1] = -EINVAL
,
261 .reset_gpio_port
[2] = -EINVAL
,
264 static struct omap_musb_board_data musb_board_data
= {
265 .interface_type
= MUSB_INTERFACE_UTMI
,
270 static struct twl4030_usb_data omap4_usbphy_data
= {
271 .phy_init
= omap4430_phy_init
,
272 .phy_exit
= omap4430_phy_exit
,
273 .phy_power
= omap4430_phy_power
,
274 .phy_set_clock
= omap4430_phy_set_clk
,
277 static struct omap2_hsmmc_info mmc
[] = {
280 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
285 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
288 .nonremovable
= true,
289 .ocr_mask
= MMC_VDD_29_30
,
294 static struct regulator_consumer_supply sdp4430_vaux_supply
[] = {
297 .dev_name
= "mmci-omap-hs.1",
300 static struct regulator_consumer_supply sdp4430_vmmc_supply
[] = {
303 .dev_name
= "mmci-omap-hs.0",
307 static int omap4_twl6030_hsmmc_late_init(struct device
*dev
)
310 struct platform_device
*pdev
= container_of(dev
,
311 struct platform_device
, dev
);
312 struct omap_mmc_platform_data
*pdata
= dev
->platform_data
;
314 /* Setting MMC1 Card detect Irq */
316 ret
= twl6030_mmc_card_detect_config();
318 pr_err("Failed configuring MMC1 card detect\n");
319 pdata
->slots
[0].card_detect_irq
= TWL6030_IRQ_BASE
+
320 MMCDETECT_INTR_OFFSET
;
321 pdata
->slots
[0].card_detect
= twl6030_mmc_card_detect
;
326 static __init
void omap4_twl6030_hsmmc_set_late_init(struct device
*dev
)
328 struct omap_mmc_platform_data
*pdata
;
330 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
332 pr_err("Failed %s\n", __func__
);
335 pdata
= dev
->platform_data
;
336 pdata
->init
= omap4_twl6030_hsmmc_late_init
;
339 static int __init
omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info
*controllers
)
341 struct omap2_hsmmc_info
*c
;
343 omap2_hsmmc_init(controllers
);
344 for (c
= controllers
; c
->mmc
; c
++)
345 omap4_twl6030_hsmmc_set_late_init(c
->dev
);
350 static struct regulator_init_data sdp4430_vaux1
= {
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_vaux_supply
,
365 static struct regulator_init_data sdp4430_vaux2
= {
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_vaux3
= {
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 /* VMMC1 for MMC1 card */
392 static struct regulator_init_data sdp4430_vmmc
= {
397 .valid_modes_mask
= REGULATOR_MODE_NORMAL
398 | REGULATOR_MODE_STANDBY
,
399 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
400 | REGULATOR_CHANGE_MODE
401 | REGULATOR_CHANGE_STATUS
,
403 .num_consumer_supplies
= 1,
404 .consumer_supplies
= sdp4430_vmmc_supply
,
407 static struct regulator_init_data sdp4430_vpp
= {
412 .valid_modes_mask
= REGULATOR_MODE_NORMAL
413 | REGULATOR_MODE_STANDBY
,
414 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
415 | REGULATOR_CHANGE_MODE
416 | REGULATOR_CHANGE_STATUS
,
420 static struct regulator_init_data sdp4430_vusim
= {
425 .valid_modes_mask
= REGULATOR_MODE_NORMAL
426 | REGULATOR_MODE_STANDBY
,
427 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
428 | REGULATOR_CHANGE_MODE
429 | REGULATOR_CHANGE_STATUS
,
433 static struct regulator_init_data sdp4430_vana
= {
438 .valid_modes_mask
= REGULATOR_MODE_NORMAL
439 | REGULATOR_MODE_STANDBY
,
440 .valid_ops_mask
= REGULATOR_CHANGE_MODE
441 | REGULATOR_CHANGE_STATUS
,
445 static struct regulator_init_data sdp4430_vcxio
= {
450 .valid_modes_mask
= REGULATOR_MODE_NORMAL
451 | REGULATOR_MODE_STANDBY
,
452 .valid_ops_mask
= REGULATOR_CHANGE_MODE
453 | REGULATOR_CHANGE_STATUS
,
457 static struct regulator_init_data sdp4430_vdac
= {
462 .valid_modes_mask
= REGULATOR_MODE_NORMAL
463 | REGULATOR_MODE_STANDBY
,
464 .valid_ops_mask
= REGULATOR_CHANGE_MODE
465 | REGULATOR_CHANGE_STATUS
,
469 static struct regulator_init_data sdp4430_vusb
= {
474 .valid_modes_mask
= REGULATOR_MODE_NORMAL
475 | REGULATOR_MODE_STANDBY
,
476 .valid_ops_mask
= REGULATOR_CHANGE_MODE
477 | REGULATOR_CHANGE_STATUS
,
481 static struct twl4030_platform_data sdp4430_twldata
= {
482 .irq_base
= TWL6030_IRQ_BASE
,
483 .irq_end
= TWL6030_IRQ_END
,
486 .vmmc
= &sdp4430_vmmc
,
488 .vusim
= &sdp4430_vusim
,
489 .vana
= &sdp4430_vana
,
490 .vcxio
= &sdp4430_vcxio
,
491 .vdac
= &sdp4430_vdac
,
492 .vusb
= &sdp4430_vusb
,
493 .vaux1
= &sdp4430_vaux1
,
494 .vaux2
= &sdp4430_vaux2
,
495 .vaux3
= &sdp4430_vaux3
,
496 .usb
= &omap4_usbphy_data
499 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo
[] = {
501 I2C_BOARD_INFO("twl6030", 0x48),
502 .flags
= I2C_CLIENT_WAKE
,
503 .irq
= OMAP44XX_IRQ_SYS_1N
,
504 .platform_data
= &sdp4430_twldata
,
507 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo
[] = {
509 I2C_BOARD_INFO("tmp105", 0x48),
512 I2C_BOARD_INFO("bh1780", 0x29),
515 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo
[] = {
517 I2C_BOARD_INFO("hmc5843", 0x1e),
520 static int __init
omap4_i2c_init(void)
523 * Phoenix Audio IC needs I2C1 to
524 * start with 400 KHz or less
526 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo
,
527 ARRAY_SIZE(sdp4430_i2c_boardinfo
));
528 omap_register_i2c_bus(2, 400, NULL
, 0);
529 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo
,
530 ARRAY_SIZE(sdp4430_i2c_3_boardinfo
));
531 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo
,
532 ARRAY_SIZE(sdp4430_i2c_4_boardinfo
));
536 static void __init
omap_sfh7741prox_init(void)
540 error
= gpio_request(OMAP4_SFH7741_ENABLE_GPIO
, "sfh7741");
542 pr_err("%s:failed to request GPIO %d, error %d\n",
543 __func__
, OMAP4_SFH7741_ENABLE_GPIO
, error
);
547 error
= gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO
, 0);
549 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
550 __func__
, OMAP4_SFH7741_ENABLE_GPIO
, error
);
551 gpio_free(OMAP4_SFH7741_ENABLE_GPIO
);
555 #ifdef CONFIG_OMAP_MUX
556 static struct omap_board_mux board_mux
[] __initdata
= {
557 OMAP4_MUX(USBB2_ULPITLL_CLK
, OMAP_MUX_MODE4
| OMAP_PIN_OUTPUT
),
558 { .reg_offset
= OMAP_MUX_TERMINATOR
},
561 #define board_mux NULL
564 static void __init
omap_4430sdp_init(void)
567 int package
= OMAP_PACKAGE_CBS
;
569 if (omap_rev() == OMAP4430_REV_ES1_0
)
570 package
= OMAP_PACKAGE_CBL
;
571 omap4_mux_init(board_mux
, package
);
574 omap_sfh7741prox_init();
575 platform_add_devices(sdp4430_devices
, ARRAY_SIZE(sdp4430_devices
));
577 omap4_twl6030_hsmmc_init(mmc
);
579 /* Power on the ULPI PHY */
580 status
= gpio_request(OMAP4SDP_MDM_PWR_EN_GPIO
, "USBB1 PHY VMDM_3V3");
582 pr_err("%s: Could not get USBB1 PHY GPIO\n", __func__
);
584 gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO
, 1);
586 usb_ehci_init(&ehci_pdata
);
587 usb_musb_init(&musb_board_data
);
589 status
= omap_ethernet_init();
591 pr_err("Ethernet initialization failed: %d\n", status
);
593 sdp4430_spi_board_info
[0].irq
= gpio_to_irq(ETH_KS8851_IRQ
);
594 spi_register_board_info(sdp4430_spi_board_info
,
595 ARRAY_SIZE(sdp4430_spi_board_info
));
599 static void __init
omap_4430sdp_map_io(void)
601 omap2_set_globals_443x();
602 omap44xx_map_common_io();
605 MACHINE_START(OMAP_4430SDP
, "OMAP4430 4430SDP board")
606 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
607 .boot_params
= 0x80000100,
608 .map_io
= omap_4430sdp_map_io
,
609 .reserve
= omap_reserve
,
610 .init_irq
= omap_4430sdp_init_irq
,
611 .init_machine
= omap_4430sdp_init
,
612 .timer
= &omap_timer
,