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_early(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);
253 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst
= {
254 .port_mode
[0] = EHCI_HCD_OMAP_MODE_PHY
,
255 .port_mode
[1] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
256 .port_mode
[2] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
258 .reset_gpio_port
[0] = -EINVAL
,
259 .reset_gpio_port
[1] = -EINVAL
,
260 .reset_gpio_port
[2] = -EINVAL
,
263 static struct omap_musb_board_data musb_board_data
= {
264 .interface_type
= MUSB_INTERFACE_UTMI
,
269 static struct twl4030_usb_data omap4_usbphy_data
= {
270 .phy_init
= omap4430_phy_init
,
271 .phy_exit
= omap4430_phy_exit
,
272 .phy_power
= omap4430_phy_power
,
273 .phy_set_clock
= omap4430_phy_set_clk
,
276 static struct omap2_hsmmc_info mmc
[] = {
279 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
284 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
287 .nonremovable
= true,
288 .ocr_mask
= MMC_VDD_29_30
,
293 static struct regulator_consumer_supply sdp4430_vaux_supply
[] = {
296 .dev_name
= "mmci-omap-hs.1",
299 static struct regulator_consumer_supply sdp4430_vmmc_supply
[] = {
302 .dev_name
= "mmci-omap-hs.0",
306 static int omap4_twl6030_hsmmc_late_init(struct device
*dev
)
309 struct platform_device
*pdev
= container_of(dev
,
310 struct platform_device
, dev
);
311 struct omap_mmc_platform_data
*pdata
= dev
->platform_data
;
313 /* Setting MMC1 Card detect Irq */
315 ret
= twl6030_mmc_card_detect_config();
317 pr_err("Failed configuring MMC1 card detect\n");
318 pdata
->slots
[0].card_detect_irq
= TWL6030_IRQ_BASE
+
319 MMCDETECT_INTR_OFFSET
;
320 pdata
->slots
[0].card_detect
= twl6030_mmc_card_detect
;
325 static __init
void omap4_twl6030_hsmmc_set_late_init(struct device
*dev
)
327 struct omap_mmc_platform_data
*pdata
;
329 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
331 pr_err("Failed %s\n", __func__
);
334 pdata
= dev
->platform_data
;
335 pdata
->init
= omap4_twl6030_hsmmc_late_init
;
338 static int __init
omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info
*controllers
)
340 struct omap2_hsmmc_info
*c
;
342 omap2_hsmmc_init(controllers
);
343 for (c
= controllers
; c
->mmc
; c
++)
344 omap4_twl6030_hsmmc_set_late_init(c
->dev
);
349 static struct regulator_init_data sdp4430_vaux1
= {
354 .valid_modes_mask
= REGULATOR_MODE_NORMAL
355 | REGULATOR_MODE_STANDBY
,
356 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
357 | REGULATOR_CHANGE_MODE
358 | REGULATOR_CHANGE_STATUS
,
360 .num_consumer_supplies
= 1,
361 .consumer_supplies
= sdp4430_vaux_supply
,
364 static struct regulator_init_data sdp4430_vaux2
= {
369 .valid_modes_mask
= REGULATOR_MODE_NORMAL
370 | REGULATOR_MODE_STANDBY
,
371 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
372 | REGULATOR_CHANGE_MODE
373 | REGULATOR_CHANGE_STATUS
,
377 static struct regulator_init_data sdp4430_vaux3
= {
382 .valid_modes_mask
= REGULATOR_MODE_NORMAL
383 | REGULATOR_MODE_STANDBY
,
384 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
385 | REGULATOR_CHANGE_MODE
386 | REGULATOR_CHANGE_STATUS
,
390 /* VMMC1 for MMC1 card */
391 static struct regulator_init_data sdp4430_vmmc
= {
396 .valid_modes_mask
= REGULATOR_MODE_NORMAL
397 | REGULATOR_MODE_STANDBY
,
398 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
399 | REGULATOR_CHANGE_MODE
400 | REGULATOR_CHANGE_STATUS
,
402 .num_consumer_supplies
= 1,
403 .consumer_supplies
= sdp4430_vmmc_supply
,
406 static struct regulator_init_data sdp4430_vpp
= {
411 .valid_modes_mask
= REGULATOR_MODE_NORMAL
412 | REGULATOR_MODE_STANDBY
,
413 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
414 | REGULATOR_CHANGE_MODE
415 | REGULATOR_CHANGE_STATUS
,
419 static struct regulator_init_data sdp4430_vusim
= {
424 .valid_modes_mask
= REGULATOR_MODE_NORMAL
425 | REGULATOR_MODE_STANDBY
,
426 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
427 | REGULATOR_CHANGE_MODE
428 | REGULATOR_CHANGE_STATUS
,
432 static struct regulator_init_data sdp4430_vana
= {
437 .valid_modes_mask
= REGULATOR_MODE_NORMAL
438 | REGULATOR_MODE_STANDBY
,
439 .valid_ops_mask
= REGULATOR_CHANGE_MODE
440 | REGULATOR_CHANGE_STATUS
,
444 static struct regulator_init_data sdp4430_vcxio
= {
449 .valid_modes_mask
= REGULATOR_MODE_NORMAL
450 | REGULATOR_MODE_STANDBY
,
451 .valid_ops_mask
= REGULATOR_CHANGE_MODE
452 | REGULATOR_CHANGE_STATUS
,
456 static struct regulator_init_data sdp4430_vdac
= {
461 .valid_modes_mask
= REGULATOR_MODE_NORMAL
462 | REGULATOR_MODE_STANDBY
,
463 .valid_ops_mask
= REGULATOR_CHANGE_MODE
464 | REGULATOR_CHANGE_STATUS
,
468 static struct regulator_init_data sdp4430_vusb
= {
473 .valid_modes_mask
= REGULATOR_MODE_NORMAL
474 | REGULATOR_MODE_STANDBY
,
475 .valid_ops_mask
= REGULATOR_CHANGE_MODE
476 | REGULATOR_CHANGE_STATUS
,
480 static struct twl4030_platform_data sdp4430_twldata
= {
481 .irq_base
= TWL6030_IRQ_BASE
,
482 .irq_end
= TWL6030_IRQ_END
,
485 .vmmc
= &sdp4430_vmmc
,
487 .vusim
= &sdp4430_vusim
,
488 .vana
= &sdp4430_vana
,
489 .vcxio
= &sdp4430_vcxio
,
490 .vdac
= &sdp4430_vdac
,
491 .vusb
= &sdp4430_vusb
,
492 .vaux1
= &sdp4430_vaux1
,
493 .vaux2
= &sdp4430_vaux2
,
494 .vaux3
= &sdp4430_vaux3
,
495 .usb
= &omap4_usbphy_data
498 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo
[] = {
500 I2C_BOARD_INFO("twl6030", 0x48),
501 .flags
= I2C_CLIENT_WAKE
,
502 .irq
= OMAP44XX_IRQ_SYS_1N
,
503 .platform_data
= &sdp4430_twldata
,
506 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo
[] = {
508 I2C_BOARD_INFO("tmp105", 0x48),
511 I2C_BOARD_INFO("bh1780", 0x29),
514 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo
[] = {
516 I2C_BOARD_INFO("hmc5843", 0x1e),
519 static int __init
omap4_i2c_init(void)
522 * Phoenix Audio IC needs I2C1 to
523 * start with 400 KHz or less
525 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo
,
526 ARRAY_SIZE(sdp4430_i2c_boardinfo
));
527 omap_register_i2c_bus(2, 400, NULL
, 0);
528 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo
,
529 ARRAY_SIZE(sdp4430_i2c_3_boardinfo
));
530 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo
,
531 ARRAY_SIZE(sdp4430_i2c_4_boardinfo
));
535 static void __init
omap_sfh7741prox_init(void)
539 error
= gpio_request(OMAP4_SFH7741_ENABLE_GPIO
, "sfh7741");
541 pr_err("%s:failed to request GPIO %d, error %d\n",
542 __func__
, OMAP4_SFH7741_ENABLE_GPIO
, error
);
546 error
= gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO
, 0);
548 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
549 __func__
, OMAP4_SFH7741_ENABLE_GPIO
, error
);
550 gpio_free(OMAP4_SFH7741_ENABLE_GPIO
);
554 #ifdef CONFIG_OMAP_MUX
555 static struct omap_board_mux board_mux
[] __initdata
= {
556 OMAP4_MUX(USBB2_ULPITLL_CLK
, OMAP_MUX_MODE4
| OMAP_PIN_OUTPUT
),
557 { .reg_offset
= OMAP_MUX_TERMINATOR
},
560 #define board_mux NULL
563 static void __init
omap_4430sdp_init(void)
566 int package
= OMAP_PACKAGE_CBS
;
568 if (omap_rev() == OMAP4430_REV_ES1_0
)
569 package
= OMAP_PACKAGE_CBL
;
570 omap4_mux_init(board_mux
, package
);
573 omap_sfh7741prox_init();
574 platform_add_devices(sdp4430_devices
, ARRAY_SIZE(sdp4430_devices
));
576 omap4_twl6030_hsmmc_init(mmc
);
578 /* Power on the ULPI PHY */
579 status
= gpio_request(OMAP4SDP_MDM_PWR_EN_GPIO
, "USBB1 PHY VMDM_3V3");
581 pr_err("%s: Could not get USBB1 PHY GPIO\n", __func__
);
583 gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO
, 1);
585 usb_ehci_init(&ehci_pdata
);
586 usb_musb_init(&musb_board_data
);
588 status
= omap_ethernet_init();
590 pr_err("Ethernet initialization failed: %d\n", status
);
592 sdp4430_spi_board_info
[0].irq
= gpio_to_irq(ETH_KS8851_IRQ
);
593 spi_register_board_info(sdp4430_spi_board_info
,
594 ARRAY_SIZE(sdp4430_spi_board_info
));
598 static void __init
omap_4430sdp_map_io(void)
600 omap2_set_globals_443x();
601 omap44xx_map_common_io();
604 MACHINE_START(OMAP_4430SDP
, "OMAP4430 4430SDP board")
605 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
606 .boot_params
= 0x80000100,
607 .reserve
= omap_reserve
,
608 .map_io
= omap_4430sdp_map_io
,
609 .init_early
= omap_4430sdp_init_early
,
610 .init_irq
= gic_init_irq
,
611 .init_machine
= omap_4430sdp_init
,
612 .timer
= &omap_timer
,