diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 15:11:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 15:11:54 -0400 |
commit | 829ae2732998e628d762b97627e4e5cc6c1b5625 (patch) | |
tree | 7ffdfa365ab54df4fd1742673289621b3f5de2f5 /arch/arm/mach-omap2/board-omap3beagle.c | |
parent | 6ddb4518c7af7b03fa322552d794f759cd5c26fa (diff) | |
parent | 9b28b11e2a648f07c8481b9666ccf1c088e1ab74 (diff) |
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (33 commits)
OMAP3: PM: Boot message is not an error, and not helpful, remove it
OMAP3: cpuidle: change the power domains modes determination logic
OMAP3: cpuidle: code rework for improved readability
OMAP3: cpuidle: re-organize the C-states data
OMAP3: clean-up mach specific cpuidle data structures
OMAP3 cpuidle: remove useless SDP specific timings
usb: otg: OMAP4430: Powerdown the internal PHY when USB is disabled
usb: otg: OMAP4430: Fixing the omap4430_phy_init function
usb: musb: am35x: fix compile error when building am35x
usb: musb: OMAP4430: Power down the PHY during board init
omap: drop board-igep0030.c
omap: igep0020: add support for IGEP3
omap: igep0020: minor refactoring
omap: igep0020: name refactoring for future merge with IGEP3
omap: Remove support for omap2evm
arm: omap2plus: GPIO cleanup
omap: musb: introduce default board config
omap: move detection of NAND CS to common-board-devices
omap: use common initialization for PMIC i2c bus
omap: consolidate touch screen initialization among different boards
...
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3beagle.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 194 |
1 files changed, 50 insertions, 144 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 97750d483a70..be71426359f2 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "hsmmc.h" | 52 | #include "hsmmc.h" |
53 | #include "timer-gp.h" | 53 | #include "timer-gp.h" |
54 | #include "pm.h" | 54 | #include "pm.h" |
55 | #include "common-board-devices.h" | ||
55 | 56 | ||
56 | #define NAND_BLOCK_SIZE SZ_128K | 57 | #define NAND_BLOCK_SIZE SZ_128K |
57 | 58 | ||
@@ -79,6 +80,12 @@ static u8 omap3_beagle_get_rev(void) | |||
79 | return omap3_beagle_version; | 80 | return omap3_beagle_version; |
80 | } | 81 | } |
81 | 82 | ||
83 | static 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 | |||
82 | static void __init omap3_beagle_init_rev(void) | 89 | static void __init omap3_beagle_init_rev(void) |
83 | { | 90 | { |
84 | int ret; | 91 | int ret; |
@@ -88,21 +95,13 @@ static void __init omap3_beagle_init_rev(void) | |||
88 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); | 95 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); |
89 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); | 96 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); |
90 | 97 | ||
91 | ret = gpio_request(171, "rev_id_0"); | 98 | ret = gpio_request_array(omap3_beagle_rev_gpios, |
92 | if (ret < 0) | 99 | ARRAY_SIZE(omap3_beagle_rev_gpios)); |
93 | goto fail0; | 100 | if (ret < 0) { |
94 | 101 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | |
95 | ret = gpio_request(172, "rev_id_1"); | 102 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; |
96 | if (ret < 0) | 103 | return; |
97 | goto fail1; | 104 | } |
98 | |||
99 | ret = gpio_request(173, "rev_id_2"); | ||
100 | if (ret < 0) | ||
101 | goto fail2; | ||
102 | |||
103 | gpio_direction_input(171); | ||
104 | gpio_direction_input(172); | ||
105 | gpio_direction_input(173); | ||
106 | 105 | ||
107 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) | 106 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) |
108 | | (gpio_get_value(173) << 2); | 107 | | (gpio_get_value(173) << 2); |
@@ -128,18 +127,6 @@ static void __init omap3_beagle_init_rev(void) | |||
128 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); | 127 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); |
129 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | 128 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; |
130 | } | 129 | } |
131 | |||
132 | return; | ||
133 | |||
134 | fail2: | ||
135 | gpio_free(172); | ||
136 | fail1: | ||
137 | gpio_free(171); | ||
138 | fail0: | ||
139 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | ||
140 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | ||
141 | |||
142 | return; | ||
143 | } | 130 | } |
144 | 131 | ||
145 | static struct mtd_partition omap3beagle_nand_partitions[] = { | 132 | static struct mtd_partition omap3beagle_nand_partitions[] = { |
@@ -173,15 +160,6 @@ static struct mtd_partition omap3beagle_nand_partitions[] = { | |||
173 | }, | 160 | }, |
174 | }; | 161 | }; |
175 | 162 | ||
176 | static struct omap_nand_platform_data omap3beagle_nand_data = { | ||
177 | .options = NAND_BUSWIDTH_16, | ||
178 | .parts = omap3beagle_nand_partitions, | ||
179 | .nr_parts = ARRAY_SIZE(omap3beagle_nand_partitions), | ||
180 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | ||
181 | .nand_setup = NULL, | ||
182 | .dev_ready = NULL, | ||
183 | }; | ||
184 | |||
185 | /* DSS */ | 163 | /* DSS */ |
186 | 164 | ||
187 | static int beagle_enable_dvi(struct omap_dss_device *dssdev) | 165 | static int beagle_enable_dvi(struct omap_dss_device *dssdev) |
@@ -243,13 +221,10 @@ static void __init beagle_display_init(void) | |||
243 | { | 221 | { |
244 | int r; | 222 | int r; |
245 | 223 | ||
246 | r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); | 224 | r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW, |
247 | if (r < 0) { | 225 | "DVI reset"); |
226 | if (r < 0) | ||
248 | printk(KERN_ERR "Unable to get DVI reset GPIO\n"); | 227 | printk(KERN_ERR "Unable to get DVI reset GPIO\n"); |
249 | return; | ||
250 | } | ||
251 | |||
252 | gpio_direction_output(beagle_dvi_device.reset_gpio, 0); | ||
253 | } | 228 | } |
254 | 229 | ||
255 | #include "sdram-micron-mt46h32m32lf-6.h" | 230 | #include "sdram-micron-mt46h32m32lf-6.h" |
@@ -276,7 +251,7 @@ static struct gpio_led gpio_leds[]; | |||
276 | static int beagle_twl_gpio_setup(struct device *dev, | 251 | static int beagle_twl_gpio_setup(struct device *dev, |
277 | unsigned gpio, unsigned ngpio) | 252 | unsigned gpio, unsigned ngpio) |
278 | { | 253 | { |
279 | int r; | 254 | int r, usb_pwr_level; |
280 | 255 | ||
281 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 256 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { |
282 | mmc[0].gpio_wp = -EINVAL; | 257 | mmc[0].gpio_wp = -EINVAL; |
@@ -295,66 +270,46 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
295 | beagle_vmmc1_supply.dev = mmc[0].dev; | 270 | beagle_vmmc1_supply.dev = mmc[0].dev; |
296 | beagle_vsim_supply.dev = mmc[0].dev; | 271 | beagle_vsim_supply.dev = mmc[0].dev; |
297 | 272 | ||
298 | /* REVISIT: need ehci-omap hooks for external VBUS | ||
299 | * power switch and overcurrent detect | ||
300 | */ | ||
301 | if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) { | ||
302 | r = gpio_request(gpio + 1, "EHCI_nOC"); | ||
303 | if (!r) { | ||
304 | r = gpio_direction_input(gpio + 1); | ||
305 | if (r) | ||
306 | gpio_free(gpio + 1); | ||
307 | } | ||
308 | if (r) | ||
309 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | ||
310 | } | ||
311 | |||
312 | /* | 273 | /* |
313 | * 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 |
314 | * high / others active low) | 275 | * high / others active low) |
315 | */ | 276 | * DVI reset GPIO is different between beagle revisions |
316 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); | ||
317 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) | ||
318 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); | ||
319 | else | ||
320 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | ||
321 | |||
322 | /* DVI reset GPIO is different between beagle revisions */ | ||
323 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) | ||
324 | beagle_dvi_device.reset_gpio = 129; | ||
325 | else | ||
326 | beagle_dvi_device.reset_gpio = 170; | ||
327 | |||
328 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | ||
329 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
330 | |||
331 | /* | ||
332 | * gpio + 1 on Xm controls the TFP410's enable line (active low) | ||
333 | * gpio + 2 control varies depending on the board rev as follows: | ||
334 | * P7/P8 revisions(prototype): Camera EN | ||
335 | * A2+ revisions (production): LDO (supplies DVI, serial, led blocks) | ||
336 | */ | 277 | */ |
337 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 278 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { |
338 | r = gpio_request(gpio + 1, "nDVI_PWR_EN"); | 279 | usb_pwr_level = GPIOF_OUT_INIT_HIGH; |
339 | if (!r) { | 280 | beagle_dvi_device.reset_gpio = 129; |
340 | r = gpio_direction_output(gpio + 1, 0); | 281 | /* |
341 | if (r) | 282 | * gpio + 1 on Xm controls the TFP410's enable line (active low) |
342 | gpio_free(gpio + 1); | 283 | * gpio + 2 control varies depending on the board rev as below: |
343 | } | 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"); | ||
344 | if (r) | 289 | if (r) |
345 | pr_err("%s: unable to configure nDVI_PWR_EN\n", | 290 | pr_err("%s: unable to configure nDVI_PWR_EN\n", |
346 | __func__); | 291 | __func__); |
347 | r = gpio_request(gpio + 2, "DVI_LDO_EN"); | 292 | r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, |
348 | if (!r) { | 293 | "DVI_LDO_EN"); |
349 | r = gpio_direction_output(gpio + 2, 1); | ||
350 | if (r) | ||
351 | gpio_free(gpio + 2); | ||
352 | } | ||
353 | if (r) | 294 | if (r) |
354 | pr_err("%s: unable to configure DVI_LDO_EN\n", | 295 | pr_err("%s: unable to configure DVI_LDO_EN\n", |
355 | __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__); | ||
356 | } | 306 | } |
357 | 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 | |||
358 | return 0; | 313 | return 0; |
359 | } | 314 | } |
360 | 315 | ||
@@ -453,15 +408,6 @@ static struct twl4030_platform_data beagle_twldata = { | |||
453 | .vpll2 = &beagle_vpll2, | 408 | .vpll2 = &beagle_vpll2, |
454 | }; | 409 | }; |
455 | 410 | ||
456 | static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { | ||
457 | { | ||
458 | I2C_BOARD_INFO("twl4030", 0x48), | ||
459 | .flags = I2C_CLIENT_WAKE, | ||
460 | .irq = INT_34XX_SYS_NIRQ, | ||
461 | .platform_data = &beagle_twldata, | ||
462 | }, | ||
463 | }; | ||
464 | |||
465 | static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { | 411 | static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { |
466 | { | 412 | { |
467 | I2C_BOARD_INFO("eeprom", 0x50), | 413 | I2C_BOARD_INFO("eeprom", 0x50), |
@@ -470,8 +416,7 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { | |||
470 | 416 | ||
471 | static int __init omap3_beagle_i2c_init(void) | 417 | static int __init omap3_beagle_i2c_init(void) |
472 | { | 418 | { |
473 | omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, | 419 | omap3_pmic_init("twl4030", &beagle_twldata); |
474 | ARRAY_SIZE(beagle_i2c_boardinfo)); | ||
475 | /* Bus 3 is attached to the DVI port where devices like the pico DLP | 420 | /* Bus 3 is attached to the DVI port where devices like the pico DLP |
476 | * projector don't work reliably with 400kHz */ | 421 | * projector don't work reliably with 400kHz */ |
477 | omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); | 422 | omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); |
@@ -551,39 +496,6 @@ static struct platform_device *omap3_beagle_devices[] __initdata = { | |||
551 | &keys_gpio, | 496 | &keys_gpio, |
552 | }; | 497 | }; |
553 | 498 | ||
554 | static void __init omap3beagle_flash_init(void) | ||
555 | { | ||
556 | u8 cs = 0; | ||
557 | u8 nandcs = GPMC_CS_NUM + 1; | ||
558 | |||
559 | /* find out the chip-select on which NAND exists */ | ||
560 | while (cs < GPMC_CS_NUM) { | ||
561 | u32 ret = 0; | ||
562 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
563 | |||
564 | if ((ret & 0xC00) == 0x800) { | ||
565 | printk(KERN_INFO "Found NAND on CS%d\n", cs); | ||
566 | if (nandcs > GPMC_CS_NUM) | ||
567 | nandcs = cs; | ||
568 | } | ||
569 | cs++; | ||
570 | } | ||
571 | |||
572 | if (nandcs > GPMC_CS_NUM) { | ||
573 | printk(KERN_INFO "NAND: Unable to find configuration " | ||
574 | "in GPMC\n "); | ||
575 | return; | ||
576 | } | ||
577 | |||
578 | if (nandcs < GPMC_CS_NUM) { | ||
579 | omap3beagle_nand_data.cs = nandcs; | ||
580 | |||
581 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | ||
582 | if (gpmc_nand_init(&omap3beagle_nand_data) < 0) | ||
583 | printk(KERN_ERR "Unable to register NAND device\n"); | ||
584 | } | ||
585 | } | ||
586 | |||
587 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | 499 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { |
588 | 500 | ||
589 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 501 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
@@ -602,12 +514,6 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
602 | }; | 514 | }; |
603 | #endif | 515 | #endif |
604 | 516 | ||
605 | static struct omap_musb_board_data musb_board_data = { | ||
606 | .interface_type = MUSB_INTERFACE_ULPI, | ||
607 | .mode = MUSB_OTG, | ||
608 | .power = 100, | ||
609 | }; | ||
610 | |||
611 | static void __init beagle_opp_init(void) | 517 | static void __init beagle_opp_init(void) |
612 | { | 518 | { |
613 | int r = 0; | 519 | int r = 0; |
@@ -665,13 +571,13 @@ static void __init omap3_beagle_init(void) | |||
665 | omap_serial_init(); | 571 | omap_serial_init(); |
666 | 572 | ||
667 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); | 573 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); |
668 | gpio_request(170, "DVI_nPD"); | ||
669 | /* REVISIT leave DVI powered down until it's needed ... */ | 574 | /* REVISIT leave DVI powered down until it's needed ... */ |
670 | gpio_direction_output(170, true); | 575 | gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); |
671 | 576 | ||
672 | usb_musb_init(&musb_board_data); | 577 | usb_musb_init(NULL); |
673 | usbhs_init(&usbhs_bdata); | 578 | usbhs_init(&usbhs_bdata); |
674 | omap3beagle_flash_init(); | 579 | omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, |
580 | ARRAY_SIZE(omap3beagle_nand_partitions)); | ||
675 | 581 | ||
676 | /* Ensure SDRC pins are mux'd for self-refresh */ | 582 | /* Ensure SDRC pins are mux'd for self-refresh */ |
677 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 583 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |