mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: musb: turn phy on
@ 2014-04-02 19:26 Rabin Vincent
  2014-04-02 19:31 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Rabin Vincent @ 2014-04-02 19:26 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Rabin Vincent, Greg Kroah-Hartman, linux-usb, linux-kernel

30a70b026b4cde4 ("usb: musb: fix obex in g_nokia.ko causing kernel
panic") broke USB gadget support on Pandaboard because it simply deletes
the call to phy_power_on() and the PHY is therefore never turned on.

Fix it by actually turning the phy on.

Cc: stable@vger.kernel.org
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 drivers/usb/musb/musb_gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d4aa779..09d5883 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1850,6 +1850,7 @@ static int musb_gadget_start(struct usb_gadget *g,
 	}
 
 	pm_runtime_get_sync(musb->controller);
+	phy_power_on(musb->phy);
 
 	dev_dbg(musb->controller, "registering driver %s\n", driver->function);
 
@@ -1963,6 +1964,7 @@ static int musb_gadget_stop(struct usb_gadget *g,
 	 * that currently misbehaves.
 	 */
 
+	phy_power_off(musb->phy);
 	pm_runtime_put(musb->controller);
 
 	return 0;
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: musb: turn phy on
  2014-04-02 19:26 [PATCH] usb: musb: turn phy on Rabin Vincent
@ 2014-04-02 19:31 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2014-04-02 19:31 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3060 bytes --]

Hi,

On Wed, Apr 02, 2014 at 09:26:27PM +0200, Rabin Vincent wrote:
> 30a70b026b4cde4 ("usb: musb: fix obex in g_nokia.ko causing kernel
> panic") broke USB gadget support on Pandaboard because it simply deletes
> the call to phy_power_on() and the PHY is therefore never turned on.
> 
> Fix it by actually turning the phy on.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Rabin Vincent <rabin@rab.in>
> ---
>  drivers/usb/musb/musb_gadget.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index d4aa779..09d5883 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1850,6 +1850,7 @@ static int musb_gadget_start(struct usb_gadget *g,
>  	}
>  
>  	pm_runtime_get_sync(musb->controller);
> +	phy_power_on(musb->phy);
>  
>  	dev_dbg(musb->controller, "registering driver %s\n", driver->function);
>  
> @@ -1963,6 +1964,7 @@ static int musb_gadget_stop(struct usb_gadget *g,
>  	 * that currently misbehaves.
>  	 */
>  
> +	phy_power_off(musb->phy);

hmmm... not the best place, I have been waiting for -rc1 to be out to
send this version:

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>

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;

and I'm much more inclined to send this one instead since it has been
tested by other folks already. I was even going to Cc you, as you can
see on that Reported-by tag.

cheers

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-02 19:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-02 19:26 [PATCH] usb: musb: turn phy on Rabin Vincent
2014-04-02 19:31 ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®