usb: musb: Fix unbalanced platform_disable
Subsystems (4)
PATCH v3 1/1 usb: musb: Fix unbalanced platform_disable
Commit a83e17d0f73b ("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.
The root cause of the problem is unpaired calls from musb_core.c to musb_platform_enable/disable in musb_core.c as reported by Andreas Kemnade <[email protected]>.
As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like musb_remove.
Instead, let's first fix the regression in a minimal way by removing the initial call to musb_platform_disable. To do that in a safe way, we need to call the glue specific *_musb_disable() directly in the glue layer *_musb_init() as noted by Bin Liu <[email protected]>.
AFAIK the initial musb_platform_disable call has always been just an attempted workaround for the 2430 glue layer announcing itself too early before the gadgets are configured. And that issue finally got fixed with commit a118df07f5b1 ("usb: musb: Don't set d+ high before enable for 2430 glue layer").
Further, most of the glue layers already do a reset of the musb controller in the *_musb_init(), so later on we may want to consider removing the calls to *__musb_disable() where a reset is already done.
Note that we now also need to fix the twl4030-phy accordingly making it's PM runtime call only needed in twl4030_phy_power_on and have it autosuspend. The cable state will keep the phy active when connected.
for 2430 glue layer")
---
I've kept the 2430 glue layer related acks as those parts did not change. For the glue layers doing things in *_musb_disable(), I've tested da8xx, am35x and musb_dsps glue layers.
Changes since v2:
- Added glue layer calls to *_musb_disable() from *_musb_init() where needed as suggested by Bin
--- drivers/phy/phy-twl4030-usb.c | 4 ++-- drivers/usb/musb/am35x.c | 1 + drivers/usb/musb/da8xx.c | 1 + drivers/usb/musb/davinci.c | 1 + drivers/usb/musb/musb_core.c | 1 - drivers/usb/musb/musb_dsps.c | 1 + drivers/usb/musb/sunxi.c | 3 +++ drivers/usb/musb/tusb6010.c | 1 + 8 files changed, 10 insertions(+), 3 deletions(-)
drivers/phy/phy-twl4030-usb.c +2 -2
@@ -447,8 +447,6 @@ static int twl4030_phy_power_off(struct phy *phy)struct twl4030_usb *twl =phy_get_drvdata (phy);dev_dbg (twl->dev,"%s\n" , __func__); -pm_runtime_mark_last_busy (twl->dev); -pm_runtime_put_autosuspend (twl->dev);return 0 ; }
@@ -465,6 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy)twl4030_i2c_access (twl,0 ); twl->linkstat =MUSB_UNKNOWN ;schedule_delayed_work (&twl->id_workaround_work,HZ ); +pm_runtime_mark_last_busy (twl->dev); +pm_runtime_put_autosuspend (twl->dev);return 0 ; }
drivers/usb/musb/am35x.c +1 -0
@@ -381,6 +381,7 @@ static int am35x_musb_init(struct musb *musb)msleep (5 ); +am35x_musb_disable (musb); musb->isr = am35x_musb_interrupt;/* clear level interrupt */
drivers/usb/musb/da8xx.c +1 -0
@@ -440,6 +440,7 @@ static int da8xx_musb_init(struct musb *musb) rev,__raw_readl (CFGCHIP2 ), musb_readb(reg_base, DA8XX_USB_CTRL_REG)); +da8xx_musb_disable (musb); musb->isr = da8xx_musb_interrupt;return 0 ; fail:
drivers/usb/musb/davinci.c +1 -0
@@ -432,6 +432,7 @@ static int davinci_musb_init(struct musb *musb) revision,__raw_readl (USB_PHY_CTRL ), musb_readb(tibase, DAVINCI_USB_CTRL_REG)); +davinci_musb_disable (musb); musb->isr = davinci_musb_interrupt;return 0 ;
drivers/usb/musb/musb_core.c +0 -1
@@ -2142,7 +2142,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) }/* be sure interrupts are disabled before connecting ISR */ -musb_platform_disable (musb);musb_generic_disable (musb);/* Init IRQ workqueue before request_irq */
drivers/usb/musb/musb_dsps.c +1 -0
@@ -441,6 +441,7 @@ static int dsps_musb_init(struct musb *musb)/* Reset the musb */ musb_writel (reg_base, wrp->control, (1 << wrp->reset)); +dsps_musb_disable (musb); musb->isr = dsps_interrupt;/* reset the otgdisable bit, needed for host mode to work */
drivers/usb/musb/sunxi.c +3 -0
@@ -93,6 +93,8 @@ struct sunxi_glue {struct notifier_block host_nb; }; +static void sunxi_musb_disable (struct musb *musb); +/* phy_power_on / off may sleep, so we use a workqueue */ static void sunxi_musb_work (struct work_struct *work) {
@@ -265,6 +267,7 @@ static int sunxi_musb_init(struct musb *musb)if (ret) goto error_unregister_notifier; +sunxi_musb_disable (musb); musb->isr = sunxi_musb_interrupt;/* Stop the musb-core from doing runtime pm (not supported on sunxi) */
drivers/usb/musb/tusb6010.c +1 -0
@@ -1149,6 +1149,7 @@ static int tusb_musb_init(struct musb *musb) ret); goto done; } +tusb_musb_disable (musb); musb->isr = tusb_musb_interrupt; musb->xceiv->set_power = tusb_draw_power;
Signature · 5 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 5 lines · Tony Lindgren
Commit
a83e17d0f73b("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.
Quoted 7 lines
The root cause of the problem is unpaired calls from
musb_core.cto musb_platform_enable/disable inmusb_core.cas reported by Andreas Kemnade <[email protected]>.As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like
musb_remove.
Yeah, the sunxi glue actually has:
static void sunxi_musb_enable(struct musb *musb)
{
struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
glue->musb = musb;
/* musb_core does not call us in a balanced manner */
if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags))
return;
schedule_work(&glue->work);
}static void sunxi_musb_disable(struct musb *musb)
{
struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
clear_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags);
}Note that since the glue struct is kzalloc-ed, this makes calling sunxi_musb_disable() from sunxi_musb_init() a nop, so if this needs a respin please drop the sunxi changes, they are not necessary.
If there are no other comments I can live with this...
Regards,
Hans
Quoted 155 lines
Instead, let's first fix the regression in a minimal way by removing the initial call to
musb_platform_disable. To do that in a safe way, we need to call the glue specific*_musb_disable()directly in the glue layer*_musb_init()as noted by Bin Liu <[email protected]>.AFAIK the initial
musb_platform_disablecall has always been just an attempted workaround for the 2430 glue layer announcing itself too early before the gadgets are configured. And that issue finally got fixed with commita118df07f5b1("usb: musb: Don't set d+ high before enable for 2430 glue layer").Further, most of the glue layers already do a reset of the musb controller in the
*_musb_init(), so later on we may want to consider removing the calls to*__musb_disable()where a reset is already done.Note that we now also need to fix the twl4030-phy accordingly making it's PM runtime call only needed in
twl4030_phy_power_onand have it autosuspend. The cable state will keep the phy active when connected.Cc Hans de Goede <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phy handlingfor 2430 glue layer")
Reported-by Andreas Kemnade <[email protected]>Acked-by Andreas Kemnade <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
I've kept the 2430 glue layer related acks as those parts did not change. For the glue layers doing things in
*_musb_disable(), I've tested da8xx, am35x andmusb_dspsglue layers.Changes since v2:
- Added glue layer calls to
*_musb_disable()from*_musb_init()where needed as suggested by Bin--- drivers/phy/phy-twl4030-usb.c | 4 ++-- drivers/usb/musb/am35x.c | 1 + drivers/usb/musb/da8xx.c | 1 + drivers/usb/musb/davinci.c | 1 + drivers/usb/musb/musb_core.c | 1 - drivers/usb/musb/musb_dsps.c | 1 + drivers/usb/musb/sunxi.c | 3 +++ drivers/usb/musb/tusb6010.c | 1 + 8 files changed, 10 insertions(+), 3 deletions(-)drivers/phy/phy-twl4030-usb.c +2
-2@@ -447,8 +447,6 @@ static int twl4030_phy_power_off(struct phy *phy)struct twl4030_usb *twl =phy_get_drvdata (phy);dev_dbg (twl->dev,"%s\n" , __func__); -pm_runtime_mark_last_busy (twl->dev); -pm_runtime_put_autosuspend (twl->dev);return 0 ; }@@ -465,6 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy)twl4030_i2c_access (twl,0 ); twl->linkstat =MUSB_UNKNOWN ;schedule_delayed_work (&twl->id_workaround_work,HZ ); +pm_runtime_mark_last_busy (twl->dev); +pm_runtime_put_autosuspend (twl->dev);return 0 ; }drivers/usb/musb/am35x.c +1
-0@@ -381,6 +381,7 @@ static int am35x_musb_init(struct musb *musb)msleep (5 ); +am35x_musb_disable (musb); musb->isr = am35x_musb_interrupt;/* clear level interrupt */ drivers/usb/musb/da8xx.c +1
-0@@ -440,6 +440,7 @@ static int da8xx_musb_init(struct musb *musb) rev,__raw_readl (CFGCHIP2 ), musb_readb(reg_base, DA8XX_USB_CTRL_REG)); +da8xx_musb_disable (musb); musb->isr = da8xx_musb_interrupt;return 0 ; fail:drivers/usb/musb/davinci.c +1
-0@@ -432,6 +432,7 @@ static int davinci_musb_init(struct musb *musb) revision,__raw_readl (USB_PHY_CTRL ), musb_readb(tibase, DAVINCI_USB_CTRL_REG)); +davinci_musb_disable (musb); musb->isr = davinci_musb_interrupt;return 0 ;drivers/usb/musb/musb_core.c +0
-1@@ -2142,7 +2142,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) }/* be sure interrupts are disabled before connecting ISR */ -musb_platform_disable (musb);musb_generic_disable (musb);/* Init IRQ workqueue before request_irq */ drivers/usb/musb/musb_dsps.c +1
-0@@ -441,6 +441,7 @@ static int dsps_musb_init(struct musb *musb)/* Reset the musb */ musb_writel (reg_base, wrp->control, (1 << wrp->reset)); +dsps_musb_disable (musb); musb->isr = dsps_interrupt;/* reset the otgdisable bit, needed for host mode to work */ drivers/usb/musb/sunxi.c +3
-0@@ -93,6 +93,8 @@ struct sunxi_glue {struct notifier_block host_nb; }; +static void sunxi_musb_disable (struct musb *musb); +/* phy_power_on / off may sleep, so we use a workqueue */ static void sunxi_musb_work (struct work_struct *work) {@@ -265,6 +267,7 @@ static int sunxi_musb_init(struct musb *musb)if (ret) goto error_unregister_notifier; +sunxi_musb_disable (musb); musb->isr = sunxi_musb_interrupt;/* Stop the musb-core from doing runtime pm (not supported on sunxi) */
drivers/usb/musb/tusb6010.c static int tusb_musb_init(struct musb *musb) · line 1155
Quoted 7 lines
drivers/usb/musb/tusb6010.c +1
-0@@ -1149,6 +1149,7 @@ static int tusb_musb_init(struct musb *musb) ret); goto done; } +tusb_musb_disable (musb); musb->isr = tusb_musb_interrupt; musb->xceiv->set_power = tusb_draw_power;
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 19 lines · Hans de Goede
Hi,
Quoted 5 lines · Tony Lindgren
Commit
a83e17d0f73b("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.Quoted 7 lines
The root cause of the problem is unpaired calls from
musb_core.cto musb_platform_enable/disable inmusb_core.cas reported by Andreas Kemnade <[email protected]>.As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like
musb_remove.Yeah, the sunxi glue actually has:
static void
sunxi_musb_enable(struct musb *musb)
Quoted 8 lines
{
struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
glue->musb = musb;
/* musb_core does not call us in a balanced manner */
if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags))
return;Heh we're trying to get to the "balanced manner" point hopefully soon :)
Quoted 10 lines
schedule_work(&glue->work); }static void
sunxi_musb_disable(struct musb *musb){ struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); clear_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags); }
Quoted 4 lines
Note that since the glue struct is kzalloc-ed, this makes calling
sunxi_musb_disable()fromsunxi_musb_init()a nop, so if this needs a respin please drop the sunxi changes, they are not necessary.
Hmm we have sunxi_musb_probe() do platform_device_register_full(), then musb_probe() happens, and calls musb_init_controller().
In musb_init_controller() we do musb_platform_init() that finally calls sunxi_musb_init().
So the sunxi glue is kzalloc'ed and initialized already in sunxi_musb_probe(), and musb parts are already initialized in musb_init_controller().
I don't quite follow what you mean how it's a nop.. Care to clarify that a bit? Maybe you're thinking we're calling it from sunxi_musb_probe() instead?
Anyways, calling sunxi_musb_disable() seems unnecessary from sunxi_musb_init() because it does reset_control_deassert(). But that can be cleaned up later on if no other reasons for changes for v4.8-rc cycle.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 49 lines · Tony Lindgren
Quoted 19 lines · Hans de Goede
Hi,
Quoted 5 lines · Tony Lindgren
Commit
a83e17d0f73b("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.Quoted 7 lines
The root cause of the problem is unpaired calls from
musb_core.cto musb_platform_enable/disable inmusb_core.cas reported by Andreas Kemnade <[email protected]>.As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like
musb_remove.Yeah, the sunxi glue actually has:
static void
sunxi_musb_enable(struct musb *musb)Quoted 8 lines
{ struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); glue->musb = musb; /* musb_core does not call us in a balanced manner */ if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) return;Heh we're trying to get to the "balanced manner" point hopefully soon :)
Quoted 10 lines
schedule_work(&glue->work); }static void
sunxi_musb_disable(struct musb *musb){ struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); clear_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags); }Quoted 4 lines
Note that since the glue struct is kzalloc-ed, this makes calling
sunxi_musb_disable()fromsunxi_musb_init()a nop, so if this needs a respin please drop the sunxi changes, they are not necessary.Hmm we have
sunxi_musb_probe()doplatform_device_register_full(), thenmusb_probe()happens, and callsmusb_init_controller().
Quoted 6 lines
In
musb_init_controller()we domusb_platform_init()that finally callssunxi_musb_init().So the sunxi glue is kzalloc'ed and initialized already in
sunxi_musb_probe(), and musb parts are already initialized inmusb_init_controller().
Not really, musb_init_controller does little of interest before calling musb_platform_init(), which is a function pointer to sunxi_musb_init().
Quoted 3 lines
I don't quite follow what you mean how it's a nop.. Care to clarify that a bit? Maybe you're thinking we're calling it from
sunxi_musb_probe()instead?
Nope, I no the call chain, but nothing interesting happens between sunxi_musb_probe() and sunxi_musb_init().
Quoted 4 lines
Anyways, calling
sunxi_musb_disable()seems unnecessary fromsunxi_musb_init()because it doesreset_control_deassert(). But that can be cleaned up later on if no other reasons for changes for v4.8-rc cycle.
Ah is this patch for 4.8-rc, yeah then definitely keep it as is, as I tried to explain in my previous mail, my remark was only made in case you need to respin the patch for other reasons, if not then it is fine as is.
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 63 lines · Hans de Goede
Hi,
Quoted 49 lines · Tony Lindgren
Quoted 19 lines · Hans de Goede
Hi,
Quoted 5 lines · Tony Lindgren
Commit
a83e17d0f73b("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.Quoted 7 lines
The root cause of the problem is unpaired calls from
musb_core.cto musb_platform_enable/disable inmusb_core.cas reported by Andreas Kemnade <[email protected]>.As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like
musb_remove.Yeah, the sunxi glue actually has:
static void
sunxi_musb_enable(struct musb *musb)Quoted 8 lines
{ struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); glue->musb = musb; /* musb_core does not call us in a balanced manner */ if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) return;Heh we're trying to get to the "balanced manner" point hopefully soon :)
Quoted 10 lines
schedule_work(&glue->work); }static void
sunxi_musb_disable(struct musb *musb){ struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); clear_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags); }Quoted 4 lines
Note that since the glue struct is kzalloc-ed, this makes calling
sunxi_musb_disable()fromsunxi_musb_init()a nop, so if this needs a respin please drop the sunxi changes, they are not necessary.Hmm we have
sunxi_musb_probe()doplatform_device_register_full(), thenmusb_probe()happens, and callsmusb_init_controller().Quoted 6 lines
In
musb_init_controller()we domusb_platform_init()that finally callssunxi_musb_init().So the sunxi glue is kzalloc'ed and initialized already in
sunxi_musb_probe(), and musb parts are already initialized inmusb_init_controller().Not really,
musb_init_controllerdoes little of interest before callingmusb_platform_init(), which is a function pointer tosunxi_musb_init().
Quoted 6 lines
Quoted 3 lines
I don't quite follow what you mean how it's a nop.. Care to clarify that a bit? Maybe you're thinking we're calling it from
sunxi_musb_probe()instead?Nope, I no the call chain, but nothing interesting happens between
sunxi_musb_probe()andsunxi_musb_init().
OK thanks for confirming.
Quoted 9 lines
Quoted 4 lines
Anyways, calling
sunxi_musb_disable()seems unnecessary fromsunxi_musb_init()because it doesreset_control_deassert(). But that can be cleaned up later on if no other reasons for changes for v4.8-rc cycle.Ah is this patch for 4.8-rc, yeah then definitely keep it as is, as I tried to explain in my previous mail, my remark was only made in case you need to respin the patch for other reasons, if not then it is fine as is.
OK thanks.
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Bin Liu
Acked-byHi,
Quoted 36 lines · Tony Lindgren
Commit
a83e17d0f73b("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.The root cause of the problem is unpaired calls from
musb_core.cto musb_platform_enable/disable inmusb_core.cas reported by Andreas Kemnade <[email protected]>.As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like
musb_remove.Instead, let's first fix the regression in a minimal way by removing the initial call to
musb_platform_disable. To do that in a safe way, we need to call the glue specific*_musb_disable()directly in the glue layer*_musb_init()as noted by Bin Liu <[email protected]>.AFAIK the initial
musb_platform_disablecall has always been just an attempted workaround for the 2430 glue layer announcing itself too early before the gadgets are configured. And that issue finally got fixed with commita118df07f5b1("usb: musb: Don't set d+ high before enable for 2430 glue layer").Further, most of the glue layers already do a reset of the musb controller in the
*_musb_init(), so later on we may want to consider removing the calls to*__musb_disable()where a reset is already done.Note that we now also need to fix the twl4030-phy accordingly making it's PM runtime call only needed in
twl4030_phy_power_onand have it autosuspend. The cable state will keep the phy active when connected.Cc Hans de Goede <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phy handling
Quoted 8 lines
for 2430 glue layer")
Reported-by Andreas Kemnade <[email protected]>Acked-by Andreas Kemnade <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
If Kishon wants to take it, here is my
Regards
-Bin.
Quoted 131 lines
I've kept the 2430 glue layer related acks as those parts did not change. For the glue layers doing things in
*_musb_disable(), I've tested da8xx, am35x andmusb_dspsglue layers.Changes since v2:
- Added glue layer calls to
*_musb_disable()from*_musb_init()where needed as suggested by Bin--- drivers/phy/phy-twl4030-usb.c | 4 ++-- drivers/usb/musb/am35x.c | 1 + drivers/usb/musb/da8xx.c | 1 + drivers/usb/musb/davinci.c | 1 + drivers/usb/musb/musb_core.c | 1 - drivers/usb/musb/musb_dsps.c | 1 + drivers/usb/musb/sunxi.c | 3 +++ drivers/usb/musb/tusb6010.c | 1 + 8 files changed, 10 insertions(+), 3 deletions(-)drivers/phy/phy-twl4030-usb.c +2
-2@@ -447,8 +447,6 @@ static int twl4030_phy_power_off(struct phy *phy)struct twl4030_usb *twl =phy_get_drvdata (phy);dev_dbg (twl->dev,"%s\n" , __func__); -pm_runtime_mark_last_busy (twl->dev); -pm_runtime_put_autosuspend (twl->dev);return 0 ; }@@ -465,6 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy)twl4030_i2c_access (twl,0 ); twl->linkstat =MUSB_UNKNOWN ;schedule_delayed_work (&twl->id_workaround_work,HZ ); +pm_runtime_mark_last_busy (twl->dev); +pm_runtime_put_autosuspend (twl->dev);return 0 ; }drivers/usb/musb/am35x.c +1
-0@@ -381,6 +381,7 @@ static int am35x_musb_init(struct musb *musb)msleep (5 ); +am35x_musb_disable (musb); musb->isr = am35x_musb_interrupt;/* clear level interrupt */ drivers/usb/musb/da8xx.c +1
-0@@ -440,6 +440,7 @@ static int da8xx_musb_init(struct musb *musb) rev,__raw_readl (CFGCHIP2 ), musb_readb(reg_base, DA8XX_USB_CTRL_REG)); +da8xx_musb_disable (musb); musb->isr = da8xx_musb_interrupt;return 0 ; fail:drivers/usb/musb/davinci.c +1
-0@@ -432,6 +432,7 @@ static int davinci_musb_init(struct musb *musb) revision,__raw_readl (USB_PHY_CTRL ), musb_readb(tibase, DAVINCI_USB_CTRL_REG)); +davinci_musb_disable (musb); musb->isr = davinci_musb_interrupt;return 0 ;drivers/usb/musb/musb_core.c +0
-1@@ -2142,7 +2142,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) }/* be sure interrupts are disabled before connecting ISR */ -musb_platform_disable (musb);musb_generic_disable (musb);/* Init IRQ workqueue before request_irq */ drivers/usb/musb/musb_dsps.c +1
-0@@ -441,6 +441,7 @@ static int dsps_musb_init(struct musb *musb)/* Reset the musb */ musb_writel (reg_base, wrp->control, (1 << wrp->reset)); +dsps_musb_disable (musb); musb->isr = dsps_interrupt;/* reset the otgdisable bit, needed for host mode to work */ drivers/usb/musb/sunxi.c +3
-0@@ -93,6 +93,8 @@ struct sunxi_glue {struct notifier_block host_nb; }; +static void sunxi_musb_disable (struct musb *musb); +/* phy_power_on / off may sleep, so we use a workqueue */ static void sunxi_musb_work (struct work_struct *work) {@@ -265,6 +267,7 @@ static int sunxi_musb_init(struct musb *musb)if (ret) goto error_unregister_notifier; +sunxi_musb_disable (musb); musb->isr = sunxi_musb_interrupt;/* Stop the musb-core from doing runtime pm (not supported on sunxi) */ drivers/usb/musb/tusb6010.c +1
-0@@ -1149,6 +1149,7 @@ static int tusb_musb_init(struct musb *musb) ret); goto done; } +tusb_musb_disable (musb); musb->isr = tusb_musb_interrupt; musb->xceiv->set_power = tusb_draw_power;Signature · 1 line
2.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 48 lines · Bin Liu
Hi,
Quoted 36 lines · Tony Lindgren
Commit
a83e17d0f73b("usb: musb: Improve PM runtime and phy handling for 2430 glue layer") moved PHY enable/disable calls to happen from omap2430_musb_enable/disable(). That broke enumeration for several devices as PM runtime in the PHY will never enable it.The root cause of the problem is unpaired calls from
musb_core.cto musb_platform_enable/disable inmusb_core.cas reported by Andreas Kemnade <[email protected]>.As musb_platform_enable/disable are being called from various functions, let's not attempt to make them paiered immediately. This would require fixing all the callers like
musb_remove.Instead, let's first fix the regression in a minimal way by removing the initial call to
musb_platform_disable. To do that in a safe way, we need to call the glue specific*_musb_disable()directly in the glue layer*_musb_init()as noted by Bin Liu <[email protected]>.AFAIK the initial
musb_platform_disablecall has always been just an attempted workaround for the 2430 glue layer announcing itself too early before the gadgets are configured. And that issue finally got fixed with commita118df07f5b1("usb: musb: Don't set d+ high before enable for 2430 glue layer").Further, most of the glue layers already do a reset of the musb controller in the
*_musb_init(), so later on we may want to consider removing the calls to*__musb_disable()where a reset is already done.Note that we now also need to fix the twl4030-phy accordingly making it's PM runtime call only needed in
twl4030_phy_power_onand have it autosuspend. The cable state will keep the phy active when connected.Cc Hans de Goede <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phy handlingQuoted 8 lines
for 2430 glue layer")
Reported-by Andreas Kemnade <[email protected]>Acked-by Andreas Kemnade <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
Quoted 3 lines
If Kishon wants to take it, here is my
Acked-by Bin Liu <[email protected]>
To recap, this seems to be now only partially needed with commit d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error") heading into v4.9-rc2.
The rest of the changes in the $subject patch we should probably wait on until we have things working in a sane way with PM runtime.
I'll be sending the phy-twl4030-usb related changes separately.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html