diff options
author | Joel A Fernandes <joelagnel@ti.com> | 2011-07-05 06:38:22 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-07-05 06:38:22 -0400 |
commit | 5fe8b4c19dc24e3bb873daf9e96a2439a83bbd79 (patch) | |
tree | 215ca72fe0f99e31bd5e51f473a6c682be4486a1 /arch/arm/mach-omap2/board-omap3beagle.c | |
parent | 094fc5593174e48366804484e2070f178a5317cb (diff) |
OMAP3: beagle: add support for beagleboard xM revision C
OMAP3: beagle: add support for beagleboard xM revision C
The USB enable GPIO has been in beagleboard xM revision C.
The USER button has been moved since beagleboard xM.
Also, board specific initialization has been moved to beagle_config struct
and initialized in omap3_beagle_init_rev. Default values in struct are for xMC.
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Acked-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3beagle.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 2d8dfb3213bf..78cf5f221f83 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -60,7 +60,8 @@ | |||
60 | * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 | 60 | * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1 |
61 | * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 | 61 | * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0 |
62 | * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 | 62 | * C4 = GPIO173, GPIO172, GPIO171: 1 0 1 |
63 | * XM = GPIO173, GPIO172, GPIO171: 0 0 0 | 63 | * XMA/XMB = GPIO173, GPIO172, GPIO171: 0 0 0 |
64 | * XMC = GPIO173, GPIO172, GPIO171: 0 1 0 | ||
64 | */ | 65 | */ |
65 | enum { | 66 | enum { |
66 | OMAP3BEAGLE_BOARD_UNKN = 0, | 67 | OMAP3BEAGLE_BOARD_UNKN = 0, |
@@ -68,14 +69,26 @@ enum { | |||
68 | OMAP3BEAGLE_BOARD_C1_3, | 69 | OMAP3BEAGLE_BOARD_C1_3, |
69 | OMAP3BEAGLE_BOARD_C4, | 70 | OMAP3BEAGLE_BOARD_C4, |
70 | OMAP3BEAGLE_BOARD_XM, | 71 | OMAP3BEAGLE_BOARD_XM, |
72 | OMAP3BEAGLE_BOARD_XMC, | ||
71 | }; | 73 | }; |
72 | 74 | ||
73 | static u8 omap3_beagle_version; | 75 | static u8 omap3_beagle_version; |
74 | 76 | ||
75 | static u8 omap3_beagle_get_rev(void) | 77 | /* |
76 | { | 78 | * Board-specific configuration |
77 | return omap3_beagle_version; | 79 | * Defaults to BeagleBoard-xMC |
78 | } | 80 | */ |
81 | static 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 | }; | ||
79 | 92 | ||
80 | static struct gpio omap3_beagle_rev_gpios[] __initdata = { | 93 | static struct gpio omap3_beagle_rev_gpios[] __initdata = { |
81 | { 171, GPIOF_IN, "rev_id_0" }, | 94 | { 171, GPIOF_IN, "rev_id_0" }, |
@@ -110,18 +123,32 @@ static void __init omap3_beagle_init_rev(void) | |||
110 | case 7: | 123 | case 7: |
111 | printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); | 124 | printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); |
112 | 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; | ||
113 | break; | 129 | break; |
114 | case 6: | 130 | case 6: |
115 | printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); | 131 | printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); |
116 | 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; | ||
117 | break; | 136 | break; |
118 | case 5: | 137 | case 5: |
119 | printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); | 138 | printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); |
120 | 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; | ||
121 | break; | 143 | break; |
122 | case 0: | 144 | case 0: |
123 | printk(KERN_INFO "OMAP3 Beagle Rev: xM\n"); | 145 | printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n"); |
124 | 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; | ||
125 | break; | 152 | break; |
126 | default: | 153 | default: |
127 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); | 154 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); |
@@ -234,7 +261,7 @@ static struct omap2_hsmmc_info mmc[] = { | |||
234 | { | 261 | { |
235 | .mmc = 1, | 262 | .mmc = 1, |
236 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, | 263 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
237 | .gpio_wp = 29, | 264 | .gpio_wp = -EINVAL, |
238 | }, | 265 | }, |
239 | {} /* Terminator */ | 266 | {} /* Terminator */ |
240 | }; | 267 | }; |
@@ -252,17 +279,11 @@ static struct gpio_led gpio_leds[]; | |||
252 | static int beagle_twl_gpio_setup(struct device *dev, | 279 | static int beagle_twl_gpio_setup(struct device *dev, |
253 | unsigned gpio, unsigned ngpio) | 280 | unsigned gpio, unsigned ngpio) |
254 | { | 281 | { |
255 | int r, usb_pwr_level; | 282 | int r; |
256 | 283 | ||
257 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 284 | if (beagle_config.mmc1_gpio_wp != -EINVAL) |
258 | mmc[0].gpio_wp = -EINVAL; | 285 | omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT); |
259 | } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) || | 286 | 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) */ | 287 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
267 | mmc[0].gpio_cd = gpio + 0; | 288 | mmc[0].gpio_cd = gpio + 0; |
268 | omap2_hsmmc_init(mmc); | 289 | omap2_hsmmc_init(mmc); |
@@ -272,9 +293,8 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
272 | * high / others active low) | 293 | * high / others active low) |
273 | * DVI reset GPIO is different between beagle revisions | 294 | * DVI reset GPIO is different between beagle revisions |
274 | */ | 295 | */ |
275 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 296 | /* Valid for all -xM revisions */ |
276 | usb_pwr_level = GPIOF_OUT_INIT_HIGH; | 297 | if (cpu_is_omap3630()) { |
277 | beagle_dvi_device.reset_gpio = 129; | ||
278 | /* | 298 | /* |
279 | * gpio + 1 on Xm controls the TFP410's enable line (active low) | 299 | * gpio + 1 on Xm controls the TFP410's enable line (active low) |
280 | * gpio + 2 control varies depending on the board rev as below: | 300 | * gpio + 2 control varies depending on the board rev as below: |
@@ -292,8 +312,6 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
292 | pr_err("%s: unable to configure DVI_LDO_EN\n", | 312 | pr_err("%s: unable to configure DVI_LDO_EN\n", |
293 | __func__); | 313 | __func__); |
294 | } else { | 314 | } else { |
295 | usb_pwr_level = GPIOF_OUT_INIT_LOW; | ||
296 | beagle_dvi_device.reset_gpio = 170; | ||
297 | /* | 315 | /* |
298 | * REVISIT: need ehci-omap hooks for external VBUS | 316 | * REVISIT: need ehci-omap hooks for external VBUS |
299 | * power switch and overcurrent detect | 317 | * power switch and overcurrent detect |
@@ -301,8 +319,10 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
301 | if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) | 319 | if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) |
302 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | 320 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); |
303 | } | 321 | } |
322 | beagle_dvi_device.reset_gpio = beagle_config.reset_gpio; | ||
304 | 323 | ||
305 | gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR"); | 324 | gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, |
325 | "nEN_USB_PWR"); | ||
306 | 326 | ||
307 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | 327 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ |
308 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 328 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
@@ -454,7 +474,8 @@ static struct platform_device leds_gpio = { | |||
454 | static struct gpio_keys_button gpio_buttons[] = { | 474 | static struct gpio_keys_button gpio_buttons[] = { |
455 | { | 475 | { |
456 | .code = BTN_EXTRA, | 476 | .code = BTN_EXTRA, |
457 | .gpio = 7, | 477 | /* Dynamically assigned depending on board */ |
478 | .gpio = -EINVAL, | ||
458 | .desc = "user", | 479 | .desc = "user", |
459 | .wakeup = 1, | 480 | .wakeup = 1, |
460 | }, | 481 | }, |
@@ -518,8 +539,8 @@ static void __init beagle_opp_init(void) | |||
518 | return; | 539 | return; |
519 | } | 540 | } |
520 | 541 | ||
521 | /* Custom OPP enabled for XM */ | 542 | /* Custom OPP enabled for all xM versions */ |
522 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 543 | if (cpu_is_omap3630()) { |
523 | struct omap_hwmod *mh = omap_hwmod_lookup("mpu"); | 544 | struct omap_hwmod *mh = omap_hwmod_lookup("mpu"); |
524 | struct omap_hwmod *dh = omap_hwmod_lookup("iva"); | 545 | struct omap_hwmod *dh = omap_hwmod_lookup("iva"); |
525 | struct device *dev; | 546 | struct device *dev; |
@@ -559,6 +580,9 @@ static void __init omap3_beagle_init(void) | |||
559 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 580 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
560 | omap3_beagle_init_rev(); | 581 | omap3_beagle_init_rev(); |
561 | omap3_beagle_i2c_init(); | 582 | omap3_beagle_i2c_init(); |
583 | |||
584 | gpio_buttons[0].gpio = beagle_config.usr_button_gpio; | ||
585 | |||
562 | platform_add_devices(omap3_beagle_devices, | 586 | platform_add_devices(omap3_beagle_devices, |
563 | ARRAY_SIZE(omap3_beagle_devices)); | 587 | ARRAY_SIZE(omap3_beagle_devices)); |
564 | omap_display_init(&beagle_dss_data); | 588 | omap_display_init(&beagle_dss_data); |