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
,
255 .mode
= MUSB_PERIPHERAL
,
259 static struct omap2_hsmmc_info mmc
[] = {
262 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
267 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
270 .nonremovable
= true,
271 .ocr_mask
= MMC_VDD_29_30
,
276 static struct regulator_consumer_supply sdp4430_vaux_supply
[] = {
279 .dev_name
= "mmci-omap-hs.1",
282 static struct regulator_consumer_supply sdp4430_vmmc_supply
[] = {
285 .dev_name
= "mmci-omap-hs.0",
289 static int omap4_twl6030_hsmmc_late_init(struct device
*dev
)
292 struct platform_device
*pdev
= container_of(dev
,
293 struct platform_device
, dev
);
294 struct omap_mmc_platform_data
*pdata
= dev
->platform_data
;
296 /* Setting MMC1 Card detect Irq */
298 ret
= twl6030_mmc_card_detect_config();
300 pr_err("Failed configuring MMC1 card detect\n");
301 pdata
->slots
[0].card_detect_irq
= TWL6030_IRQ_BASE
+
302 MMCDETECT_INTR_OFFSET
;
303 pdata
->slots
[0].card_detect
= twl6030_mmc_card_detect
;
308 static __init
void omap4_twl6030_hsmmc_set_late_init(struct device
*dev
)
310 struct omap_mmc_platform_data
*pdata
;
312 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
314 pr_err("Failed %s\n", __func__
);
317 pdata
= dev
->platform_data
;
318 pdata
->init
= omap4_twl6030_hsmmc_late_init
;
321 static int __init
omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info
*controllers
)
323 struct omap2_hsmmc_info
*c
;
325 omap2_hsmmc_init(controllers
);
326 for (c
= controllers
; c
->mmc
; c
++)
327 omap4_twl6030_hsmmc_set_late_init(c
->dev
);
332 static struct regulator_init_data sdp4430_vaux1
= {
337 .valid_modes_mask
= REGULATOR_MODE_NORMAL
338 | REGULATOR_MODE_STANDBY
,
339 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
340 | REGULATOR_CHANGE_MODE
341 | REGULATOR_CHANGE_STATUS
,
343 .num_consumer_supplies
= 1,
344 .consumer_supplies
= sdp4430_vaux_supply
,
347 static struct regulator_init_data sdp4430_vaux2
= {
352 .valid_modes_mask
= REGULATOR_MODE_NORMAL
353 | REGULATOR_MODE_STANDBY
,
354 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
355 | REGULATOR_CHANGE_MODE
356 | REGULATOR_CHANGE_STATUS
,
360 static struct regulator_init_data sdp4430_vaux3
= {
365 .valid_modes_mask
= REGULATOR_MODE_NORMAL
366 | REGULATOR_MODE_STANDBY
,
367 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
368 | REGULATOR_CHANGE_MODE
369 | REGULATOR_CHANGE_STATUS
,
373 /* VMMC1 for MMC1 card */
374 static struct regulator_init_data sdp4430_vmmc
= {
379 .valid_modes_mask
= REGULATOR_MODE_NORMAL
380 | REGULATOR_MODE_STANDBY
,
381 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
382 | REGULATOR_CHANGE_MODE
383 | REGULATOR_CHANGE_STATUS
,
385 .num_consumer_supplies
= 1,
386 .consumer_supplies
= sdp4430_vmmc_supply
,
389 static struct regulator_init_data sdp4430_vpp
= {
394 .valid_modes_mask
= REGULATOR_MODE_NORMAL
395 | REGULATOR_MODE_STANDBY
,
396 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
397 | REGULATOR_CHANGE_MODE
398 | REGULATOR_CHANGE_STATUS
,
402 static struct regulator_init_data sdp4430_vusim
= {
407 .valid_modes_mask
= REGULATOR_MODE_NORMAL
408 | REGULATOR_MODE_STANDBY
,
409 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
410 | REGULATOR_CHANGE_MODE
411 | REGULATOR_CHANGE_STATUS
,
415 static struct regulator_init_data sdp4430_vana
= {
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_vcxio
= {
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 regulator_init_data sdp4430_vdac
= {
444 .valid_modes_mask
= REGULATOR_MODE_NORMAL
445 | REGULATOR_MODE_STANDBY
,
446 .valid_ops_mask
= REGULATOR_CHANGE_MODE
447 | REGULATOR_CHANGE_STATUS
,
451 static struct regulator_init_data sdp4430_vusb
= {
456 .valid_modes_mask
= REGULATOR_MODE_NORMAL
457 | REGULATOR_MODE_STANDBY
,
458 .valid_ops_mask
= REGULATOR_CHANGE_MODE
459 | REGULATOR_CHANGE_STATUS
,
463 static struct twl4030_platform_data sdp4430_twldata
= {
464 .irq_base
= TWL6030_IRQ_BASE
,
465 .irq_end
= TWL6030_IRQ_END
,
468 .vmmc
= &sdp4430_vmmc
,
470 .vusim
= &sdp4430_vusim
,
471 .vana
= &sdp4430_vana
,
472 .vcxio
= &sdp4430_vcxio
,
473 .vdac
= &sdp4430_vdac
,
474 .vusb
= &sdp4430_vusb
,
475 .vaux1
= &sdp4430_vaux1
,
476 .vaux2
= &sdp4430_vaux2
,
477 .vaux3
= &sdp4430_vaux3
,
480 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo
[] = {
482 I2C_BOARD_INFO("twl6030", 0x48),
483 .flags
= I2C_CLIENT_WAKE
,
484 .irq
= OMAP44XX_IRQ_SYS_1N
,
485 .platform_data
= &sdp4430_twldata
,
488 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo
[] = {
490 I2C_BOARD_INFO("tmp105", 0x48),
493 I2C_BOARD_INFO("bh1780", 0x29),
496 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo
[] = {
498 I2C_BOARD_INFO("hmc5843", 0x1e),
501 static int __init
omap4_i2c_init(void)
504 * Phoenix Audio IC needs I2C1 to
505 * start with 400 KHz or less
507 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo
,
508 ARRAY_SIZE(sdp4430_i2c_boardinfo
));
509 omap_register_i2c_bus(2, 400, NULL
, 0);
510 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo
,
511 ARRAY_SIZE(sdp4430_i2c_3_boardinfo
));
512 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo
,
513 ARRAY_SIZE(sdp4430_i2c_4_boardinfo
));
517 static void __init
omap_sfh7741prox_init(void)
521 error
= gpio_request(OMAP4_SFH7741_ENABLE_GPIO
, "sfh7741");
523 pr_err("%s:failed to request GPIO %d, error %d\n",
524 __func__
, OMAP4_SFH7741_ENABLE_GPIO
, error
);
528 error
= gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO
, 0);
530 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
531 __func__
, OMAP4_SFH7741_ENABLE_GPIO
, error
);
532 gpio_free(OMAP4_SFH7741_ENABLE_GPIO
);
536 #ifdef CONFIG_OMAP_MUX
537 static struct omap_board_mux board_mux
[] __initdata
= {
538 { .reg_offset
= OMAP_MUX_TERMINATOR
},
541 #define board_mux NULL
544 static void __init
omap_4430sdp_init(void)
547 int package
= OMAP_PACKAGE_CBS
;
549 if (omap_rev() == OMAP4430_REV_ES1_0
)
550 package
= OMAP_PACKAGE_CBL
;
551 omap4_mux_init(board_mux
, package
);
554 omap_sfh7741prox_init();
555 platform_add_devices(sdp4430_devices
, ARRAY_SIZE(sdp4430_devices
));
557 omap4_twl6030_hsmmc_init(mmc
);
558 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
559 usb_nop_xceiv_register();
560 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
561 if (!cpu_is_omap44xx())
562 usb_musb_init(&musb_board_data
);
564 status
= omap_ethernet_init();
566 pr_err("Ethernet initialization failed: %d\n", status
);
568 sdp4430_spi_board_info
[0].irq
= gpio_to_irq(ETH_KS8851_IRQ
);
569 spi_register_board_info(sdp4430_spi_board_info
,
570 ARRAY_SIZE(sdp4430_spi_board_info
));
574 static void __init
omap_4430sdp_map_io(void)
576 omap2_set_globals_443x();
577 omap44xx_map_common_io();
580 MACHINE_START(OMAP_4430SDP
, "OMAP4430 4430SDP board")
581 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
582 .boot_params
= 0x80000100,
583 .map_io
= omap_4430sdp_map_io
,
584 .reserve
= omap_reserve
,
585 .init_irq
= omap_4430sdp_init_irq
,
586 .init_machine
= omap_4430sdp_init
,
587 .timer
= &omap_timer
,