diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-omap4panda.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap4panda.c | 111 |
1 files changed, 94 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 30ad40db2cf3..8bf8e99c358e 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/regulator/machine.h> | 28 | #include <linux/regulator/machine.h> |
29 | #include <linux/regulator/fixed.h> | 29 | #include <linux/regulator/fixed.h> |
30 | #include <linux/wl12xx.h> | 30 | #include <linux/wl12xx.h> |
31 | #include <linux/platform_data/omap-abe-twl6040.h> | ||
31 | 32 | ||
32 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
33 | #include <asm/hardware/gic.h> | 34 | #include <asm/hardware/gic.h> |
@@ -51,8 +52,9 @@ | |||
51 | #define GPIO_HUB_NRESET 62 | 52 | #define GPIO_HUB_NRESET 62 |
52 | #define GPIO_WIFI_PMENA 43 | 53 | #define GPIO_WIFI_PMENA 43 |
53 | #define GPIO_WIFI_IRQ 53 | 54 | #define GPIO_WIFI_IRQ 53 |
54 | #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ | 55 | #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ |
55 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ | 56 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ |
57 | #define HDMI_GPIO_HPD 63 /* Hotplug detect */ | ||
56 | 58 | ||
57 | /* wl127x BT, FM, GPS connectivity chip */ | 59 | /* wl127x BT, FM, GPS connectivity chip */ |
58 | static int wl1271_gpios[] = {46, -1, -1}; | 60 | static int wl1271_gpios[] = {46, -1, -1}; |
@@ -90,9 +92,40 @@ static struct platform_device leds_gpio = { | |||
90 | }, | 92 | }, |
91 | }; | 93 | }; |
92 | 94 | ||
95 | static struct omap_abe_twl6040_data panda_abe_audio_data = { | ||
96 | /* Audio out */ | ||
97 | .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, | ||
98 | /* HandsFree through expasion connector */ | ||
99 | .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, | ||
100 | /* PandaBoard: FM TX, PandaBoardES: can be connected to audio out */ | ||
101 | .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, | ||
102 | /* PandaBoard: FM RX, PandaBoardES: audio in */ | ||
103 | .has_afm = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, | ||
104 | /* No jack detection. */ | ||
105 | .jack_detection = 0, | ||
106 | /* MCLK input is 38.4MHz */ | ||
107 | .mclk_freq = 38400000, | ||
108 | |||
109 | }; | ||
110 | |||
111 | static struct platform_device panda_abe_audio = { | ||
112 | .name = "omap-abe-twl6040", | ||
113 | .id = -1, | ||
114 | .dev = { | ||
115 | .platform_data = &panda_abe_audio_data, | ||
116 | }, | ||
117 | }; | ||
118 | |||
119 | static struct platform_device btwilink_device = { | ||
120 | .name = "btwilink", | ||
121 | .id = -1, | ||
122 | }; | ||
123 | |||
93 | static struct platform_device *panda_devices[] __initdata = { | 124 | static struct platform_device *panda_devices[] __initdata = { |
94 | &leds_gpio, | 125 | &leds_gpio, |
95 | &wl1271_device, | 126 | &wl1271_device, |
127 | &panda_abe_audio, | ||
128 | &btwilink_device, | ||
96 | }; | 129 | }; |
97 | 130 | ||
98 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | 131 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { |
@@ -205,7 +238,7 @@ struct wl12xx_platform_data omap_panda_wlan_data __initdata = { | |||
205 | 238 | ||
206 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) | 239 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) |
207 | { | 240 | { |
208 | int ret = 0; | 241 | int irq = 0; |
209 | struct platform_device *pdev = container_of(dev, | 242 | struct platform_device *pdev = container_of(dev, |
210 | struct platform_device, dev); | 243 | struct platform_device, dev); |
211 | struct omap_mmc_platform_data *pdata = dev->platform_data; | 244 | struct omap_mmc_platform_data *pdata = dev->platform_data; |
@@ -216,14 +249,15 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) | |||
216 | } | 249 | } |
217 | /* Setting MMC1 Card detect Irq */ | 250 | /* Setting MMC1 Card detect Irq */ |
218 | if (pdev->id == 0) { | 251 | if (pdev->id == 0) { |
219 | ret = twl6030_mmc_card_detect_config(); | 252 | irq = twl6030_mmc_card_detect_config(); |
220 | if (ret) | 253 | if (irq < 0) { |
221 | dev_err(dev, "%s: Error card detect config(%d)\n", | 254 | dev_err(dev, "%s: Error card detect config(%d)\n", |
222 | __func__, ret); | 255 | __func__, irq); |
223 | else | 256 | return irq; |
224 | pdata->slots[0].card_detect = twl6030_mmc_card_detect; | 257 | } |
258 | pdata->slots[0].card_detect = twl6030_mmc_card_detect; | ||
225 | } | 259 | } |
226 | return ret; | 260 | return 0; |
227 | } | 261 | } |
228 | 262 | ||
229 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) | 263 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) |
@@ -244,15 +278,32 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |||
244 | { | 278 | { |
245 | struct omap2_hsmmc_info *c; | 279 | struct omap2_hsmmc_info *c; |
246 | 280 | ||
247 | omap2_hsmmc_init(controllers); | 281 | omap_hsmmc_init(controllers); |
248 | for (c = controllers; c->mmc; c++) | 282 | for (c = controllers; c->mmc; c++) |
249 | omap4_twl6030_hsmmc_set_late_init(c->dev); | 283 | omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev); |
250 | 284 | ||
251 | return 0; | 285 | return 0; |
252 | } | 286 | } |
253 | 287 | ||
288 | static struct twl4030_codec_data twl6040_codec = { | ||
289 | /* single-step ramp for headset and handsfree */ | ||
290 | .hs_left_step = 0x0f, | ||
291 | .hs_right_step = 0x0f, | ||
292 | .hf_left_step = 0x1d, | ||
293 | .hf_right_step = 0x1d, | ||
294 | }; | ||
295 | |||
296 | static struct twl4030_audio_data twl6040_audio = { | ||
297 | .codec = &twl6040_codec, | ||
298 | .audpwron_gpio = 127, | ||
299 | .naudint_irq = OMAP44XX_IRQ_SYS_2N, | ||
300 | .irq_base = TWL6040_CODEC_IRQ_BASE, | ||
301 | }; | ||
302 | |||
254 | /* Panda board uses the common PMIC configuration */ | 303 | /* Panda board uses the common PMIC configuration */ |
255 | static struct twl4030_platform_data omap4_panda_twldata; | 304 | static struct twl4030_platform_data omap4_panda_twldata = { |
305 | .audio = &twl6040_audio, | ||
306 | }; | ||
256 | 307 | ||
257 | /* | 308 | /* |
258 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM | 309 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM |
@@ -413,8 +464,9 @@ int __init omap4_panda_dvi_init(void) | |||
413 | } | 464 | } |
414 | 465 | ||
415 | static struct gpio panda_hdmi_gpios[] = { | 466 | static struct gpio panda_hdmi_gpios[] = { |
416 | { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, | 467 | { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, |
417 | { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, | 468 | { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, |
469 | { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" }, | ||
418 | }; | 470 | }; |
419 | 471 | ||
420 | static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) | 472 | static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) |
@@ -431,10 +483,13 @@ static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) | |||
431 | 483 | ||
432 | static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev) | 484 | static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev) |
433 | { | 485 | { |
434 | gpio_free(HDMI_GPIO_LS_OE); | 486 | gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios)); |
435 | gpio_free(HDMI_GPIO_HPD); | ||
436 | } | 487 | } |
437 | 488 | ||
489 | static struct omap_dss_hdmi_data omap4_panda_hdmi_data = { | ||
490 | .hpd_gpio = HDMI_GPIO_HPD, | ||
491 | }; | ||
492 | |||
438 | static struct omap_dss_device omap4_panda_hdmi_device = { | 493 | static struct omap_dss_device omap4_panda_hdmi_device = { |
439 | .name = "hdmi", | 494 | .name = "hdmi", |
440 | .driver_name = "hdmi_panel", | 495 | .driver_name = "hdmi_panel", |
@@ -442,6 +497,7 @@ static struct omap_dss_device omap4_panda_hdmi_device = { | |||
442 | .platform_enable = omap4_panda_panel_enable_hdmi, | 497 | .platform_enable = omap4_panda_panel_enable_hdmi, |
443 | .platform_disable = omap4_panda_panel_disable_hdmi, | 498 | .platform_disable = omap4_panda_panel_disable_hdmi, |
444 | .channel = OMAP_DSS_CHANNEL_DIGIT, | 499 | .channel = OMAP_DSS_CHANNEL_DIGIT, |
500 | .data = &omap4_panda_hdmi_data, | ||
445 | }; | 501 | }; |
446 | 502 | ||
447 | static struct omap_dss_device *omap4_panda_dss_devices[] = { | 503 | static struct omap_dss_device *omap4_panda_dss_devices[] = { |
@@ -455,7 +511,7 @@ static struct omap_dss_board_info omap4_panda_dss_data = { | |||
455 | .default_device = &omap4_panda_dvi_device, | 511 | .default_device = &omap4_panda_dvi_device, |
456 | }; | 512 | }; |
457 | 513 | ||
458 | void omap4_panda_display_init(void) | 514 | void __init omap4_panda_display_init(void) |
459 | { | 515 | { |
460 | int r; | 516 | int r; |
461 | 517 | ||
@@ -473,19 +529,40 @@ void omap4_panda_display_init(void) | |||
473 | omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); | 529 | omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); |
474 | else | 530 | else |
475 | omap_hdmi_init(0); | 531 | omap_hdmi_init(0); |
532 | |||
533 | omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT); | ||
534 | omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT); | ||
535 | omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); | ||
536 | } | ||
537 | |||
538 | static void omap4_panda_init_rev(void) | ||
539 | { | ||
540 | if (cpu_is_omap443x()) { | ||
541 | /* PandaBoard 4430 */ | ||
542 | /* ASoC audio configuration */ | ||
543 | panda_abe_audio_data.card_name = "PandaBoard"; | ||
544 | panda_abe_audio_data.has_hsmic = 1; | ||
545 | } else { | ||
546 | /* PandaBoard ES */ | ||
547 | /* ASoC audio configuration */ | ||
548 | panda_abe_audio_data.card_name = "PandaBoardES"; | ||
549 | } | ||
476 | } | 550 | } |
477 | 551 | ||
478 | static void __init omap4_panda_init(void) | 552 | static void __init omap4_panda_init(void) |
479 | { | 553 | { |
480 | int package = OMAP_PACKAGE_CBS; | 554 | int package = OMAP_PACKAGE_CBS; |
555 | int ret; | ||
481 | 556 | ||
482 | if (omap_rev() == OMAP4430_REV_ES1_0) | 557 | if (omap_rev() == OMAP4430_REV_ES1_0) |
483 | package = OMAP_PACKAGE_CBL; | 558 | package = OMAP_PACKAGE_CBL; |
484 | omap4_mux_init(board_mux, NULL, package); | 559 | omap4_mux_init(board_mux, NULL, package); |
485 | 560 | ||
486 | if (wl12xx_set_platform_data(&omap_panda_wlan_data)) | 561 | ret = wl12xx_set_platform_data(&omap_panda_wlan_data); |
487 | pr_err("error setting wl12xx data\n"); | 562 | if (ret) |
563 | pr_err("error setting wl12xx data: %d\n", ret); | ||
488 | 564 | ||
565 | omap4_panda_init_rev(); | ||
489 | omap4_panda_i2c_init(); | 566 | omap4_panda_i2c_init(); |
490 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); | 567 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); |
491 | platform_device_register(&omap_vwlan_device); | 568 | platform_device_register(&omap_vwlan_device); |