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.c128
1 files changed, 45 insertions, 83 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index bc30ab092d1e..3ff3a2c4b86e 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -80,6 +80,12 @@ static u8 omap3_beagle_get_rev(void)
80 return omap3_beagle_version; 80 return omap3_beagle_version;
81} 81}
82 82
83static struct gpio omap3_beagle_rev_gpios[] __initdata = {
84 { 171, GPIOF_IN, "rev_id_0" },
85 { 172, GPIOF_IN, "rev_id_1" },
86 { 173, GPIOF_IN, "rev_id_2" },
87};
88
83static void __init omap3_beagle_init_rev(void) 89static void __init omap3_beagle_init_rev(void)
84{ 90{
85 int ret; 91 int ret;
@@ -89,21 +95,13 @@ static void __init omap3_beagle_init_rev(void)
89 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); 95 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
90 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); 96 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
91 97
92 ret = gpio_request(171, "rev_id_0"); 98 ret = gpio_request_array(omap3_beagle_rev_gpios,
93 if (ret < 0) 99 ARRAY_SIZE(omap3_beagle_rev_gpios));
94 goto fail0; 100 if (ret < 0) {
95 101 printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
96 ret = gpio_request(172, "rev_id_1"); 102 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
97 if (ret < 0) 103 return;
98 goto fail1; 104 }
99
100 ret = gpio_request(173, "rev_id_2");
101 if (ret < 0)
102 goto fail2;
103
104 gpio_direction_input(171);
105 gpio_direction_input(172);
106 gpio_direction_input(173);
107 105
108 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) 106 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
109 | (gpio_get_value(173) << 2); 107 | (gpio_get_value(173) << 2);
@@ -129,18 +127,6 @@ static void __init omap3_beagle_init_rev(void)
129 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); 127 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
130 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; 128 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
131 } 129 }
132
133 return;
134
135fail2:
136 gpio_free(172);
137fail1:
138 gpio_free(171);
139fail0:
140 printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
141 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
142
143 return;
144} 130}
145 131
146static struct mtd_partition omap3beagle_nand_partitions[] = { 132static struct mtd_partition omap3beagle_nand_partitions[] = {
@@ -235,13 +221,10 @@ static void __init beagle_display_init(void)
235{ 221{
236 int r; 222 int r;
237 223
238 r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); 224 r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
239 if (r < 0) { 225 "DVI reset");
226 if (r < 0)
240 printk(KERN_ERR "Unable to get DVI reset GPIO\n"); 227 printk(KERN_ERR "Unable to get DVI reset GPIO\n");
241 return;
242 }
243
244 gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
245} 228}
246 229
247#include "sdram-micron-mt46h32m32lf-6.h" 230#include "sdram-micron-mt46h32m32lf-6.h"
@@ -268,7 +251,7 @@ static struct gpio_led gpio_leds[];
268static int beagle_twl_gpio_setup(struct device *dev, 251static int beagle_twl_gpio_setup(struct device *dev,
269 unsigned gpio, unsigned ngpio) 252 unsigned gpio, unsigned ngpio)
270{ 253{
271 int r; 254 int r, usb_pwr_level;
272 255
273 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 256 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
274 mmc[0].gpio_wp = -EINVAL; 257 mmc[0].gpio_wp = -EINVAL;
@@ -287,66 +270,46 @@ static int beagle_twl_gpio_setup(struct device *dev,
287 beagle_vmmc1_supply.dev = mmc[0].dev; 270 beagle_vmmc1_supply.dev = mmc[0].dev;
288 beagle_vsim_supply.dev = mmc[0].dev; 271 beagle_vsim_supply.dev = mmc[0].dev;
289 272
290 /* REVISIT: need ehci-omap hooks for external VBUS
291 * power switch and overcurrent detect
292 */
293 if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) {
294 r = gpio_request(gpio + 1, "EHCI_nOC");
295 if (!r) {
296 r = gpio_direction_input(gpio + 1);
297 if (r)
298 gpio_free(gpio + 1);
299 }
300 if (r)
301 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
302 }
303
304 /* 273 /*
305 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active 274 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active
306 * high / others active low) 275 * high / others active low)
307 */ 276 * DVI reset GPIO is different between beagle revisions
308 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
309 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
310 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1);
311 else
312 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
313
314 /* DVI reset GPIO is different between beagle revisions */
315 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM)
316 beagle_dvi_device.reset_gpio = 129;
317 else
318 beagle_dvi_device.reset_gpio = 170;
319
320 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
321 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
322
323 /*
324 * gpio + 1 on Xm controls the TFP410's enable line (active low)
325 * gpio + 2 control varies depending on the board rev as follows:
326 * P7/P8 revisions(prototype): Camera EN
327 * A2+ revisions (production): LDO (supplies DVI, serial, led blocks)
328 */ 277 */
329 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 278 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
330 r = gpio_request(gpio + 1, "nDVI_PWR_EN"); 279 usb_pwr_level = GPIOF_OUT_INIT_HIGH;
331 if (!r) { 280 beagle_dvi_device.reset_gpio = 129;
332 r = gpio_direction_output(gpio + 1, 0); 281 /*
333 if (r) 282 * gpio + 1 on Xm controls the TFP410's enable line (active low)
334 gpio_free(gpio + 1); 283 * gpio + 2 control varies depending on the board rev as below:
335 } 284 * P7/P8 revisions(prototype): Camera EN
285 * A2+ revisions (production): LDO (DVI, serial, led blocks)
286 */
287 r = gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW,
288 "nDVI_PWR_EN");
336 if (r) 289 if (r)
337 pr_err("%s: unable to configure nDVI_PWR_EN\n", 290 pr_err("%s: unable to configure nDVI_PWR_EN\n",
338 __func__); 291 __func__);
339 r = gpio_request(gpio + 2, "DVI_LDO_EN"); 292 r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
340 if (!r) { 293 "DVI_LDO_EN");
341 r = gpio_direction_output(gpio + 2, 1);
342 if (r)
343 gpio_free(gpio + 2);
344 }
345 if (r) 294 if (r)
346 pr_err("%s: unable to configure DVI_LDO_EN\n", 295 pr_err("%s: unable to configure DVI_LDO_EN\n",
347 __func__); 296 __func__);
297 } else {
298 usb_pwr_level = GPIOF_OUT_INIT_LOW;
299 beagle_dvi_device.reset_gpio = 170;
300 /*
301 * REVISIT: need ehci-omap hooks for external VBUS
302 * power switch and overcurrent detect
303 */
304 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
305 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
348 } 306 }
349 307
308 gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR");
309
310 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
311 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
312
350 return 0; 313 return 0;
351} 314}
352 315
@@ -608,9 +571,8 @@ static void __init omap3_beagle_init(void)
608 omap_serial_init(); 571 omap_serial_init();
609 572
610 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 573 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
611 gpio_request(170, "DVI_nPD");
612 /* REVISIT leave DVI powered down until it's needed ... */ 574 /* REVISIT leave DVI powered down until it's needed ... */
613 gpio_direction_output(170, true); 575 gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
614 576
615 usb_musb_init(NULL); 577 usb_musb_init(NULL);
616 usbhs_init(&usbhs_bdata); 578 usbhs_init(&usbhs_bdata);