musb: omap2430: do not assume balanced enable()/disable()
Subsystems (4)
PATCH v2 1/1 musb: omap2430: do not assume balanced enable()/disable()
The code assumes that omap2430_musb_enable() and omap2430_musb_disable() are called in a balanced way. That fact is broken by the fact that musb_init_controller() calls musb_platform_disable() to switch from unknown state to off state on initialisation.
That means that phy_power_off() is called first so that phy->power_count gets -1 and the phy is not enabled on phy_power_on(). So when usb gadget is started the phy is not powered on. Depending on the phy used that caused various problems. Besides of causing usb problems, that can also have side effects.
In the case of using the phy_twl4030, that prevents also charging the battery via usb (using twl4030_charger) and so makes further kernel debugging hard.
The problem was seen with 4.7 on an openphoenux gta04. It has a DM3730 SoC and a TPS65950 companion. phy->power never became 1 and so the usb did get powered on.
The patch prevents phy_power_off() from being called when it is already off.
---
changes in v2:
improved commit message
drivers/usb/musb/omap2430.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/musb/omap2430.c +4 -3
@@ -413,9 +413,10 @@ static void omap2430_musb_disable(struct musb *musb)struct device *dev = musb->controller;struct omap2430_glue *glue =dev_get_drvdata (dev->parent); -if (!WARN_ON (!musb->phy)) -phy_power_off (musb->phy); - +if (glue->enabled) { +if (!WARN_ON (!musb->phy)) +phy_power_off (musb->phy); + }if (glue->status !=MUSB_UNKNOWN )omap_control_usb_set_mode (glue->control_otghs,USB_MODE_DISCONNECT );
Signature · 1 line
2.1.4
Quoted 15 lines
Am 03.08.2016 um 17:38 schrieb Andreas Kemnade <[email protected]>:
The code assumes that
omap2430_musb_enable()andomap2430_musb_disable()are called in a balanced way. That fact is broken by the fact thatmusb_init_controller()callsmusb_platform_disable()to switch from unknown state to off state on initialisation.That means that
phy_power_off()is called first so thatphy->power_countgets -1 and the phy is not enabled onphy_power_on(). So when usb gadget is started the phy is not powered on. Depending on the phy used that caused various problems. Besides of causing usb problems, that can also have side effects.
Quoted 5 lines
In the case of using the
phy_twl4030, that prevents also charging the battery via usb (usingtwl4030_charger) and so makes further kernel debugging hard.
The problem was seen with 4.7 on an openphoenux gta04. It has a DM3730 SoC and a TPS65950 companion.phy->powernever became 1
s/TPS65950/TPS65950 (twl4030)/
Quoted 1 line
and so the usb did get powered on.
s/did get/did not get/
maybe add:
All this prevents detection of cable plugin-events and VBUS measurement and setting OTG_EN before charging is attempted.
Quoted 38 lines
The patch prevents
phy_power_off()from being called when it is already off.Signed-off-by Andreas Kemnade <[email protected]>---
changes in v2:
improved commit message
drivers/usb/musb/omap2430.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/usb/musb/omap2430.c +4
-3@@ -413,9 +413,10 @@ static void omap2430_musb_disable(struct musb *musb)struct device *dev = musb->controller;struct omap2430_glue *glue =dev_get_drvdata (dev->parent); -if (!WARN_ON (!musb->phy)) -phy_power_off (musb->phy); - +if (glue->enabled) { +if (!WARN_ON (!musb->phy)) +phy_power_off (musb->phy); + }if (glue->status !=MUSB_UNKNOWN )omap_control_usb_set_mode (glue->control_otghs,USB_MODE_DISCONNECT );Signature · 7 lines
2.1.4 _______________________________________________ http://projects.goldelico.com/p/gta04-kernel/ Letux-kernel mailing list [email protected] http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
Hi,
Quoted 2 lines · H. Nikolaus Schaller
All this prevents detection of cable plugin-events and VBUS measurement and setting
OTG_ENbefore charging is attempted.
So I gave this patch a try but it now blocks all deeper SoC idle states as the PHY stays active. I think the real fix is to make sure the charger behaves independent of the USB PHY state. So probably this needs to be fixed in phy-twl4030-usb.c and twl4030_charger.c instead. Now it sounds like we're also shutting down the charger with the USB PHY.
Regards,
Tony
Hi Tony,
Quoted 11 lines
Am 04.08.2016 um 16:29 schrieb Tony Lindgren <[email protected]>:
Hi,
Quoted 2 lines · H. Nikolaus Schaller
All this prevents detection of cable plugin-events and VBUS measurement and setting
OTG_ENbefore charging is attempted.So I gave this patch a try but it now blocks all deeper SoC idle states as the PHY stays active. I think the real fix is to make sure the charger behaves independent of the USB PHY state.
IMHO, plugin detection of the cable is a phy task and then it tells the charger to start. This part works.
Charging did work up to kernel 4.3. It started to fail with 4.4-rc1 without obvious changes to the charger but many patches to phy and musb. We had even backported the 4.7 charger driver to 4.3 and it failed as well.
Quoted 4 lines
So
probably this needs to be fixed inphy-twl4030-usb.candtwl4030_charger.cinstead. Now it sounds like we're also shutting down the charger with the USB PHY.
As a very deeply hidden side-effect the charger is shut down immediately after being started. Because phy-twl4030-usb.c does not do what it is expected and told to do.
I have developed a workaround for the charger driver but I do not consider it as the solution.
http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=b8c538e75c6dd034889bdb0d66e00ca6e128e616
Quoted 31 lines
power:twl4030_charger: hack to set
POWER_CTRL_OTG_ENABwhat twl4030-phy does not doThis hack is a workaround in the charger driver to do what the twl4030-usb driver is expected to have done. It is designed in a way that it can be removed after the twl4030-usb issue is solved, but it does not harm if it isn't removed immediately.
Rationale:
The charger driver calls
pm_runtime_get_sync(bci->transceiver->dev); which should indirectly calltwl4030_usb_set_modeto set thePOWER_CTRL_OTG_ENABbit. This enables the prescaler hardware for ADC8 (VBUS) channel. But this does not happen for reasons outside the charger driver.If this bit is not set there are strange effects:
* VBUS reports 0mV through MADC
* the automatic charging stops after some ms
* ITHEN is disabled automatically and the temperature reports 56°C through MADCThe TPS65950 TRM says:
"The prescaler for the ADCIN8 channel is in the On-The-Go (OTG) module of the USB subchip. This prescaler is enabled when the OTG is enabled by writing 1 to theOTG_ENbit of thePOWER_CTRLregister of the USB subchip."and
"The software must set the POWER_CTRL[5]
OTG_ENbit to 1 at least 50 ms before forcing the BCIMFSTS4[2] USBFASTMCHG bit to 1."
Quoted 6 lines
For unknown reasons this does not happen with current phy-twl4030-usb code.
Therefore we add a hack that ensures that this bit is set and the 50ms delay is done.
It appears as if this problem occurred for the first time in linux 4.4-rc1.
With that we have a workaround in the charger, but not a correct solution. That is what Andreas is trying to fix. The charger driver seems to be ok to me.
Hope this helps to better understand what is going wrong in phy4030 or musb.
BR,
Nikolaus
Quoted 8 lines · H. Nikolaus Schaller
Quoted 5 lines
Am 04.08.2016 um 16:29 schrieb Tony Lindgren <[email protected]>:
So I gave this patch a try but it now blocks all deeper SoC idle states as the PHY stays active. I think the real fix is to make sure the charger behaves independent of the USB PHY state.
IMHO, plugin detection of the cable is a phy task and then it tells the charger to start. This part works.
OK
Quoted 4 lines
Charging did work up to kernel 4.3. It started to fail with 4.4-rc1 without obvious changes to the charger but many patches to phy and musb. We had even backported the 4.7 charger driver to 4.3 and it failed as well.
OK
Quoted 13 lines
Quoted 4 lines
So
probably this needs to be fixed inphy-twl4030-usb.candtwl4030_charger.cinstead. Now it sounds like we're also shutting down the charger with the USB PHY.As a very deeply hidden side-effect the charger is shut down immediately after being started. Because
phy-twl4030-usb.cdoes not do what it is expected and told to do.I have developed a workaround for the charger driver but I do not consider it as the solution.
http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=b8c538e75c6dd034889bdb0d66e00ca6e128e616
...
Quoted 3 lines
With that we have a workaround in the charger, but not a correct solution. That is what Andreas is trying to fix. The charger driver seems to be ok to me.
OK. So does the charger work with just phy-twl4030-usb and charger modules loaded when cable is inserted?
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
Quoted 8 lines · On Thu, 4 Aug 2016 16:49:30 +0200 "H. Nikolaus Schaller" <[email protected]>…
Quoted 8 lines
Rationale:
The charger driver calls
pm_runtime_get_sync(bci->transceiver->dev); which should indirectly calltwl4030_usb_set_modeto set thePOWER_CTRL_OTG_ENABbit. This enables the prescaler hardware for ADC8 (VBUS) channel. But this does not happen for reasons outside the charger driver.
how should that work?
I only have seen the call trace from the musb/omap2430.c glue though the phy subsystem (via phy_ops) to twl4030_phy_power_on (which sets the important bit).
And the phy subsystem has its own power refcounting system which is brought into disorder by unbalanced calls from the musb system...
Regards,
Andreas
Hi,
Quoted 6 lines · On Thu, 4 Aug 2016 07:29:19 -0700 Tony Lindgren <[email protected]> wrote:
Hi,
Quoted 2 lines · H. Nikolaus Schaller
All this prevents detection of cable plugin-events and VBUS measurement and setting
OTG_ENbefore charging is attempted.
Quoted 7 lines
So I gave this patch a try but it now blocks all deeper SoC idle states as the PHY stays active. I think the real fix is to make sure the charger behaves independent of the USB PHY state. So probably this needs to be fixed in
phy-twl4030-usb.candtwl4030_charger.cinstead. Now it sounds like we're also shutting down the charger with the USB PHY.
Then there is another power management issue. The patch is not about fixing every pm issue in musb. That is not only about charging, it is about enabling/disabling() the phy unbalanced:
Again what happens here without the patch:
musb will be initialized:omap2430_musb_disable()
calls phy_power_off(), phy will be disabled,
phy->power_count goes to -1.
gadget driver is loaded.musb_start() is called
omap2430_musb_enable() is called calls phy_power_on(), phy->power_count goes to 0, phy is not powered on because power_count != 1
-> no gadget working, no charging.
Regards
Andreas
Quoted 23 lines · On Thu, 4 Aug 2016 18:31:29 +0200 Andreas Kemnade <[email protected]> wrote:
Hi,
Quoted 6 lines · On Thu, 4 Aug 2016 07:29:19 -0700 Tony Lindgren <[email protected]> wrote:
Hi,
Quoted 2 lines · H. Nikolaus Schaller
All this prevents detection of cable plugin-events and VBUS measurement and setting
OTG_ENbefore charging is attempted.Quoted 7 lines
So I gave this patch a try but it now blocks all deeper SoC idle states as the PHY stays active. I think the real fix is to make sure the charger behaves independent of the USB PHY state. So probably this needs to be fixed in
phy-twl4030-usb.candtwl4030_charger.cinstead. Now it sounds like we're also shutting down the charger with the USB PHY.Then there is another power management issue. The patch is not about fixing every pm issue in musb. That is not only about charging, it is about enabling/disabling() the phy unbalanced:
Again what happens here without the patch:
Quoted 5 lines
musb will be initialized:
omap2430_musb_disable()
callsphy_power_off(), phy will be disabled,phy->power_count goes to -1.
sorry mixed something up.
Nothing happens here, so the previous state of the phy remains. It would be disabled by the generic phy layer in drivers/phy/phy-core.c
Quoted 8 lines
gadget driver is loaded.
musb_start()is calledomap2430_musb_enable() is called calls phy_power_on(), phy->power_count goes to 0, phy is not powered on because power_count != 1-> no gadget working, no charging.
... if not configured by u-boot before. USB gadget might work when initialized earlier in the boot process (u-boot/x-loader/mlo ...) and phy-twl4030 cannot do anything about it besides if we change drivers/phy/phy-core.c
Regards,
Andreas
Quoted 11 lines · Andreas Kemnade
Nothing happens here, so the previous state of the phy remains. It would be disabled by the generic phy layer in
drivers/phy/phy-core.cQuoted 8 lines
gadget driver is loaded.
musb_start()is calledomap2430_musb_enable() is called calls phy_power_on(), phy->power_count goes to 0, phy is not powered on because power_count != 1-> no gadget working, no charging.
Quoted 4 lines
... if not configured by u-boot before. USB gadget might work when initialized earlier in the boot process (u-boot/x-loader/mlo ...) and phy-twl4030 cannot do anything about it besides if we change
drivers/phy/phy-core.c
Ssounds like an issue in the phy-twl4030-usb.c. Let's try to figure out what all we need set there for the various components there.
PM runtime for phy-twl4030-usb.c should be for the whole PHY device including all it's components. Then the charger and MUSB should separately increment the PM runtime count and then enable the component specific things. And then we have the errata to deal with when VBUS is enabled.
If there are MUSB specific PM runtime issues then let's fix those separately.
Regards,
Tony
Quoted 18 lines · On Fri, 5 Aug 2016 06:55:01 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 12 lines · Andreas Kemnade
Nothing happens here, so the previous state of the phy remains. It would be disabled by the generic phy layer in
drivers/phy/phy-core.cQuoted 8 lines
gadget driver is loaded.
musb_start()is calledomap2430_musb_enable() is called calls phy_power_on(), phy->power_count goes to 0, phy is not powered on because power_count != 1-> no gadget working, no charging.
Quoted 4 lines
... if not configured by u-boot before. USB gadget might work when initialized earlier in the boot process (u-boot/x-loader/mlo ...) and phy-twl4030 cannot do anything about it besides if we change
drivers/phy/phy-core.c
Quoted 8 lines
Ssounds like an issue in the
phy-twl4030-usb.c. Let's try to figure out what all we need set there for the various components there.PM runtime for
phy-twl4030-usb.cshould be for the whole PHY device including all it's components. Then the charger and MUSB should separately increment the PM runtime count and then enable the component specific things. And then we have the errata to deal with when VBUS is enabled.
I repeat the subject line of the patch:
[PATCH v2] musb: omap2430: do not assume balanced enable()/disable() It is *not* fix charging.
So you mean that the phy should magically know at which refcounter it should power on and off if power on/off is not called in the balanced way?
Maybe the phy-twl4030 uses the phy layer wrong.
Now the relevant part of power on/off in phy-twl4030 is done via struct phy_ops.power_off/power_on (*not* via pm_runtime). Maybe that is wrong and more parts should be moved to the pm_runtime stuff (which is also present).
Then the phy subsystem has its own power refcounter in struct phy.power_count. It it handled via phy_power_off()/phy_power_on(). And that is called from musb/omap2430.c
But that is another story.
Quoted 4 lines
If there are MUSB specific PM runtime issues then let's fix those separately.
And that exactly tries my patch to do. For that task it does not even use the PM runtime system. Again please read the subject line of the patch. Maybe it unveils some other pm issues in musb which should first be fixed in a complete patch series.
Regards,
Andreas
Quoted 7 lines · Andreas Kemnade
I repeat the subject line of the patch:
[PATCH v2] musb: omap2430: do not assume balanced enable()/disable() It is *not* fix charging.So you mean that the phy should magically know at which refcounter it should power on and off if power on/off is not called in the balanced way?
No, I mean we need to figure out why things can be called in unbalanced way. With your patch I end up with unbalanced calls leaving the phy on after all the modules have been removed :)
Quoted 5 lines
Maybe the phy-twl4030 uses the phy layer wrong.
Now the relevant part of power on/off in phy-twl4030 is done via struct phy_ops.power_off/power_on (*not* viapm_runtime). Maybe that is wrong and more parts should be moved to thepm_runtimestuff (which is also present).
We should use phy power_off/power_on for the USB related parts. The parts needed by other components, like VBUS detection, should be handled by PM runtime. We should get phy-twl4030-usb and the charger driver working also when no musb modules are loaded.
Quoted 4 lines
Then the phy subsystem has its own power refcounter in struct phy.power_count. It it handled via phy_power_off()/phy_power_on(). And that is called from
musb/omap2430.c
But that is another story.
Yes that's what the USB driver is expected to do. But obviously there are issues remaining also in the phy-twl4030-usb.c driver. And it seems that we should have some OTG parts always enabled when VBUS is detected when twl4030-charger is configured?
Quoted 7 lines
Quoted 3 lines
If there are MUSB specific PM runtime issues then let's fix those separately.
And that exactly tries my patch to do. For that task it does not even use the PM runtime system. Again please read the subject line of the patch. Maybe it unveils some other pm issues in musb which should first be fixed in a complete patch series.
Certainly that needs to be fixed, but let's do it in a way where things work for other test cases also. Care to describe how to to reproduce the issue you're seeing? It seems that you are seeing devices not being enmerated leading to the charger not working? Is this with built in MUSB and phy modules?
Regrds,
Tony
Quoted 5 lines · On Fri, 5 Aug 2016 23:21:35 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 4 lines · Andreas Kemnade
I repeat the subject line of the patch:
[PATCH v2] musb: omap2430: do not assume balanced enable()/disable() It is *not* fix charging.
Quoted 8 lines
Quoted 3 lines
So you mean that the phy should magically know at which refcounter it should power on and off if power on/off is not called in the balanced way?
No, I mean we need to figure out why things can be called in unbalanced way. With your patch I end up with unbalanced calls leaving the phy on after all the modules have been removed :)
Well, causing trouble when modules are removed was not the intention. I was just happy to have things working a bit again.
The phy is powered on/off via musb_platform_enable()/musb_platform_disable().
Calls to musb_platform_enable() occur at only 1 place. musb_platform_disable() is called at 4 places.
about balancing:
There is musb_start() and musb_stop(). They are called from musb_gadget_start/stop()
These call musb_platform_enable() and musb_platform_disable(). Looks ok.
There is musb_suspend() and musb_resume():
musb_suspend() calls musb_platform_disable() musb_resume() calls musb_plaform_enable() via musb_start() looks balanced but why don't we use musb_stop() in musb_suspend()?
Now the odd things:musb_platform_disable() in musb_remove() called upon module removal musb_platform_disable() in musb_init_controller() called from musb_probe()
This looks clearly unbalanced.
Quoted 16 lines
Quoted 5 lines
Maybe the phy-twl4030 uses the phy layer wrong.
Now the relevant part of power on/off in phy-twl4030 is done via struct phy_ops.power_off/power_on (*not* viapm_runtime). Maybe that is wrong and more parts should be moved to thepm_runtimestuff (which is also present).We should use phy power_off/power_on for the USB related parts. The parts needed by other components, like VBUS detection, should be handled by PM runtime. We should get phy-twl4030-usb and the charger driver working also when no musb modules are loaded.
Quoted 4 lines
Then the phy subsystem has its own power refcounter in struct phy.power_count. It it handled via phy_power_off()/phy_power_on(). And that is called from
musb/omap2430.c
But that is another story.
Quoted 5 lines
Yes that's what the USB driver is expected to do. But obviously there are issues remaining also in the
phy-twl4030-usb.cdriver. And it seems that we should have some OTG parts always enabled when VBUS is detected when twl4030-charger is configured?
Seems so. I am writing a patch for it.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
If there are MUSB specific PM runtime issues then let's fix those separately.
And that exactly tries my patch to do. For that task it does not even use the PM runtime system. Again please read the subject line of the patch. Maybe it unveils some other pm issues in musb which should first be fixed in a complete patch series.
Quoted 6 lines
Certainly that needs to be fixed, but let's do it in a way where things work for other test cases also. Care to describe how to to reproduce the issue you're seeing? It seems that you are seeing devices not being enmerated leading to the charger not working? Is this with built in MUSB and phy modules?
Both as modules. I added some debug output to the driver/phy/phy-core.c and have seen the phy->power_count sticking at -1 or 0. g_ether is also loaded.
Gadget stops for me (device not showing up at the other side) at 4.7rc4. But I remember Nikolaus having the situation on the same type of device that it was important on which side you replug the usb cable (probably causing some timing differences) with 4.7rc1.
Regards,
Andreas
Quoted 9 lines · Andreas Kemnade
Calls to
musb_platform_enable()occur at only 1 place.musb_platform_disable()is called at 4 places.about balancing:
There ismusb_start()andmusb_stop(). They are called from musb_gadget_start/stop()
These callmusb_platform_enable()andmusb_platform_disable(). Looks ok.
Quoted 5 lines
There is
musb_suspend()andmusb_resume():
musb_suspend()callsmusb_platform_disable()musb_resume()callsmusb_plaform_enable()viamusb_start()looks balanced but why don't we usemusb_stop()inmusb_suspend()?
Hmm let's try adding musb_stop() to musb_suspend() too.
Quoted 6 lines
Now the odd things:
musb_platform_disable()inmusb_remove()called upon module removalmusb_platform_disable()inmusb_init_controller()called frommusb_probe()This looks clearly unbalanced.
Sure would be nice to get those balanced. I think the only reason why musb_platform_disable() is called is to disable interrupts.
Care to post a patch and let's see what happens? I can now easily test the PM with musb.
Regards,
TOny
Hi Andreas,
Thank you for the patch.
Quoted 19 lines · On Wednesday 03 Aug 2016 17:38:51 Andreas Kemnade wrote:
The code assumes that
omap2430_musb_enable()andomap2430_musb_disable()are called in a balanced way. That fact is broken by the fact thatmusb_init_controller()callsmusb_platform_disable()to switch from unknown state to off state on initialisation.That means that
phy_power_off()is called first so thatphy->power_countgets -1 and the phy is not enabled onphy_power_on(). So when usb gadget is started the phy is not powered on. Depending on the phy used that caused various problems. Besides of causing usb problems, that can also have side effects.In the case of using the
phy_twl4030, that prevents also charging the battery via usb (usingtwl4030_charger) and so makes further kernel debugging hard.
The problem was seen with 4.7 on an openphoenux gta04. It has a DM3730 SoC and a TPS65950 companion.phy->powernever became 1 and so the usb did get powered on.
Quoted 4 lines
The patch prevents
phy_power_off()from being called when it is already off.Signed-off-by Andreas Kemnade <[email protected]>
This fixes USB gadget operation on the Panda board.
glue layer")
Quoted 25 lines
---
changes in v2:
improved commit messagedrivers/usb/musb/omap2430.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/usb/musb/omap2430.c +4
-3@@ -413,9 +413,10 @@ static void omap2430_musb_disable(struct musb *musb)struct device *dev = musb->controller;struct omap2430_glue *glue =dev_get_drvdata (dev->parent); -if (!WARN_ON (!musb->phy)) -phy_power_off (musb->phy); - +if (glue->enabled) { +if (!WARN_ON (!musb->phy)) +phy_power_off (musb->phy); + }if (glue->status !=MUSB_UNKNOWN )omap_control_usb_set_mode (glue->control_otghs,USB_MODE_DISCONNECT );
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 27 lines · Laurent Pinchart
Hi Andreas,
Thank you for the patch.
Quoted 22 lines · On Wednesday 03 Aug 2016 17:38:51 Andreas Kemnade wrote:
The code assumes that
omap2430_musb_enable()andomap2430_musb_disable()are called in a balanced way. That fact is broken by the fact thatmusb_init_controller()callsmusb_platform_disable()to switch from unknown state to off state on initialisation.That means that
phy_power_off()is called first so thatphy->power_countgets -1 and the phy is not enabled onphy_power_on(). So when usb gadget is started the phy is not powered on. Depending on the phy used that caused various problems. Besides of causing usb problems, that can also have side effects.In the case of using the
phy_twl4030, that prevents also charging the battery via usb (usingtwl4030_charger) and so makes further kernel debugging hard.
The problem was seen with 4.7 on an openphoenux gta04. It has a DM3730 SoC and a TPS65950 companion.phy->powernever became 1 and so the usb did get powered on.The patch prevents
phy_power_off()from being called when it is already off.
Quoted 7 lines
Quoted 1 line
Signed-off-by Andreas Kemnade <[email protected]>This fixes USB gadget operation on the Panda board.
Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phy handling for 2430glue layer")
This patch has a side effect of fixing the issue by breaking PM runtime, not a good fix as discussed.
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 Tony,
Quoted 26 lines · On Friday 09 Sep 2016 13:08:03 Tony Lindgren wrote:
Quoted 25 lines · Laurent Pinchart
Quoted 23 lines · On Wednesday 03 Aug 2016 17:38:51 Andreas Kemnade wrote:
The code assumes that
omap2430_musb_enable()andomap2430_musb_disable()are called in a balanced way. That fact is broken by the fact thatmusb_init_controller()callsmusb_platform_disable()to switch from unknown state to off state on initialisation.That means that
phy_power_off()is called first so thatphy->power_countgets -1 and the phy is not enabled onphy_power_on(). So when usb gadget is started the phy is not powered on. Depending on the phy used that caused various problems. Besides of causing usb problems, that can also have side effects.In the case of using the
phy_twl4030, that prevents also charging the battery via usb (usingtwl4030_charger) and so makes further kernel debugging hard.
The problem was seen with 4.7 on an openphoenux gta04. It has a DM3730 SoC and a TPS65950 companion.phy->powernever became 1 and so the usb did get powered on.The patch prevents
phy_power_off()from being called when it is already off.Signed-off-by Andreas Kemnade <[email protected]>
Quoted 8 lines
Quoted 5 lines
This fixes USB gadget operation on the Panda board.
Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phy handling for2430 glue layer")
Tested-by Laurent Pinchart <[email protected]>This patch has a side effect of fixing the issue by breaking PM runtime, not a good fix as discussed.
How exactly is it worse breaking runtime PM than breaking USB gadget completely ? :-)
The issue here is that the .disable() platform operation is called by musb with the PHY already powered off, leading to the PHY power reference count becoming negative. The next call to the .enable() operation restores the reference count to 0 without enabling the PHY.
Feel free to send me a better fix and I will test it.
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 37 lines · On Fri, 09 Sep 2016 23:21:50 +0300 Laurent Pinchart…
Hi Tony,
Quoted 34 lines · On Friday 09 Sep 2016 13:08:03 Tony Lindgren wrote:
* Laurent Pinchart <[email protected]> [160909 12:27]:
Quoted 31 lines · On Wednesday 03 Aug 2016 17:38:51 Andreas Kemnade wrote:
Quoted 20 lines
The code assumes that
omap2430_musb_enable()andomap2430_musb_disable()are called in a balanced way. That fact is broken by the fact thatmusb_init_controller()callsmusb_platform_disable()to switch from unknown state to off state on initialisation.That means that
phy_power_off()is called first so thatphy->power_countgets -1 and the phy is not enabled onphy_power_on(). So when usb gadget is started the phy is not powered on. Depending on the phy used that caused various problems. Besides of causing usb problems, that can also have side effects.In the case of using the
phy_twl4030, that prevents also charging the battery via usb (usingtwl4030_charger) and so makes further kernel debugging hard.
The problem was seen with 4.7 on an openphoenux gta04. It has a DM3730 SoC and a TPS65950 companion.phy->powernever became 1 and so the usb did get powered on.Quoted 4 lines
The patch prevents
phy_power_off()from being called when it is already off.Signed-off-by Andreas Kemnade <[email protected]>This fixes USB gadget operation on the Panda board.
Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phyhandling for 2430 glue layer")
Tested-by Laurent Pinchart <[email protected]>
Quoted 6 lines
Quoted 2 lines
This patch has a side effect of fixing the issue by breaking PM runtime, not a good fix as discussed.
How exactly is it worse breaking runtime PM than breaking USB gadget completely ? :-)
Does it still break with my phy-twl4030 fixes? At least on gta04, they fix real problems and hide the musb problem I tried to fix with this patch.
https://patchwork.kernel.org/patch/9292097/
https://patchwork.kernel.org/patch/9298447/
Quoted 7 lines
The issue here is that the .disable() platform operation is called by musb with the PHY already powered off, leading to the PHY power reference count becoming negative. The next call to the .enable() operation restores the reference count to 0 without enabling the PHY.
Feel free to send me a better fix and I will test it.
The patch has to be reworked on top of the patch series:
Implement PM runtime for musb-core based on session bit
Regards,
Andreas Kemnade
Quoted 11 lines · Andreas Kemnade
Quoted 4 lines · On Fri, 09 Sep 2016 23:21:50 +0300 Laurent Pinchart…
How exactly is it worse breaking runtime PM than breaking USB gadget completely ? :-)
Does it still break with my phy-twl4030 fixes? At least on gta04, they fix real problems and hide the musb problem I tried to fix with this patch.
https://patchwork.kernel.org/patch/9292097/
https://patchwork.kernel.org/patch/9298447/
Andreas, it's a different USB PHY on pandaboard, that's using phy-twl6030-usb.c. Probably similar issue.
Quoted 9 lines
Quoted 7 lines
The issue here is that the .disable() platform operation is called by musb with the PHY already powered off, leading to the PHY power reference count becoming negative. The next call to the .enable() operation restores the reference count to 0 without enabling the PHY.
Feel free to send me a better fix and I will test it.
The patch has to be reworked on top of the patch series:
Implement PM runtime for musb-core based on session bit
Yeah that leaves out all most of the trickery with the glue specific PM runtime tinkering so tracking down any remaining unbalanced calls should be easier :)
But that's for v4.9, let's see what's the minimal fix for v4.8.
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
Quoted 6 lines · Laurent Pinchart
Quoted 2 lines · On Friday 09 Sep 2016 13:08:03 Tony Lindgren wrote:
This patch has a side effect of fixing the issue by breaking PM runtime, not a good fix as discussed.
How exactly is it worse breaking runtime PM than breaking USB gadget completely ? :-)
Yeah sorry to break it, I obviously did not test it on all platforms :( I'm mostly using omap3 with the 2430 glue layer and am335x for the dsps glue layer and did not know that omap4 is broken. I guess I've recently just used the EHCI ports on panda.
Quoted 4 lines
The issue here is that the .disable() platform operation is called by musb with the PHY already powered off, leading to the PHY power reference count becoming negative. The next call to the .enable() operation restores the reference count to 0 without enabling the PHY.
Well for the phy-twl4030-usb.c, AFAIK the right fix is to fix the PHY driver as done in "[PATCH v2] phy-twl4030-usb: initialize charging-related stuff via pm_runtime". I suspect something similar is happening here also with the omap4 legacy phy.
Quoted 1 line
Feel free to send me a better fix and I will test it.
Yeah will do, hang on.
Tony
Quoted 19 lines · On Fri, 9 Sep 2016 13:51:04 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 6 lines · Laurent Pinchart
Quoted 2 lines · On Friday 09 Sep 2016 13:08:03 Tony Lindgren wrote:
This patch has a side effect of fixing the issue by breaking PM runtime, not a good fix as discussed.
How exactly is it worse breaking runtime PM than breaking USB gadget completely ? :-)
Yeah sorry to break it, I obviously did not test it on all platforms :( I'm mostly using omap3 with the 2430 glue layer and am335x for the dsps glue layer and did not know that omap4 is broken. I guess I've recently just used the EHCI ports on panda.
Quoted 5 lines
The issue here is that the .disable() platform operation is called by musb with the PHY already powered off, leading to the PHY power reference count becoming negative. The next call to the .enable() operation restores the reference count to 0 without enabling the PHY.
Quoted 5 lines
Well for the
phy-twl4030-usb.c, AFAIK the right fix is to fix the PHY driver as done in "[PATCH v2] phy-twl4030-usb: initialize charging-related stuff viapm_runtime". I suspect something similar is happening here also with the omap4 legacy phy.
No, the fix is for making charging work independant of musb. Gadget is working because charging is enabled and enables all parts in the phy needed for it. And you can charge without musb (only musb_hdrc for the mailbox but not the omap2430 glue module).
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enable the phy enough to allow charging on pm_runtime_get(). That is fixed by my phy-related patches.
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way in omap240.c
b) prevent musb_platform_enable() musb_platform_disable() to be called in an unbalanced way by fixing musb_core.c
Fixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.
Regards,
Andreas Kemnade
Quoted 11 lines · Andreas Kemnade
Quoted 5 lines · On Fri, 9 Sep 2016 13:51:04 -0700 Tony Lindgren <[email protected]> wrote:
Well for the
phy-twl4030-usb.c, AFAIK the right fix is to fix the PHY driver as done in "[PATCH v2] phy-twl4030-usb: initialize charging-related stuff viapm_runtime". I suspect something similar is happening here also with the omap4 legacy phy.No, the fix is for making charging work independant of musb. Gadget is working because charging is enabled and enables all parts in the phy needed for it. And you can charge without musb (only
musb_hdrcfor the mailbox but not the omap2430 glue module).
Oh right.
Quoted 4 lines
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enable the phy enough to allow charging onpm_runtime_get(). That is fixed by my phy-related patches.
OK
Quoted 9 lines
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in
omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way inomap240.c
b) preventmusb_platform_enable()musb_platform_disable()to be called in an unbalanced way by fixingmusb_core.c
Quoted 4 lines
Fixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.
Sounds like option 2b here is the real fix.
Regards,
Tony
Quoted 17 lines · Tony Lindgren
Quoted 4 lines · Andreas Kemnade
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enable the phy enough to allow charging onpm_runtime_get(). That is fixed by my phy-related patches.OK
Quoted 9 lines
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in
omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way inomap240.c
b) preventmusb_platform_enable()musb_platform_disable()to be called in an unbalanced way by fixingmusb_core.c
Quoted 6 lines
Quoted 4 lines
Fixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.Sounds like option 2b here is the real fix.
And doing full option 2b would be intrusive because of musb_stop also calling musb_platform_disable. Here's a suggested fix for v4.8-rc cycle.
Seems to work for me for omap3 torpedo using phy-twl4030-usb, omap4 pandaboard es using phy-twl6030-usb and am335x beaglebone black using dsps glue. Also PM runtime works on omap3.
This patch causes a slight merge conlict with Andrea's patches, as listed in #1 above, but we should probably merge this first as a fix. That is assuming it does not cause side effects to Andrea's phy-twl4030-usb charger test case.
Can you guys please test? If things work I'll resend the patch with proper tested-bys and acks.
Regards,
Tony
8< --------------------------
From: Tony Lindgren <[email protected]>
Date: Fri, 9 Sep 2016 15:04:53 -0700
Subject: [PATCH] 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 also musb_stop as it currently calls musb_platform_disable.
Instead, let's first fix the regression in a minimal way by removing the initial call to musb_platform_disable.
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").
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")
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/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 */
Quoted 23 lines · On Fri, 9 Sep 2016 16:40:15 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 22 lines · Tony Lindgren
Quoted 4 lines · Andreas Kemnade
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enable the phy enough to allow charging onpm_runtime_get(). That is fixed by my phy-related patches.OK
Quoted 13 lines
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in
omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way inomap240.c
b) preventmusb_platform_enable()musb_platform_disable()to be called in an unbalanced way by fixingmusb_core.cFixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.
Quoted 6 lines
Quoted 1 line
Sounds like option 2b here is the real fix.
And doing full option 2b would be intrusive because of
musb_stopalso callingmusb_platform_disable. Here's a suggested fix for v4.8-rc cycle.
musb_platform_disable() in musb_stop() seems to be balanced.
from my list in an earlier mail:musb_platform_disable() in musb_remove() called upon module removal
To my analysis this is odd because musb_stop() is also called indirectly upon removal.
But topic that can be left for later.
Quoted 9 lines
Seems to work for me for omap3 torpedo using phy-twl4030-usb, omap4 pandaboard es using phy-twl6030-usb and am335x beaglebone black using dsps glue. Also PM runtime works on omap3.
This patch causes a slight merge conlict with Andrea's patches, as listed in #1 above, but we should probably merge this first as a fix. That is assuming it does not cause side effects to Andrea's phy-twl4030-usb charger test case.
Hmm, if the patch will gender-change me, then a clear NAK ;-)
Quoted 3 lines
Can you guys please test? If things work I'll resend the patch with proper tested-bys and acks.
I tested the patch without any other musb/phy-fixes. No regressions. It fixes Gadget to be usable. Charging seems not to be totally stable. I will check my phy-patches on top of that again.
PM runtime probably still desires some work on it. But I give a clear Ack for merging this one first.
Regards,
Andreas Kemnade
Quoted 75 lines
Regards,
Tony
8< --------------------------
From: Tony Lindgren <[email protected]>
Date: Fri, 9 Sep 2016 15:04:53 -0700
Subject: [PATCH] usb: musb: Fix unbalancedplatform_disableCommit
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 also
musb_stopas it currently callsmusb_platform_disable.Instead, let's first fix the regression in a minimal way by removing the initial call to
musb_platform_disable.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").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 Kishon Vijay Abraham I <[email protected]>Reported-by Andreas Kemnade <[email protected]>Reported-by Laurent Pinchart <[email protected]>Fixes a83e17d0f73b ("usb: musb: Improve PM runtime and phy handlingfor 2430 glue layer")
Signed-off-by Tony Lindgren <[email protected]>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/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 */
Quoted 32 lines · Andreas Kemnade
Quoted 23 lines · On Fri, 9 Sep 2016 16:40:15 -0700 Tony Lindgren…
Quoted 22 lines · Tony Lindgren
Quoted 4 lines · Andreas Kemnade
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enable the phy enough to allow charging onpm_runtime_get(). That is fixed by my phy-related patches.OK
Quoted 13 lines
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in
omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way inomap240.c
b) preventmusb_platform_enable()musb_platform_disable()to be called in an unbalanced way by fixingmusb_core.cFixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.Quoted 6 lines
Quoted 1 line
Sounds like option 2b here is the real fix.
And doing full option 2b would be intrusive because of
musb_stopalso callingmusb_platform_disable. Here's a suggested fix for v4.8-rc cycle.
Quoted 8 lines
musb_platform_disable()inmusb_stop()seems to be balanced.from my list in an earlier mail:
musb_platform_disable()inmusb_remove()called upon module removalTo my analysis this is odd because
musb_stop()is also called indirectly upon removal.
But topic that can be left for later.
OK will update the patch description. You probaby should attempt to do a patch to make the calls paired as you already know what needs to be done there..
Quoted 10 lines
Quoted 9 lines
Seems to work for me for omap3 torpedo using phy-twl4030-usb, omap4 pandaboard es using phy-twl6030-usb and am335x beaglebone black using dsps glue. Also PM runtime works on omap3.
This patch causes a slight merge conlict with Andrea's patches, as listed in #1 above, but we should probably merge this first as a fix. That is assuming it does not cause side effects to Andrea's phy-twl4030-usb charger test case.
Hmm, if the patch will gender-change me, then a clear NAK ;-)
Sorry typo there, s/Andrea/Andreas/, no need for other radical changes :)
Quoted 9 lines
Quoted 3 lines
Can you guys please test? If things work I'll resend the patch with proper tested-bys and acks.
I tested the patch without any other musb/phy-fixes. No regressions. It fixes Gadget to be usable. Charging seems not to be totally stable. I will check my phy-patches on top of that again.
PM runtime probably still desires some work on it. But I give a clear Ack for merging this one first.
OK good to hear & thanks for testing. Let's see what Laurent says.
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 Tony,
Quoted 70 lines · On Saturday 10 Sep 2016 06:07:50 Tony Lindgren wrote:
Quoted 32 lines · Andreas Kemnade
Quoted 25 lines · On Fri, 9 Sep 2016 16:40:15 -0700 Tony Lindgren wrote:
Quoted 24 lines · Tony Lindgren
Quoted 5 lines · Andreas Kemnade
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enablethe phy enough to allow charging on
pm_runtime_get(). That is fixed by my phy-related patches.OK
Quoted 14 lines
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in
omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way inomap240.cb) prevent
musb_platform_enable()musb_platform_disable()to be called in an unbalanced way by fixingmusb_core.cFixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.Quoted 5 lines
Quoted 1 line
Sounds like option 2b here is the real fix.
And doing full option 2b would be intrusive because of
musb_stopalso callingmusb_platform_disable. Here's a suggested fix for v4.8-rc cycle.Quoted 8 lines
musb_platform_disable()inmusb_stop()seems to be balanced.from my list in an earlier mail:
musb_platform_disable()inmusb_remove()called upon module removalTo my analysis this is odd because
musb_stop()is also called indirectly upon removal.
But topic that can be left for later.OK will update the patch description. You probaby should attempt to do a patch to make the calls paired as you already know what needs to be done there..
Quoted 10 lines
Quoted 8 lines
Seems to work for me for omap3 torpedo using phy-twl4030-usb, omap4 pandaboard es using phy-twl6030-usb and am335x beaglebone black using dsps glue. Also PM runtime works on omap3.
This patch causes a slight merge conlict with Andrea's patches, as listed in #1 above, but we should probably merge this first as a fix. That is assuming it does not cause side effects to Andrea's phy-twl4030-usb charger test case.
Hmm, if the patch will gender-change me, then a clear NAK ;-)
Sorry typo there, s/Andrea/Andreas/, no need for other radical changes :)
Quoted 9 lines
Quoted 2 lines
Can you guys please test? If things work I'll resend the patch with proper tested-bys and acks.
I tested the patch without any other musb/phy-fixes. No regressions. It fixes Gadget to be usable. Charging seems not to be totally stable. I will check my phy-patches on top of that again.
PM runtime probably still desires some work on it. But I give a clear Ack for merging this one first.
Quoted 2 lines
OK good to hear & thanks for testing. Let's see what Laurent says.
I say
Thank you for the fix.
Signature · 8 lines
Regards, Laurent Pinchart -- 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 76 lines · Laurent Pinchart
Hi Tony,
Quoted 70 lines · On Saturday 10 Sep 2016 06:07:50 Tony Lindgren wrote:
Quoted 32 lines · Andreas Kemnade
Quoted 25 lines · On Fri, 9 Sep 2016 16:40:15 -0700 Tony Lindgren wrote:
Quoted 24 lines · Tony Lindgren
Quoted 5 lines · Andreas Kemnade
We have two independant things:
1. phy-twl4030-usb (and perhaps others) do not enablethe phy enough to allow charging on
pm_runtime_get(). That is fixed by my phy-related patches.OK
Quoted 14 lines
2. phy_power_off/on() in called in an unbalanced way if it is called behind musb_platform_enable()/disable() as it happens in
omap2430.c. Two ways to fix it:
a) prevent phy_power_off()/on() to be called in an unbalanced way inomap240.cb) prevent
musb_platform_enable()musb_platform_disable()to be called in an unbalanced way by fixingmusb_core.cFixing 1. is enough on gta04 to fix charging and hide 2. enough to have gadget working for the most common usecases. (not using twl4030-charger would not work yet)
But in the longer term 2. has to be fixed too.Quoted 5 lines
Quoted 1 line
Sounds like option 2b here is the real fix.
And doing full option 2b would be intrusive because of
musb_stopalso callingmusb_platform_disable. Here's a suggested fix for v4.8-rc cycle.Quoted 8 lines
musb_platform_disable()inmusb_stop()seems to be balanced.from my list in an earlier mail:
musb_platform_disable()inmusb_remove()called upon module removalTo my analysis this is odd because
musb_stop()is also called indirectly upon removal.
But topic that can be left for later.OK will update the patch description. You probaby should attempt to do a patch to make the calls paired as you already know what needs to be done there..
Quoted 10 lines
Quoted 8 lines
Seems to work for me for omap3 torpedo using phy-twl4030-usb, omap4 pandaboard es using phy-twl6030-usb and am335x beaglebone black using dsps glue. Also PM runtime works on omap3.
This patch causes a slight merge conlict with Andrea's patches, as listed in #1 above, but we should probably merge this first as a fix. That is assuming it does not cause side effects to Andrea's phy-twl4030-usb charger test case.
Hmm, if the patch will gender-change me, then a clear NAK ;-)
Sorry typo there, s/Andrea/Andreas/, no need for other radical changes :)
Quoted 9 lines
Quoted 2 lines
Can you guys please test? If things work I'll resend the patch with proper tested-bys and acks.
I tested the patch without any other musb/phy-fixes. No regressions. It fixes Gadget to be usable. Charging seems not to be totally stable. I will check my phy-patches on top of that again.
PM runtime probably still desires some work on it. But I give a clear Ack for merging this one first.Quoted 2 lines
OK good to hear & thanks for testing. Let's see what Laurent says.
Quoted 6 lines
I say
Tested-by Laurent Pinchart <[email protected]>Acked-by Laurent Pinchart <[email protected]>Thank you for the fix.
OK great, will send a proper patch with acks shortly.
Thanks,
Tony