overo twl4030: fix twl4030 IRQ (used for usb otg detection)
PATCH 1/1 overo twl4030: fix twl4030 IRQ (used for usb otg detection)
I was not getting OTG USB vbus/id pin change interrupts on Gumstix Overo and the reason was a mis-configured irq. I added some more checks to avoid having a non-bootable kernel on boards with bootloaders that have wrong pinmux. The changes of twl4030 should be tested on other boards too.
---
Gumstix Overo has TPS65950 (TWL4030) IRQ1 connected to GPIO112.
This patch fixes the TWL4030 IRQ mapping. The TWL4030 IRQ is used to signal USB OTG connection events. If this does not work, the USB OTG and peripheral modes do not work.
GPIO112 mux is wrong in bootloader, too. In case the board uses an older bootloader, we'll try to re-mux it in kernel (requires CONFIG_OMAP_MUX).
TWL4030 IRQ1 requires pull-up to be activated on GPIO112. If it is not (bootloader did not do it and kernel has CONFIG_OMAP_MUX disabled) the kernel would have a stuck interrupt. To avoid freeze, spurious interrupt detection is added to TWL4030.
---
arch/arm/mach-omap2/board-overo.c +17 -1
@@ -52,6 +52,7 @@#define OVERO_GPIO_BT_XGATE 15#define OVERO_GPIO_W2W_NRESET 16 +#define OVERO_GPIO_TPS65950_IRQ 112#define OVERO_GPIO_PENDOWN 114#define OVERO_GPIO_BT_NRESET 164#define OVERO_GPIO_USBH_CPEN 168
@@ -353,7 +354,7 @@ static struct i2c_board_info __initdata { I2C_BOARD_INFO("tps65950", 0x48), .flags = I2C_CLIENT_WAKE, - .irq = INT_34XX_SYS_NIRQ, + .irq = OMAP_GPIO_IRQ(OVERO_GPIO_TPS65950_IRQ), .platform_data = &overo_twldata, }, };
@@ -422,6 +423,21 @@ static struct omap_musb_board_data musb_static void __init overo_init (void ) {omap3_mux_init (board_mux,OMAP_PACKAGE_CBB ); + +/* Mux GPIO112 to pull-up input. In case bad bootloader is used, +* override mux settings manually here. +* Requires CONFIG_OMAP_MUX! */ +omap_mux_set_gpio (OMAP_MUX_MODE4 |OMAP_PIN_INPUT_PULLUP , +OVERO_GPIO_TPS65950_IRQ ); + +if ((gpio_request (OVERO_GPIO_TPS65950_IRQ ,"TPS65950_IRQ" ) ==0 ) && + (gpio_direction_input (OVERO_GPIO_TPS65950_IRQ ) ==0 )) { +gpio_export (OVERO_GPIO_TPS65950_IRQ ,0 ); + }else { +printk (KERN_ERR "could not obtain gpio for TPS65950 IRQ\n" ); +return ; + } +overo_i2c_init ();platform_add_devices (overo_devices,ARRAY_SIZE (overo_devices));omap_serial_init ();
drivers/mfd/twl4030-irq.c +9 -1
@@ -312,6 +312,14 @@ static int twl4030_irq_thread(void *datacontinue ; } +/* Check for spurious interrupts */ +if (!pih_isr) { +printk (KERN_ERR "Spurious TWL4030 interrupt" +" detected. Terminating %s.\n" , + __func__); +break ; + } +/* these handlers deal with the relevant SIH irq status */ local_irq_disable (); for (module_irq = twl4030_irq_base;
@@ -832,7 +840,7 @@ int twl4030_init_irq(int irq_num, unsigninit_completion (&irq_event); - status =request_irq (irq_num, handle_twl4030_pih,IRQF_DISABLED , + status =request_irq (irq_num, handle_twl4030_pih,IRQF_TRIGGER_LOW |IRQF_DISABLED ,"TWL4030-PIH" , &irq_event);if (status <0 ) {pr_err ("twl4030: could not claim irq%d: %d\n" , irq_num, status);
Quoted 7 lines · Anti Sullin
I was not getting OTG USB vbus/id pin change interrupts on Gumstix Overo and the reason was a mis-configured irq. I added some more checks to avoid having a non-bootable kernel on boards with bootloaders that have wrong pinmux. The changes of twl4030 should be tested on other boards too.
---
Gumstix Overo has TPS65950 (TWL4030) IRQ1 connected to GPIO112.
I don't think that this change should be made.
Quoted 1 line
From what I understand from my discussions with Gumstix, early
versions of the Overo COM used GPIO112 as indicated above.
However all fab revisions >=2516 use GPIO0, so the code is correct for current and future versions of Overo COMs (as is the bootloader pinmuxing).
In fact, future versions of Overo will use GPIO112 for a revision ID.
Not an ideal situation, but I think we should leave things as they are since it matches current and future production.
People with older boards will certainly need to use this patch to get vbus/id interrupts.
Steve
Quoted 18 lines · Steve Sakoman
Quoted 7 lines · Anti Sullin
I was not getting OTG USB vbus/id pin change interrupts on Gumstix Overo and the reason was a mis-configured irq. I added some more checks to avoid having a non-bootable kernel on boards with bootloaders that have wrong pinmux. The changes of twl4030 should be tested on other boards too.
---
Gumstix Overo has TPS65950 (TWL4030) IRQ1 connected to GPIO112.I don't think that this change should be made.
Quoted 1 line
From what I understand from my discussions with Gumstix, early
versions of the Overo COM used GPIO112 as indicated above.
However all fab revisions >=2516 use GPIO0, so the code is correct for current and future versions of Overo COMs (as is the bootloader pinmuxing).
Quoted 7 lines
In fact, future versions of Overo will use GPIO112 for a revision ID.
Not an ideal situation, but I think we should leave things as they are since it matches current and future production.
People with older boards will certainly need to use this patch to get vbus/id interrupts.
it would be better to get all boards working. Can't you use ATAG_REVISION or system_rev to differentiate the board revisions and change gpio number accordingly ??
Signature · 1 line
balbi
Quoted 30 lines · Felipe Balbi
Quoted 29 lines · Steve Sakoman
Quoted 10 lines · Anti Sullin
I was not getting OTG USB vbus/id pin change interrupts on Gumstix Overo and the reason was a mis-configured irq. I added some more checks to avoid
having a non-bootable kernel on boards with bootloaders that have wrong pinmux.
The changes of twl4030 should be tested on other boards too.---
Gumstix Overo has TPS65950 (TWL4030) IRQ1 connected to GPIO112.I don't think that this change should be made.
Quoted 1 line
From what I understand from my discussions with Gumstix, early
versions of the Overo COM used GPIO112 as indicated above.
However all fab revisions >=2516 use GPIO0, so the code is correct for current and future versions of Overo COMs (as is the bootloader pinmuxing).
In fact, future versions of Overo will use GPIO112 for a revision ID.
Not an ideal situation, but I think we should leave things as they are since it matches current and future production.
Quoted 6 lines
Quoted 2 lines
People with older boards will certainly need to use this patch to get vbus/id interrupts.
it would be better to get all boards working. Can't you use
ATAG_REVISIONorsystem_revto differentiate the board revisions and change gpio number accordingly ??
Agreed. Gumstix doesn't provide an easy way of determining the layout revision via software (the boards are marked with the rev number, but that doesn't do much good!).
I'm investigating methods to figure this out, but haven't yet found anything reliable. When I do I'll post a patch.
Steve
Tony Lindgren
maintainerQuoted 4 lines · Steve Sakoman
Agreed. Gumstix doesn't provide an easy way of determining the layout revision via software (the boards are marked with the rev number, but that doesn't do much good!).
Unless you use the camera interface during early init to detect that revision printed on the circuit board ;)
Quoted 2 lines
I'm investigating methods to figure this out, but haven't yet found anything reliable. When I do I'll post a patch.
How about add something to u-boot that allows setenv system_rev in u-boot? Maybe it already has this feature as system_rev is arm-linux generic atag.
Regards,
Tony
Quoted 8 lines · Tony Lindgren
Quoted 4 lines · Steve Sakoman
Agreed. Gumstix doesn't provide an easy way of determining the layout revision via software (the boards are marked with the rev number, but that doesn't do much good!).
Unless you use the camera interface during early init to detect that revision printed on the circuit board ;)
That was my first idea too :-)
Quoted 6 lines
Quoted 2 lines
I'm investigating methods to figure this out, but haven't yet found anything reliable. When I do I'll post a patch.
How about add something to u-boot that allows setenv
system_revin u-boot? Maybe it already has this feature assystem_revis arm-linux generic atag.
The hard part is creating the code to figure out how the board is wired :-)
I have some promising approaches, but nothing working yet. Once that is done the rest is easy!
Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html