Re: [PATCH] overo twl4030: fix twl4030 IRQ (used for usb otg detection)
On Thu, Sep 16, 2010 at 10:40 AM, Tony Lindgren wrote: > * Steve Sakoman [100916 05:48]: >> >> 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 :-) >> 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. 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] overo twl4030: fix twl4030 IRQ (used for usb otg detection)
* Steve Sakoman [100916 05:48]: > > 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 ;) > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] overo twl4030: fix twl4030 IRQ (used for usb otg detection)
On Wed, Sep 15, 2010 at 11:07 PM, Felipe Balbi wrote: > On Wed, Sep 15, 2010 at 04:28:57PM -0500, Steve Sakoman wrote: >> >> On Wed, Sep 15, 2010 at 9:29 AM, Anti Sullin >> wrote: >>> >>> 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. >> >>> 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. > > 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 ?? 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 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] overo twl4030: fix twl4030 IRQ (used for usb otg detection)
On Wed, Sep 15, 2010 at 04:28:57PM -0500, Steve Sakoman wrote: On Wed, Sep 15, 2010 at 9:29 AM, Anti Sullin wrote: 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. 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. 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 ?? -- balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] overo twl4030: fix twl4030 IRQ (used for usb otg detection)
On Wed, Sep 15, 2010 at 9:29 AM, Anti Sullin wrote: > 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. >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 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 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. Signed-off-by: Anti Sullin --- diff -pur linux-2.6.34/arch/arm/mach-omap2/board-overo.c linux-2.6.34-ok/arch/arm/mach-omap2/board-overo.c --- linux-2.6.34/arch/arm/mach-omap2/board-overo.c 2010-05-17 00:17:36.0 +0300 +++ linux-2.6.34-ok/arch/arm/mach-omap2/board-overo.c 2010-09-14 19:49:00.0 +0300 @@ -52,6 +52,7 @@ #define OVERO_GPIO_BT_XGATE15 #define OVERO_GPIO_W2W_NRESET 16 +#define OVERO_GPIO_TPS65950_IRQ112 #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(); diff -pur linux-2.6.34/drivers/mfd/twl4030-irq.c linux-2.6.34-ok/drivers/mfd/twl4030-irq.c --- linux-2.6.34/drivers/mfd/twl4030-irq.c 2010-05-17 00:17:36.0 +0300 +++ linux-2.6.34-ok/drivers/mfd/twl4030-irq.c 2010-09-14 19:50:25.0 +0300 @@ -312,6 +312,14 @@ static int twl4030_irq_thread(void *data continue; } + /* 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, unsign init_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); -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html