MUSB/OMAP: gadget does not start when cable is plugged after the driver is started

Message ID 20140404143404.GA8026@saruman.home
State Accepted
Commit 3063a12be2b07c64e9802708a19489342e64c1a3
Headers show

Commit Message

Felipe Balbi April 4, 2014, 2:34 p.m.
On Fri, Apr 04, 2014 at 09:45:06AM +0200, Stefan Roese wrote:
> Hi!
> 
> I'm currently seeing a problem on an OMAP3530 based board (Technexion
> TAO3530). Where the MUSB is configured as device/peripheral and the ethernet
> gadget is compiled into the kernel. This works without any problems and usb0
> is available when the USB cable is connected to a PC upon startup. But when
> the cable is disconnected when the driver is started (doesn't matter if the
> gadget is included in the kernel or if the gadget driver module is loaded)
> and the cable is plugged in later, the ethernet gadget does not start up.
> This is 100% reproducible.
> 
> Before digging deeper into this, I wanted to check here if this is a known
> issue. And if anybody already has a solution/hint for it.
> 
> FYI: I'm using v3.14 right now.

Can you see if this helps ?

commit e8fbe7b90021960907e885e0b7a9b52d378b0202
Author: Felipe Balbi <balbi@ti.com>
Date:   Fri Mar 28 14:31:47 2014 -0500

    usb: musb: fix PHY power on/off
    
    commi 30a70b0 (usb: musb: fix obex in g_nokia.ko
    causing kernel panic) removed phy_power_on()
    and phy_power_off() calls from runtime PM callbacks
    but it failed to note that the driver depended
    on pm_runtime_get_sync() calls to power up the PHY,
    thus leaving some platforms without any means to
    have a working PHY.
    
    Fix that by enabling the phy during omap2430_musb_init()
    and killing it in omap2430_musb_exit().
    
    Fixes: 30a70b0 (usb: musb: fix obex in g_nokia.ko causing kernel panic)
    Cc: <stable@vger.kernel.org> # v3.14
    Cc: Pali Rohár <pali.rohar@gmail.com>
    Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
    Reported-by: Michael Scott <hashcode0f@gmail.com>
    Tested-by: Michael Scott <hashcode0f@gmail.com>
    Reported-by: Rabin Vincent <rabin@rab.in>
    Signed-off-by: Felipe Balbi <balbi@ti.com>

Comments

Stefan Roese April 4, 2014, 3:35 p.m. | #1
Hi Felipe,

On 04.04.2014 16:34, Felipe Balbi wrote:
> On Fri, Apr 04, 2014 at 09:45:06AM +0200, Stefan Roese wrote:
>> Hi!
>>
>> I'm currently seeing a problem on an OMAP3530 based board (Technexion
>> TAO3530). Where the MUSB is configured as device/peripheral and the ethernet
>> gadget is compiled into the kernel. This works without any problems and usb0
>> is available when the USB cable is connected to a PC upon startup. But when
>> the cable is disconnected when the driver is started (doesn't matter if the
>> gadget is included in the kernel or if the gadget driver module is loaded)
>> and the cable is plugged in later, the ethernet gadget does not start up.
>> This is 100% reproducible.
>>
>> Before digging deeper into this, I wanted to check here if this is a known
>> issue. And if anybody already has a solution/hint for it.
>>
>> FYI: I'm using v3.14 right now.
>
> Can you see if this helps ?
>
> commit e8fbe7b90021960907e885e0b7a9b52d378b0202
> Author: Felipe Balbi <balbi@ti.com>
> Date:   Fri Mar 28 14:31:47 2014 -0500
>
>      usb: musb: fix PHY power on/off
>
>      commi 30a70b0 (usb: musb: fix obex in g_nokia.ko
>      causing kernel panic) removed phy_power_on()
>      and phy_power_off() calls from runtime PM callbacks
>      but it failed to note that the driver depended
>      on pm_runtime_get_sync() calls to power up the PHY,
>      thus leaving some platforms without any means to
>      have a working PHY.
>
>      Fix that by enabling the phy during omap2430_musb_init()
>      and killing it in omap2430_musb_exit().
>
>      Fixes: 30a70b0 (usb: musb: fix obex in g_nokia.ko causing kernel panic)
>      Cc: <stable@vger.kernel.org> # v3.14
>      Cc: Pali Rohár <pali.rohar@gmail.com>
>      Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
>      Reported-by: Michael Scott <hashcode0f@gmail.com>
>      Tested-by: Michael Scott <hashcode0f@gmail.com>
>      Reported-by: Rabin Vincent <rabin@rab.in>
>      Signed-off-by: Felipe Balbi <balbi@ti.com>

Yes, this patch fixes this problem. Thanks a lot!

Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index d341c14..819a7cd 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -416,6 +416,7 @@  static int omap2430_musb_init(struct musb *musb)
 		omap_musb_set_mailbox(glue);
 
 	phy_init(musb->phy);
+	phy_power_on(musb->phy);
 
 	pm_runtime_put_noidle(musb->controller);
 	return 0;
@@ -478,6 +479,7 @@  static int omap2430_musb_exit(struct musb *musb)
 	del_timer_sync(&musb_idle_timer);
 
 	omap2430_low_level_exit(musb);
+	phy_power_off(musb->phy);
 	phy_exit(musb->phy);
 
 	return 0;