aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-omap3beagle.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3beagle.c')
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c190
1 files changed, 77 insertions, 113 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 7f21d24bd43..3ae16b4e3f5 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -50,7 +50,6 @@
50 50
51#include "mux.h" 51#include "mux.h"
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "timer-gp.h"
54#include "pm.h" 53#include "pm.h"
55#include "common-board-devices.h" 54#include "common-board-devices.h"
56 55
@@ -61,7 +60,8 @@
61 * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 60 * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
62 * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 61 * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
63 * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 62 * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
64 * XM = GPIO173, GPIO172, GPIO171: 0 0 0 63 * XMA/XMB = GPIO173, GPIO172, GPIO171: 0 0 0
64 * XMC = GPIO173, GPIO172, GPIO171: 0 1 0
65 */ 65 */
66enum { 66enum {
67 OMAP3BEAGLE_BOARD_UNKN = 0, 67 OMAP3BEAGLE_BOARD_UNKN = 0,
@@ -69,14 +69,26 @@ enum {
69 OMAP3BEAGLE_BOARD_C1_3, 69 OMAP3BEAGLE_BOARD_C1_3,
70 OMAP3BEAGLE_BOARD_C4, 70 OMAP3BEAGLE_BOARD_C4,
71 OMAP3BEAGLE_BOARD_XM, 71 OMAP3BEAGLE_BOARD_XM,
72 OMAP3BEAGLE_BOARD_XMC,
72}; 73};
73 74
74static u8 omap3_beagle_version; 75static u8 omap3_beagle_version;
75 76
76static u8 omap3_beagle_get_rev(void) 77/*
77{ 78 * Board-specific configuration
78 return omap3_beagle_version; 79 * Defaults to BeagleBoard-xMC
79} 80 */
81static struct {
82 int mmc1_gpio_wp;
83 int usb_pwr_level;
84 int reset_gpio;
85 int usr_button_gpio;
86} beagle_config = {
87 .mmc1_gpio_wp = -EINVAL,
88 .usb_pwr_level = GPIOF_OUT_INIT_LOW,
89 .reset_gpio = 129,
90 .usr_button_gpio = 4,
91};
80 92
81static struct gpio omap3_beagle_rev_gpios[] __initdata = { 93static struct gpio omap3_beagle_rev_gpios[] __initdata = {
82 { 171, GPIOF_IN, "rev_id_0" }, 94 { 171, GPIOF_IN, "rev_id_0" },
@@ -111,18 +123,32 @@ static void __init omap3_beagle_init_rev(void)
111 case 7: 123 case 7:
112 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); 124 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
113 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; 125 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
126 beagle_config.mmc1_gpio_wp = 29;
127 beagle_config.reset_gpio = 170;
128 beagle_config.usr_button_gpio = 7;
114 break; 129 break;
115 case 6: 130 case 6:
116 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); 131 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
117 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; 132 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
133 beagle_config.mmc1_gpio_wp = 23;
134 beagle_config.reset_gpio = 170;
135 beagle_config.usr_button_gpio = 7;
118 break; 136 break;
119 case 5: 137 case 5:
120 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); 138 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
121 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; 139 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
140 beagle_config.mmc1_gpio_wp = 23;
141 beagle_config.reset_gpio = 170;
142 beagle_config.usr_button_gpio = 7;
122 break; 143 break;
123 case 0: 144 case 0:
124 printk(KERN_INFO "OMAP3 Beagle Rev: xM\n"); 145 printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n");
125 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM; 146 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
147 beagle_config.usb_pwr_level = GPIOF_OUT_INIT_HIGH;
148 break;
149 case 2:
150 printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n");
151 omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC;
126 break; 152 break;
127 default: 153 default:
128 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); 154 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
@@ -210,14 +236,6 @@ static struct omap_dss_board_info beagle_dss_data = {
210 .default_device = &beagle_dvi_device, 236 .default_device = &beagle_dvi_device,
211}; 237};
212 238
213static struct regulator_consumer_supply beagle_vdac_supply =
214 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
215
216static struct regulator_consumer_supply beagle_vdvi_supplies[] = {
217 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
218 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
219};
220
221static void __init beagle_display_init(void) 239static void __init beagle_display_init(void)
222{ 240{
223 int r; 241 int r;
@@ -234,17 +252,17 @@ static struct omap2_hsmmc_info mmc[] = {
234 { 252 {
235 .mmc = 1, 253 .mmc = 1,
236 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 254 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
237 .gpio_wp = 29, 255 .gpio_wp = -EINVAL,
238 }, 256 },
239 {} /* Terminator */ 257 {} /* Terminator */
240}; 258};
241 259
242static struct regulator_consumer_supply beagle_vmmc1_supply = { 260static struct regulator_consumer_supply beagle_vmmc1_supply[] = {
243 .supply = "vmmc", 261 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
244}; 262};
245 263
246static struct regulator_consumer_supply beagle_vsim_supply = { 264static struct regulator_consumer_supply beagle_vsim_supply[] = {
247 .supply = "vmmc_aux", 265 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
248}; 266};
249 267
250static struct gpio_led gpio_leds[]; 268static struct gpio_led gpio_leds[];
@@ -252,33 +270,22 @@ static struct gpio_led gpio_leds[];
252static int beagle_twl_gpio_setup(struct device *dev, 270static int beagle_twl_gpio_setup(struct device *dev,
253 unsigned gpio, unsigned ngpio) 271 unsigned gpio, unsigned ngpio)
254{ 272{
255 int r, usb_pwr_level; 273 int r;
256 274
257 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 275 if (beagle_config.mmc1_gpio_wp != -EINVAL)
258 mmc[0].gpio_wp = -EINVAL; 276 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
259 } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) || 277 mmc[0].gpio_wp = beagle_config.mmc1_gpio_wp;
260 (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) {
261 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
262 mmc[0].gpio_wp = 23;
263 } else {
264 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
265 }
266 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 278 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
267 mmc[0].gpio_cd = gpio + 0; 279 mmc[0].gpio_cd = gpio + 0;
268 omap2_hsmmc_init(mmc); 280 omap2_hsmmc_init(mmc);
269 281
270 /* link regulators to MMC adapters */
271 beagle_vmmc1_supply.dev = mmc[0].dev;
272 beagle_vsim_supply.dev = mmc[0].dev;
273
274 /* 282 /*
275 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active 283 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active
276 * high / others active low) 284 * high / others active low)
277 * DVI reset GPIO is different between beagle revisions 285 * DVI reset GPIO is different between beagle revisions
278 */ 286 */
279 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 287 /* Valid for all -xM revisions */
280 usb_pwr_level = GPIOF_OUT_INIT_HIGH; 288 if (cpu_is_omap3630()) {
281 beagle_dvi_device.reset_gpio = 129;
282 /* 289 /*
283 * gpio + 1 on Xm controls the TFP410's enable line (active low) 290 * gpio + 1 on Xm controls the TFP410's enable line (active low)
284 * gpio + 2 control varies depending on the board rev as below: 291 * gpio + 2 control varies depending on the board rev as below:
@@ -296,8 +303,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
296 pr_err("%s: unable to configure DVI_LDO_EN\n", 303 pr_err("%s: unable to configure DVI_LDO_EN\n",
297 __func__); 304 __func__);
298 } else { 305 } else {
299 usb_pwr_level = GPIOF_OUT_INIT_LOW;
300 beagle_dvi_device.reset_gpio = 170;
301 /* 306 /*
302 * REVISIT: need ehci-omap hooks for external VBUS 307 * REVISIT: need ehci-omap hooks for external VBUS
303 * power switch and overcurrent detect 308 * power switch and overcurrent detect
@@ -305,8 +310,10 @@ static int beagle_twl_gpio_setup(struct device *dev,
305 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 310 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
306 pr_err("%s: unable to configure EHCI_nOC\n", __func__); 311 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
307 } 312 }
313 beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
308 314
309 gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR"); 315 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
316 "nEN_USB_PWR");
310 317
311 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 318 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
312 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 319 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -336,8 +343,8 @@ static struct regulator_init_data beagle_vmmc1 = {
336 | REGULATOR_CHANGE_MODE 343 | REGULATOR_CHANGE_MODE
337 | REGULATOR_CHANGE_STATUS, 344 | REGULATOR_CHANGE_STATUS,
338 }, 345 },
339 .num_consumer_supplies = 1, 346 .num_consumer_supplies = ARRAY_SIZE(beagle_vmmc1_supply),
340 .consumer_supplies = &beagle_vmmc1_supply, 347 .consumer_supplies = beagle_vmmc1_supply,
341}; 348};
342 349
343/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ 350/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
@@ -351,62 +358,15 @@ static struct regulator_init_data beagle_vsim = {
351 | REGULATOR_CHANGE_MODE 358 | REGULATOR_CHANGE_MODE
352 | REGULATOR_CHANGE_STATUS, 359 | REGULATOR_CHANGE_STATUS,
353 }, 360 },
354 .num_consumer_supplies = 1, 361 .num_consumer_supplies = ARRAY_SIZE(beagle_vsim_supply),
355 .consumer_supplies = &beagle_vsim_supply, 362 .consumer_supplies = beagle_vsim_supply,
356};
357
358/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
359static struct regulator_init_data beagle_vdac = {
360 .constraints = {
361 .min_uV = 1800000,
362 .max_uV = 1800000,
363 .valid_modes_mask = REGULATOR_MODE_NORMAL
364 | REGULATOR_MODE_STANDBY,
365 .valid_ops_mask = REGULATOR_CHANGE_MODE
366 | REGULATOR_CHANGE_STATUS,
367 },
368 .num_consumer_supplies = 1,
369 .consumer_supplies = &beagle_vdac_supply,
370};
371
372/* VPLL2 for digital video outputs */
373static struct regulator_init_data beagle_vpll2 = {
374 .constraints = {
375 .name = "VDVI",
376 .min_uV = 1800000,
377 .max_uV = 1800000,
378 .valid_modes_mask = REGULATOR_MODE_NORMAL
379 | REGULATOR_MODE_STANDBY,
380 .valid_ops_mask = REGULATOR_CHANGE_MODE
381 | REGULATOR_CHANGE_STATUS,
382 },
383 .num_consumer_supplies = ARRAY_SIZE(beagle_vdvi_supplies),
384 .consumer_supplies = beagle_vdvi_supplies,
385};
386
387static struct twl4030_usb_data beagle_usb_data = {
388 .usb_mode = T2_USB_MODE_ULPI,
389};
390
391static struct twl4030_codec_audio_data beagle_audio_data;
392
393static struct twl4030_codec_data beagle_codec_data = {
394 .audio_mclk = 26000000,
395 .audio = &beagle_audio_data,
396}; 363};
397 364
398static struct twl4030_platform_data beagle_twldata = { 365static struct twl4030_platform_data beagle_twldata = {
399 .irq_base = TWL4030_IRQ_BASE,
400 .irq_end = TWL4030_IRQ_END,
401
402 /* platform_data for children goes here */ 366 /* platform_data for children goes here */
403 .usb = &beagle_usb_data,
404 .gpio = &beagle_gpio_data, 367 .gpio = &beagle_gpio_data,
405 .codec = &beagle_codec_data,
406 .vmmc1 = &beagle_vmmc1, 368 .vmmc1 = &beagle_vmmc1,
407 .vsim = &beagle_vsim, 369 .vsim = &beagle_vsim,
408 .vdac = &beagle_vdac,
409 .vpll2 = &beagle_vpll2,
410}; 370};
411 371
412static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { 372static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
@@ -417,6 +377,12 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
417 377
418static int __init omap3_beagle_i2c_init(void) 378static int __init omap3_beagle_i2c_init(void)
419{ 379{
380 omap3_pmic_get_config(&beagle_twldata,
381 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
382 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
383
384 beagle_twldata.vpll2->constraints.name = "VDVI";
385
420 omap3_pmic_init("twl4030", &beagle_twldata); 386 omap3_pmic_init("twl4030", &beagle_twldata);
421 /* Bus 3 is attached to the DVI port where devices like the pico DLP 387 /* Bus 3 is attached to the DVI port where devices like the pico DLP
422 * projector don't work reliably with 400kHz */ 388 * projector don't work reliably with 400kHz */
@@ -458,7 +424,8 @@ static struct platform_device leds_gpio = {
458static struct gpio_keys_button gpio_buttons[] = { 424static struct gpio_keys_button gpio_buttons[] = {
459 { 425 {
460 .code = BTN_EXTRA, 426 .code = BTN_EXTRA,
461 .gpio = 7, 427 /* Dynamically assigned depending on board */
428 .gpio = -EINVAL,
462 .desc = "user", 429 .desc = "user",
463 .wakeup = 1, 430 .wakeup = 1,
464 }, 431 },
@@ -486,10 +453,7 @@ static void __init omap3_beagle_init_early(void)
486 453
487static void __init omap3_beagle_init_irq(void) 454static void __init omap3_beagle_init_irq(void)
488{ 455{
489 omap_init_irq(); 456 omap3_init_irq();
490#ifdef CONFIG_OMAP_32K_TIMER
491 omap2_gp_clockevent_set_gptimer(12);
492#endif
493} 457}
494 458
495static struct platform_device *omap3_beagle_devices[] __initdata = { 459static struct platform_device *omap3_beagle_devices[] __initdata = {
@@ -525,25 +489,24 @@ static void __init beagle_opp_init(void)
525 return; 489 return;
526 } 490 }
527 491
528 /* Custom OPP enabled for XM */ 492 /* Custom OPP enabled for all xM versions */
529 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 493 if (cpu_is_omap3630()) {
530 struct omap_hwmod *mh = omap_hwmod_lookup("mpu"); 494 struct device *mpu_dev, *iva_dev;
531 struct omap_hwmod *dh = omap_hwmod_lookup("iva"); 495
532 struct device *dev; 496 mpu_dev = omap2_get_mpuss_device();
497 iva_dev = omap2_get_iva_device();
533 498
534 if (!mh || !dh) { 499 if (!mpu_dev || !iva_dev) {
535 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", 500 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
536 __func__, mh, dh); 501 __func__, mpu_dev, iva_dev);
537 return; 502 return;
538 } 503 }
539 /* Enable MPU 1GHz and lower opps */ 504 /* Enable MPU 1GHz and lower opps */
540 dev = &mh->od->pdev.dev; 505 r = opp_enable(mpu_dev, 800000000);
541 r = opp_enable(dev, 800000000);
542 /* TODO: MPU 1GHz needs SR and ABB */ 506 /* TODO: MPU 1GHz needs SR and ABB */
543 507
544 /* Enable IVA 800MHz and lower opps */ 508 /* Enable IVA 800MHz and lower opps */
545 dev = &dh->od->pdev.dev; 509 r |= opp_enable(iva_dev, 660000000);
546 r |= opp_enable(dev, 660000000);
547 /* TODO: DSP 800MHz needs SR and ABB */ 510 /* TODO: DSP 800MHz needs SR and ABB */
548 if (r) { 511 if (r) {
549 pr_err("%s: failed to enable higher opp %d\n", 512 pr_err("%s: failed to enable higher opp %d\n",
@@ -552,10 +515,8 @@ static void __init beagle_opp_init(void)
552 * Cleanup - disable the higher freqs - we dont care 515 * Cleanup - disable the higher freqs - we dont care
553 * about the results 516 * about the results
554 */ 517 */
555 dev = &mh->od->pdev.dev; 518 opp_disable(mpu_dev, 800000000);
556 opp_disable(dev, 800000000); 519 opp_disable(iva_dev, 660000000);
557 dev = &dh->od->pdev.dev;
558 opp_disable(dev, 660000000);
559 } 520 }
560 } 521 }
561 return; 522 return;
@@ -566,6 +527,9 @@ static void __init omap3_beagle_init(void)
566 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 527 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
567 omap3_beagle_init_rev(); 528 omap3_beagle_init_rev();
568 omap3_beagle_i2c_init(); 529 omap3_beagle_i2c_init();
530
531 gpio_buttons[0].gpio = beagle_config.usr_button_gpio;
532
569 platform_add_devices(omap3_beagle_devices, 533 platform_add_devices(omap3_beagle_devices,
570 ARRAY_SIZE(omap3_beagle_devices)); 534 ARRAY_SIZE(omap3_beagle_devices));
571 omap_display_init(&beagle_dss_data); 535 omap_display_init(&beagle_dss_data);
@@ -599,5 +563,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
599 .init_early = omap3_beagle_init_early, 563 .init_early = omap3_beagle_init_early,
600 .init_irq = omap3_beagle_init_irq, 564 .init_irq = omap3_beagle_init_irq,
601 .init_machine = omap3_beagle_init, 565 .init_machine = omap3_beagle_init,
602 .timer = &omap_timer, 566 .timer = &omap3_secure_timer,
603MACHINE_END 567MACHINE_END