* [PATCH v2 0/4] usb: dwc2: Another attempt handling rk3288's remote wake quirk
@ 2019-04-16 21:53 ` Douglas Anderson
0 siblings, 0 replies; 21+ messages in thread
From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw)
To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi
Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase,
jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel,
Greg Kroah-Hartman, Mark Rutland, linux-arm-kernel
This is another attempt to upstream the code to unwedge the rk3288's
"host" USB port when it sees a remote wakeup. Previously I attempted
this [1] and it appears that Randy Li made some attempts too [2] which
resulted in at least the PHY bindings for the USB PHY landing as well
as the USB PHY support. Nice!
Hopefully this addresses previous comments and could land this time?
[1] https://lkml.kernel.org/r/1446236275-12698-2-git-send-email-dianders@chromium.org
[2] https://lkml.kernel.org/r/1472939729-15187-4-git-send-email-ayaka@soulik.info
Changes in v2:
- Cancel the work when dwc2 is freed (Matthias).
Douglas Anderson (4):
dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup
usb: dwc2: optionally assert phy reset when waking up
ARM: dts: rockchip: Hook resets up to USB PHYs on rk3288.
ARM: dts: rockchip: Add quirk for resetting rk3288's dwc2 host on
wakeup
Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++
arch/arm/boot/dts/rk3288.dtsi | 7 +++++++
drivers/usb/dwc2/core.h | 5 +++++
drivers/usb/dwc2/core_intr.c | 12 ++++++++++++
drivers/usb/dwc2/hcd.c | 18 +++++++++++++++---
drivers/usb/dwc2/platform.c | 9 +++++++++
6 files changed, 50 insertions(+), 3 deletions(-)
--
2.21.0.593.g511ec345e18-goog
^ permalink raw reply [flat|nested] 21+ messages in thread* [PATCH v2 0/4] usb: dwc2: Another attempt handling rk3288's remote wake quirk @ 2019-04-16 21:53 ` Douglas Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: Mark Rutland, devicetree, linux-usb, amstan, Greg Kroah-Hartman, Randy Li, Douglas Anderson, linux-kernel, linux-rockchip, mka, ryandcase, Elaine Zhang, jwerner, linux-arm-kernel This is another attempt to upstream the code to unwedge the rk3288's "host" USB port when it sees a remote wakeup. Previously I attempted this [1] and it appears that Randy Li made some attempts too [2] which resulted in at least the PHY bindings for the USB PHY landing as well as the USB PHY support. Nice! Hopefully this addresses previous comments and could land this time? [1] https://lkml.kernel.org/r/1446236275-12698-2-git-send-email-dianders@chromium.org [2] https://lkml.kernel.org/r/1472939729-15187-4-git-send-email-ayaka@soulik.info Changes in v2: - Cancel the work when dwc2 is freed (Matthias). Douglas Anderson (4): dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup usb: dwc2: optionally assert phy reset when waking up ARM: dts: rockchip: Hook resets up to USB PHYs on rk3288. ARM: dts: rockchip: Add quirk for resetting rk3288's dwc2 host on wakeup Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ arch/arm/boot/dts/rk3288.dtsi | 7 +++++++ drivers/usb/dwc2/core.h | 5 +++++ drivers/usb/dwc2/core_intr.c | 12 ++++++++++++ drivers/usb/dwc2/hcd.c | 18 +++++++++++++++--- drivers/usb/dwc2/platform.c | 9 +++++++++ 6 files changed, 50 insertions(+), 3 deletions(-) -- 2.21.0.593.g511ec345e18-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <20190416215351.242246-1-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA, amstan-F7+t8E8rja9g9hUCZPvPmw, Greg Kroah-Hartman, Randy Li, Douglas Anderson, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, mka-F7+t8E8rja9g9hUCZPvPmw, ryandcase-F7+t8E8rja9g9hUCZPvPmw, Elaine Zhang, jwerner-F7+t8E8rja9g9hUCZPvPmw On Rockchip rk3288 there's a hardware quirk where we need to assert the reset signal to the PHY when we get a remote wakeup on one of the two ports. Document this quirk in the bindings. Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> Reviewed-by: Matthias Kaehlcke <mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> --- Changes in v2: None Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt index 6dc3c4a34483..f70f3aee4bfc 100644 --- a/Documentation/devicetree/bindings/usb/dwc2.txt +++ b/Documentation/devicetree/bindings/usb/dwc2.txt @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties - g-rx-fifo-size: size of rx fifo size in gadget mode. - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when + we detect a wakeup. This is due to a hardware errata. Deprecated properties: - g-use-dma: gadget DMA mode is automatically detected -- 2.21.0.593.g511ec345e18-goog ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel, Greg Kroah-Hartman, Mark Rutland On Rockchip rk3288 there's a hardware quirk where we need to assert the reset signal to the PHY when we get a remote wakeup on one of the two ports. Document this quirk in the bindings. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> --- Changes in v2: None Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt index 6dc3c4a34483..f70f3aee4bfc 100644 --- a/Documentation/devicetree/bindings/usb/dwc2.txt +++ b/Documentation/devicetree/bindings/usb/dwc2.txt @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties - g-rx-fifo-size: size of rx fifo size in gadget mode. - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when + we detect a wakeup. This is due to a hardware errata. Deprecated properties: - g-use-dma: gadget DMA mode is automatically detected -- 2.21.0.593.g511ec345e18-goog ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [v2,1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel, Greg Kroah-Hartman, Mark Rutland On Rockchip rk3288 there's a hardware quirk where we need to assert the reset signal to the PHY when we get a remote wakeup on one of the two ports. Document this quirk in the bindings. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> --- Changes in v2: None Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt index 6dc3c4a34483..f70f3aee4bfc 100644 --- a/Documentation/devicetree/bindings/usb/dwc2.txt +++ b/Documentation/devicetree/bindings/usb/dwc2.txt @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties - g-rx-fifo-size: size of rx fifo size in gadget mode. - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when + we detect a wakeup. This is due to a hardware errata. Deprecated properties: - g-use-dma: gadget DMA mode is automatically detected ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 0:53 ` Rob Herring 0 siblings, 0 replies; 21+ messages in thread From: Rob Herring @ 2019-04-30 0:53 UTC (permalink / raw) To: Douglas Anderson Cc: Minas Harutyunyan, Heiko Stuebner, Felipe Balbi, amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, devicetree, linux-kernel, Greg Kroah-Hartman, Mark Rutland On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > On Rockchip rk3288 there's a hardware quirk where we need to assert > the reset signal to the PHY when we get a remote wakeup on one of the > two ports. Document this quirk in the bindings. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > Reviewed-by: Matthias Kaehlcke <mka@chromium.org> > --- > > Changes in v2: None > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > index 6dc3c4a34483..f70f3aee4bfc 100644 > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > - g-rx-fifo-size: size of rx fifo size in gadget mode. > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > + we detect a wakeup. This is due to a hardware errata. Synopsys or Rockchip errata? Ideally, this should be implied by the controller or phy compatible. Rob ^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2,1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 0:53 ` Rob Herring 0 siblings, 0 replies; 21+ messages in thread From: Rob Herring @ 2019-04-30 0:53 UTC (permalink / raw) To: Douglas Anderson Cc: Minas Harutyunyan, Heiko Stuebner, Felipe Balbi, amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, devicetree, linux-kernel, Greg Kroah-Hartman, Mark Rutland On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > On Rockchip rk3288 there's a hardware quirk where we need to assert > the reset signal to the PHY when we get a remote wakeup on one of the > two ports. Document this quirk in the bindings. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > Reviewed-by: Matthias Kaehlcke <mka@chromium.org> > --- > > Changes in v2: None > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > index 6dc3c4a34483..f70f3aee4bfc 100644 > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > - g-rx-fifo-size: size of rx fifo size in gadget mode. > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > + we detect a wakeup. This is due to a hardware errata. Synopsys or Rockchip errata? Ideally, this should be implied by the controller or phy compatible. Rob ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 5:29 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-30 5:29 UTC (permalink / raw) To: Rob Herring Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA, Randy Li, Heiko Stuebner, Felipe Balbi, Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, LKML, open list:ARM/Rockchip SoC..., Matthias Kaehlcke, Ryan Case, Elaine Zhang, Minas Harutyunyan, Julius Werner, Alexandru M Stan Hi, On Mon, Apr 29, 2019 at 5:54 PM Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > > On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > > On Rockchip rk3288 there's a hardware quirk where we need to assert > > the reset signal to the PHY when we get a remote wakeup on one of the > > two ports. Document this quirk in the bindings. > > > > Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > Reviewed-by: Matthias Kaehlcke <mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > --- > > > > Changes in v2: None > > > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > > index 6dc3c4a34483..f70f3aee4bfc 100644 > > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > > - g-rx-fifo-size: size of rx fifo size in gadget mode. > > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > > + we detect a wakeup. This is due to a hardware errata. > > Synopsys or Rockchip errata? > > Ideally, this should be implied by the controller or phy compatible. I have no idea. The errata was described to me by Rockchip but I don't know if it's common to more than one board. You're right that we could do it on the controller compatible, but we have to be careful. The two ports on rk3288 currently have the same compatible string but the errata only applies to one of them. ...so I'd have to cue on not just the compatible string but also detect whether we're on the "OTG" port of the "host only" port. That's not too hard, though since it is probe-able. I'm happy to spin this but I'll wait to hear from Felipe. This is already in his testing tree, so presumably I should do a follow-up patch. ...but if he wants me to re-post I can do that too. -Doug ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 5:29 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-30 5:29 UTC (permalink / raw) To: Rob Herring Cc: Minas Harutyunyan, Heiko Stuebner, Felipe Balbi, Alexandru M Stan, open list:ARM/Rockchip SoC..., linux-usb, Randy Li, Matthias Kaehlcke, Ryan Case, Julius Werner, Elaine Zhang, devicetree, LKML, Greg Kroah-Hartman, Mark Rutland Hi, On Mon, Apr 29, 2019 at 5:54 PM Rob Herring <robh@kernel.org> wrote: > > On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > > On Rockchip rk3288 there's a hardware quirk where we need to assert > > the reset signal to the PHY when we get a remote wakeup on one of the > > two ports. Document this quirk in the bindings. > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > Reviewed-by: Matthias Kaehlcke <mka@chromium.org> > > --- > > > > Changes in v2: None > > > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > > index 6dc3c4a34483..f70f3aee4bfc 100644 > > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > > - g-rx-fifo-size: size of rx fifo size in gadget mode. > > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > > + we detect a wakeup. This is due to a hardware errata. > > Synopsys or Rockchip errata? > > Ideally, this should be implied by the controller or phy compatible. I have no idea. The errata was described to me by Rockchip but I don't know if it's common to more than one board. You're right that we could do it on the controller compatible, but we have to be careful. The two ports on rk3288 currently have the same compatible string but the errata only applies to one of them. ...so I'd have to cue on not just the compatible string but also detect whether we're on the "OTG" port of the "host only" port. That's not too hard, though since it is probe-able. I'm happy to spin this but I'll wait to hear from Felipe. This is already in his testing tree, so presumably I should do a follow-up patch. ...but if he wants me to re-post I can do that too. -Doug ^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2,1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 5:29 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-30 5:29 UTC (permalink / raw) To: Rob Herring Cc: Minas Harutyunyan, Heiko Stuebner, Felipe Balbi, Alexandru M Stan, open list:ARM/Rockchip SoC..., linux-usb, Randy Li, Matthias Kaehlcke, Ryan Case, Julius Werner, Elaine Zhang, devicetree, LKML, Greg Kroah-Hartman, Mark Rutland Hi, On Mon, Apr 29, 2019 at 5:54 PM Rob Herring <robh@kernel.org> wrote: > > On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > > On Rockchip rk3288 there's a hardware quirk where we need to assert > > the reset signal to the PHY when we get a remote wakeup on one of the > > two ports. Document this quirk in the bindings. > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > Reviewed-by: Matthias Kaehlcke <mka@chromium.org> > > --- > > > > Changes in v2: None > > > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > > index 6dc3c4a34483..f70f3aee4bfc 100644 > > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > > - g-rx-fifo-size: size of rx fifo size in gadget mode. > > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > > + we detect a wakeup. This is due to a hardware errata. > > Synopsys or Rockchip errata? > > Ideally, this should be implied by the controller or phy compatible. I have no idea. The errata was described to me by Rockchip but I don't know if it's common to more than one board. You're right that we could do it on the controller compatible, but we have to be careful. The two ports on rk3288 currently have the same compatible string but the errata only applies to one of them. ...so I'd have to cue on not just the compatible string but also detect whether we're on the "OTG" port of the "host only" port. That's not too hard, though since it is probe-able. I'm happy to spin this but I'll wait to hear from Felipe. This is already in his testing tree, so presumably I should do a follow-up patch. ...but if he wants me to re-post I can do that too. -Doug ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 13:51 ` Rob Herring 0 siblings, 0 replies; 21+ messages in thread From: Rob Herring @ 2019-04-30 13:51 UTC (permalink / raw) To: Doug Anderson Cc: Minas Harutyunyan, Heiko Stuebner, Felipe Balbi, Alexandru M Stan, open list:ARM/Rockchip SoC..., Linux USB List, Randy Li, Matthias Kaehlcke, Ryan Case, Julius Werner, Elaine Zhang, devicetree, LKML, Greg Kroah-Hartman, Mark Rutland On Tue, Apr 30, 2019 at 12:29 AM Doug Anderson <dianders@chromium.org> wrote: > > Hi, > > On Mon, Apr 29, 2019 at 5:54 PM Rob Herring <robh@kernel.org> wrote: > > > > On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > > > On Rockchip rk3288 there's a hardware quirk where we need to assert > > > the reset signal to the PHY when we get a remote wakeup on one of the > > > two ports. Document this quirk in the bindings. > > > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > > Reviewed-by: Matthias Kaehlcke <mka@chromium.org> > > > --- > > > > > > Changes in v2: None > > > > > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > > > index 6dc3c4a34483..f70f3aee4bfc 100644 > > > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > > > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > > > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > > > - g-rx-fifo-size: size of rx fifo size in gadget mode. > > > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > > > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > > > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > > > + we detect a wakeup. This is due to a hardware errata. > > > > Synopsys or Rockchip errata? > > > > Ideally, this should be implied by the controller or phy compatible. > > I have no idea. The errata was described to me by Rockchip but I > don't know if it's common to more than one board. > > You're right that we could do it on the controller compatible, but we > have to be careful. The two ports on rk3288 currently have the same > compatible string but the errata only applies to one of them. ...so > I'd have to cue on not just the compatible string but also detect > whether we're on the "OTG" port of the "host only" port. That's not > too hard, though since it is probe-able. > > I'm happy to spin this but I'll wait to hear from Felipe. This is > already in his testing tree, so presumably I should do a follow-up > patch. ...but if he wants me to re-post I can do that too. Okay, I guess it is fine as-is. Rob ^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2,1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup @ 2019-04-30 13:51 ` Rob Herring 0 siblings, 0 replies; 21+ messages in thread From: Rob Herring @ 2019-04-30 13:51 UTC (permalink / raw) To: Doug Anderson Cc: Minas Harutyunyan, Heiko Stuebner, Felipe Balbi, Alexandru M Stan, open list:ARM/Rockchip SoC..., Linux USB List, Randy Li, Matthias Kaehlcke, Ryan Case, Julius Werner, Elaine Zhang, devicetree, LKML, Greg Kroah-Hartman, Mark Rutland On Tue, Apr 30, 2019 at 12:29 AM Doug Anderson <dianders@chromium.org> wrote: > > Hi, > > On Mon, Apr 29, 2019 at 5:54 PM Rob Herring <robh@kernel.org> wrote: > > > > On Tue, Apr 16, 2019 at 02:53:48PM -0700, Douglas Anderson wrote: > > > On Rockchip rk3288 there's a hardware quirk where we need to assert > > > the reset signal to the PHY when we get a remote wakeup on one of the > > > two ports. Document this quirk in the bindings. > > > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > > Reviewed-by: Matthias Kaehlcke <mka@chromium.org> > > > --- > > > > > > Changes in v2: None > > > > > > Documentation/devicetree/bindings/usb/dwc2.txt | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt > > > index 6dc3c4a34483..f70f3aee4bfc 100644 > > > --- a/Documentation/devicetree/bindings/usb/dwc2.txt > > > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt > > > @@ -37,6 +37,8 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties > > > - g-rx-fifo-size: size of rx fifo size in gadget mode. > > > - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. > > > - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. > > > +- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when > > > + we detect a wakeup. This is due to a hardware errata. > > > > Synopsys or Rockchip errata? > > > > Ideally, this should be implied by the controller or phy compatible. > > I have no idea. The errata was described to me by Rockchip but I > don't know if it's common to more than one board. > > You're right that we could do it on the controller compatible, but we > have to be careful. The two ports on rk3288 currently have the same > compatible string but the errata only applies to one of them. ...so > I'd have to cue on not just the compatible string but also detect > whether we're on the "OTG" port of the "host only" port. That's not > too hard, though since it is probe-able. > > I'm happy to spin this but I'll wait to hear from Felipe. This is > already in his testing tree, so presumably I should do a follow-up > patch. ...but if he wants me to re-post I can do that too. Okay, I guess it is fine as-is. Rob ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 2/4] usb: dwc2: optionally assert phy reset when waking up @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, amstan-F7+t8E8rja9g9hUCZPvPmw, Greg Kroah-Hartman, Randy Li, Douglas Anderson, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, mka-F7+t8E8rja9g9hUCZPvPmw, ryandcase-F7+t8E8rja9g9hUCZPvPmw, Yunzhi Li, Elaine Zhang, jwerner-F7+t8E8rja9g9hUCZPvPmw On the rk3288 USB host-only port (the one that's not the OTG-enabled port) the PHY can get into a bad state when a wakeup is asserted (not just a wakeup from full system suspend but also a wakeup from autosuspend). We can get the PHY out of its bad state by asserting its "port reset", but unfortunately that seems to assert a reset onto the USB bus so it could confuse things if we don't actually deenumerate / reenumerate the device. We can also get the PHY out of its bad state by fully resetting it using the reset from the CRU (clock reset unit), which does a more full reset. The CRU-based reset appears to actually cause devices on the bus to be removed and reinserted, which fixes the problem (albeit in a hacky way). It's unfortunate that we need to do a full re-enumeration of devices at wakeup time, but this is better than alternative of letting the bus get wedged. Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> Signed-off-by: Yunzhi Li <lyz-TNX95d0MmH7DzftRWevZcw@public.gmane.org> --- Changes in v2: - Cancel the work when dwc2 is freed (Matthias). drivers/usb/dwc2/core.h | 5 +++++ drivers/usb/dwc2/core_intr.c | 12 ++++++++++++ drivers/usb/dwc2/hcd.c | 18 +++++++++++++++--- drivers/usb/dwc2/platform.c | 9 +++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 30bab8463c96..f30748f4fe7e 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -859,6 +859,8 @@ struct dwc2_hregs_backup { * @gadget_enabled: Peripheral mode sub-driver initialization indicator. * @ll_hw_enabled: Status of low-level hardware resources. * @hibernated: True if core is hibernated + * @reset_phy_on_wake: Quirk saying that we should assert PHY reset on a + * remote wakeup. * @frame_number: Frame number read from the core. For both device * and host modes. The value ranges are from 0 * to HFNUM_MAX_FRNUM. @@ -972,6 +974,7 @@ struct dwc2_hregs_backup { * @status_buf_dma: DMA address for status_buf * @start_work: Delayed work for handling host A-cable connection * @reset_work: Delayed work for handling a port reset + * @phy_reset_work: Work structure for doing a PHY reset * @otg_port: OTG port number * @frame_list: Frame list * @frame_list_dma: Frame list DMA address @@ -1045,6 +1048,7 @@ struct dwc2_hsotg { unsigned int gadget_enabled:1; unsigned int ll_hw_enabled:1; unsigned int hibernated:1; + unsigned int reset_phy_on_wake:1; u16 frame_number; struct phy *phy; @@ -1147,6 +1151,7 @@ struct dwc2_hsotg { struct delayed_work start_work; struct delayed_work reset_work; + struct work_struct phy_reset_work; u8 otg_port; u32 *frame_list; dma_addr_t frame_list_dma; diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 19ae2595f1c3..16ff33574116 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -435,6 +435,18 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Restart the Phy Clock */ pcgcctl &= ~PCGCTL_STOPPCLK; dwc2_writel(hsotg, pcgcctl, PCGCTL); + + /* + * If we've got this quirk then the PHY is stuck upon + * wakeup. Assert reset. This will propagate out and + * eventually we'll re-enumerate the device. Not great + * but the best we can do. We can't call phy_reset() + * at interrupt time but there's no hurry, so we'll + * schedule it for later. + */ + if (hsotg->reset_phy_on_wake) + schedule_work(&hsotg->phy_reset_work); + mod_timer(&hsotg->wkp_timer, jiffies + msecs_to_jiffies(71)); } else { diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 3f087962f498..e272d020012e 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4376,6 +4376,17 @@ static void dwc2_hcd_reset_func(struct work_struct *work) spin_unlock_irqrestore(&hsotg->lock, flags); } +static void dwc2_hcd_phy_reset_func(struct work_struct *work) +{ + struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg, + phy_reset_work); + int ret; + + ret = phy_reset(hsotg->phy); + if (ret) + dev_warn(hsotg->dev, "PHY reset failed\n"); +} + /* * ========================================================================= * Linux HC Driver Functions @@ -5130,6 +5141,8 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) destroy_workqueue(hsotg->wq_otg); } + cancel_work_sync(&hsotg->phy_reset_work); + del_timer(&hsotg->wkp_timer); } @@ -5271,11 +5284,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) hsotg->hc_ptr_array[i] = channel; } - /* Initialize hsotg start work */ + /* Initialize work */ INIT_DELAYED_WORK(&hsotg->start_work, dwc2_hcd_start_func); - - /* Initialize port reset work */ INIT_DELAYED_WORK(&hsotg->reset_work, dwc2_hcd_reset_func); + INIT_WORK(&hsotg->phy_reset_work, dwc2_hcd_phy_reset_func); /* * Allocate space for storing data on status transactions. Normally no diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index c0b64d483552..9b65b766e0b9 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -481,6 +481,15 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg->gadget_enabled = 1; } + hsotg->reset_phy_on_wake = + of_property_read_bool(dev->dev.of_node, + "snps,reset-phy-on-wake"); + if (hsotg->reset_phy_on_wake && !hsotg->phy) { + dev_warn(hsotg->dev, + "Quirk reset-phy-on-wake only supports generic PHYs\n"); + hsotg->reset_phy_on_wake = false; + } + if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) { retval = dwc2_hcd_init(hsotg); if (retval) { -- 2.21.0.593.g511ec345e18-goog ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 2/4] usb: dwc2: optionally assert phy reset when waking up @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, Yunzhi Li, Greg Kroah-Hartman, linux-kernel On the rk3288 USB host-only port (the one that's not the OTG-enabled port) the PHY can get into a bad state when a wakeup is asserted (not just a wakeup from full system suspend but also a wakeup from autosuspend). We can get the PHY out of its bad state by asserting its "port reset", but unfortunately that seems to assert a reset onto the USB bus so it could confuse things if we don't actually deenumerate / reenumerate the device. We can also get the PHY out of its bad state by fully resetting it using the reset from the CRU (clock reset unit), which does a more full reset. The CRU-based reset appears to actually cause devices on the bus to be removed and reinserted, which fixes the problem (albeit in a hacky way). It's unfortunate that we need to do a full re-enumeration of devices at wakeup time, but this is better than alternative of letting the bus get wedged. Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Yunzhi Li <lyz@rock-chips.com> --- Changes in v2: - Cancel the work when dwc2 is freed (Matthias). drivers/usb/dwc2/core.h | 5 +++++ drivers/usb/dwc2/core_intr.c | 12 ++++++++++++ drivers/usb/dwc2/hcd.c | 18 +++++++++++++++--- drivers/usb/dwc2/platform.c | 9 +++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 30bab8463c96..f30748f4fe7e 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -859,6 +859,8 @@ struct dwc2_hregs_backup { * @gadget_enabled: Peripheral mode sub-driver initialization indicator. * @ll_hw_enabled: Status of low-level hardware resources. * @hibernated: True if core is hibernated + * @reset_phy_on_wake: Quirk saying that we should assert PHY reset on a + * remote wakeup. * @frame_number: Frame number read from the core. For both device * and host modes. The value ranges are from 0 * to HFNUM_MAX_FRNUM. @@ -972,6 +974,7 @@ struct dwc2_hregs_backup { * @status_buf_dma: DMA address for status_buf * @start_work: Delayed work for handling host A-cable connection * @reset_work: Delayed work for handling a port reset + * @phy_reset_work: Work structure for doing a PHY reset * @otg_port: OTG port number * @frame_list: Frame list * @frame_list_dma: Frame list DMA address @@ -1045,6 +1048,7 @@ struct dwc2_hsotg { unsigned int gadget_enabled:1; unsigned int ll_hw_enabled:1; unsigned int hibernated:1; + unsigned int reset_phy_on_wake:1; u16 frame_number; struct phy *phy; @@ -1147,6 +1151,7 @@ struct dwc2_hsotg { struct delayed_work start_work; struct delayed_work reset_work; + struct work_struct phy_reset_work; u8 otg_port; u32 *frame_list; dma_addr_t frame_list_dma; diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 19ae2595f1c3..16ff33574116 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -435,6 +435,18 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Restart the Phy Clock */ pcgcctl &= ~PCGCTL_STOPPCLK; dwc2_writel(hsotg, pcgcctl, PCGCTL); + + /* + * If we've got this quirk then the PHY is stuck upon + * wakeup. Assert reset. This will propagate out and + * eventually we'll re-enumerate the device. Not great + * but the best we can do. We can't call phy_reset() + * at interrupt time but there's no hurry, so we'll + * schedule it for later. + */ + if (hsotg->reset_phy_on_wake) + schedule_work(&hsotg->phy_reset_work); + mod_timer(&hsotg->wkp_timer, jiffies + msecs_to_jiffies(71)); } else { diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 3f087962f498..e272d020012e 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4376,6 +4376,17 @@ static void dwc2_hcd_reset_func(struct work_struct *work) spin_unlock_irqrestore(&hsotg->lock, flags); } +static void dwc2_hcd_phy_reset_func(struct work_struct *work) +{ + struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg, + phy_reset_work); + int ret; + + ret = phy_reset(hsotg->phy); + if (ret) + dev_warn(hsotg->dev, "PHY reset failed\n"); +} + /* * ========================================================================= * Linux HC Driver Functions @@ -5130,6 +5141,8 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) destroy_workqueue(hsotg->wq_otg); } + cancel_work_sync(&hsotg->phy_reset_work); + del_timer(&hsotg->wkp_timer); } @@ -5271,11 +5284,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) hsotg->hc_ptr_array[i] = channel; } - /* Initialize hsotg start work */ + /* Initialize work */ INIT_DELAYED_WORK(&hsotg->start_work, dwc2_hcd_start_func); - - /* Initialize port reset work */ INIT_DELAYED_WORK(&hsotg->reset_work, dwc2_hcd_reset_func); + INIT_WORK(&hsotg->phy_reset_work, dwc2_hcd_phy_reset_func); /* * Allocate space for storing data on status transactions. Normally no diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index c0b64d483552..9b65b766e0b9 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -481,6 +481,15 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg->gadget_enabled = 1; } + hsotg->reset_phy_on_wake = + of_property_read_bool(dev->dev.of_node, + "snps,reset-phy-on-wake"); + if (hsotg->reset_phy_on_wake && !hsotg->phy) { + dev_warn(hsotg->dev, + "Quirk reset-phy-on-wake only supports generic PHYs\n"); + hsotg->reset_phy_on_wake = false; + } + if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) { retval = dwc2_hcd_init(hsotg); if (retval) { -- 2.21.0.593.g511ec345e18-goog ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [v2,2/4] usb: dwc2: optionally assert phy reset when waking up @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, Yunzhi Li, Greg Kroah-Hartman, linux-kernel On the rk3288 USB host-only port (the one that's not the OTG-enabled port) the PHY can get into a bad state when a wakeup is asserted (not just a wakeup from full system suspend but also a wakeup from autosuspend). We can get the PHY out of its bad state by asserting its "port reset", but unfortunately that seems to assert a reset onto the USB bus so it could confuse things if we don't actually deenumerate / reenumerate the device. We can also get the PHY out of its bad state by fully resetting it using the reset from the CRU (clock reset unit), which does a more full reset. The CRU-based reset appears to actually cause devices on the bus to be removed and reinserted, which fixes the problem (albeit in a hacky way). It's unfortunate that we need to do a full re-enumeration of devices at wakeup time, but this is better than alternative of letting the bus get wedged. Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Yunzhi Li <lyz@rock-chips.com> --- Changes in v2: - Cancel the work when dwc2 is freed (Matthias). drivers/usb/dwc2/core.h | 5 +++++ drivers/usb/dwc2/core_intr.c | 12 ++++++++++++ drivers/usb/dwc2/hcd.c | 18 +++++++++++++++--- drivers/usb/dwc2/platform.c | 9 +++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 30bab8463c96..f30748f4fe7e 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -859,6 +859,8 @@ struct dwc2_hregs_backup { * @gadget_enabled: Peripheral mode sub-driver initialization indicator. * @ll_hw_enabled: Status of low-level hardware resources. * @hibernated: True if core is hibernated + * @reset_phy_on_wake: Quirk saying that we should assert PHY reset on a + * remote wakeup. * @frame_number: Frame number read from the core. For both device * and host modes. The value ranges are from 0 * to HFNUM_MAX_FRNUM. @@ -972,6 +974,7 @@ struct dwc2_hregs_backup { * @status_buf_dma: DMA address for status_buf * @start_work: Delayed work for handling host A-cable connection * @reset_work: Delayed work for handling a port reset + * @phy_reset_work: Work structure for doing a PHY reset * @otg_port: OTG port number * @frame_list: Frame list * @frame_list_dma: Frame list DMA address @@ -1045,6 +1048,7 @@ struct dwc2_hsotg { unsigned int gadget_enabled:1; unsigned int ll_hw_enabled:1; unsigned int hibernated:1; + unsigned int reset_phy_on_wake:1; u16 frame_number; struct phy *phy; @@ -1147,6 +1151,7 @@ struct dwc2_hsotg { struct delayed_work start_work; struct delayed_work reset_work; + struct work_struct phy_reset_work; u8 otg_port; u32 *frame_list; dma_addr_t frame_list_dma; diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 19ae2595f1c3..16ff33574116 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -435,6 +435,18 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Restart the Phy Clock */ pcgcctl &= ~PCGCTL_STOPPCLK; dwc2_writel(hsotg, pcgcctl, PCGCTL); + + /* + * If we've got this quirk then the PHY is stuck upon + * wakeup. Assert reset. This will propagate out and + * eventually we'll re-enumerate the device. Not great + * but the best we can do. We can't call phy_reset() + * at interrupt time but there's no hurry, so we'll + * schedule it for later. + */ + if (hsotg->reset_phy_on_wake) + schedule_work(&hsotg->phy_reset_work); + mod_timer(&hsotg->wkp_timer, jiffies + msecs_to_jiffies(71)); } else { diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 3f087962f498..e272d020012e 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4376,6 +4376,17 @@ static void dwc2_hcd_reset_func(struct work_struct *work) spin_unlock_irqrestore(&hsotg->lock, flags); } +static void dwc2_hcd_phy_reset_func(struct work_struct *work) +{ + struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg, + phy_reset_work); + int ret; + + ret = phy_reset(hsotg->phy); + if (ret) + dev_warn(hsotg->dev, "PHY reset failed\n"); +} + /* * ========================================================================= * Linux HC Driver Functions @@ -5130,6 +5141,8 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) destroy_workqueue(hsotg->wq_otg); } + cancel_work_sync(&hsotg->phy_reset_work); + del_timer(&hsotg->wkp_timer); } @@ -5271,11 +5284,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) hsotg->hc_ptr_array[i] = channel; } - /* Initialize hsotg start work */ + /* Initialize work */ INIT_DELAYED_WORK(&hsotg->start_work, dwc2_hcd_start_func); - - /* Initialize port reset work */ INIT_DELAYED_WORK(&hsotg->reset_work, dwc2_hcd_reset_func); + INIT_WORK(&hsotg->phy_reset_work, dwc2_hcd_phy_reset_func); /* * Allocate space for storing data on status transactions. Normally no diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index c0b64d483552..9b65b766e0b9 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -481,6 +481,15 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg->gadget_enabled = 1; } + hsotg->reset_phy_on_wake = + of_property_read_bool(dev->dev.of_node, + "snps,reset-phy-on-wake"); + if (hsotg->reset_phy_on_wake && !hsotg->phy) { + dev_warn(hsotg->dev, + "Quirk reset-phy-on-wake only supports generic PHYs\n"); + hsotg->reset_phy_on_wake = false; + } + if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) { retval = dwc2_hcd_init(hsotg); if (retval) { ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/4] ARM: dts: rockchip: Hook resets up to USB PHYs on rk3288. @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel, Mark Rutland, linux-arm-kernel Let's hook up the resets to the three USB PHYs on rk3288 as per the bindings. This is in preparation for a future patch that will set the "snps,reset-phy-on-wake" on the host port. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Changes in v2: None arch/arm/boot/dts/rk3288.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 74c9517c4f92..7e70ecf2b95a 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -909,6 +909,8 @@ clocks = <&cru SCLK_OTGPHY0>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBOTG_PHY>; + reset-names = "phy-reset"; }; usbphy1: usb-phy@334 { @@ -917,6 +919,8 @@ clocks = <&cru SCLK_OTGPHY1>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBHOST0_PHY>; + reset-names = "phy-reset"; }; usbphy2: usb-phy@348 { @@ -925,6 +929,8 @@ clocks = <&cru SCLK_OTGPHY2>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBHOST1_PHY>; + reset-names = "phy-reset"; }; }; }; -- 2.21.0.593.g511ec345e18-goog ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/4] ARM: dts: rockchip: Hook resets up to USB PHYs on rk3288. @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: Mark Rutland, devicetree, linux-usb, amstan, Randy Li, Douglas Anderson, linux-kernel, linux-rockchip, mka, ryandcase, Elaine Zhang, jwerner, linux-arm-kernel Let's hook up the resets to the three USB PHYs on rk3288 as per the bindings. This is in preparation for a future patch that will set the "snps,reset-phy-on-wake" on the host port. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Changes in v2: None arch/arm/boot/dts/rk3288.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 74c9517c4f92..7e70ecf2b95a 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -909,6 +909,8 @@ clocks = <&cru SCLK_OTGPHY0>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBOTG_PHY>; + reset-names = "phy-reset"; }; usbphy1: usb-phy@334 { @@ -917,6 +919,8 @@ clocks = <&cru SCLK_OTGPHY1>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBHOST0_PHY>; + reset-names = "phy-reset"; }; usbphy2: usb-phy@348 { @@ -925,6 +929,8 @@ clocks = <&cru SCLK_OTGPHY2>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBHOST1_PHY>; + reset-names = "phy-reset"; }; }; }; -- 2.21.0.593.g511ec345e18-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [v2,3/4] ARM: dts: rockchip: Hook resets up to USB PHYs on rk3288. @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel, Mark Rutland, linux-arm-kernel Let's hook up the resets to the three USB PHYs on rk3288 as per the bindings. This is in preparation for a future patch that will set the "snps,reset-phy-on-wake" on the host port. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Changes in v2: None arch/arm/boot/dts/rk3288.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 74c9517c4f92..7e70ecf2b95a 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -909,6 +909,8 @@ clocks = <&cru SCLK_OTGPHY0>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBOTG_PHY>; + reset-names = "phy-reset"; }; usbphy1: usb-phy@334 { @@ -917,6 +919,8 @@ clocks = <&cru SCLK_OTGPHY1>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBHOST0_PHY>; + reset-names = "phy-reset"; }; usbphy2: usb-phy@348 { @@ -925,6 +929,8 @@ clocks = <&cru SCLK_OTGPHY2>; clock-names = "phyclk"; #clock-cells = <0>; + resets = <&cru SRST_USBHOST1_PHY>; + reset-names = "phy-reset"; }; }; }; ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/4] ARM: dts: rockchip: Add quirk for resetting rk3288's dwc2 host on wakeup @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel, Mark Rutland, linux-arm-kernel The "host" USB port on rk3288 has a hardware errata where we've got to assert a PHY reset whenever we see a remote wakeup. Add that quirk property to the device tree. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> --- Changes in v2: None arch/arm/boot/dts/rk3288.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 7e70ecf2b95a..aa017abf4f42 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -621,6 +621,7 @@ dr_mode = "host"; phys = <&usbphy2>; phy-names = "usb2-phy"; + snps,reset-phy-on-wake; status = "disabled"; }; -- 2.21.0.593.g511ec345e18-goog ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/4] ARM: dts: rockchip: Add quirk for resetting rk3288's dwc2 host on wakeup @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Douglas Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: Mark Rutland, devicetree, linux-usb, amstan, Randy Li, Douglas Anderson, linux-kernel, linux-rockchip, mka, ryandcase, Elaine Zhang, jwerner, linux-arm-kernel The "host" USB port on rk3288 has a hardware errata where we've got to assert a PHY reset whenever we see a remote wakeup. Add that quirk property to the device tree. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> --- Changes in v2: None arch/arm/boot/dts/rk3288.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 7e70ecf2b95a..aa017abf4f42 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -621,6 +621,7 @@ dr_mode = "host"; phys = <&usbphy2>; phy-names = "usb2-phy"; + snps,reset-phy-on-wake; status = "disabled"; }; -- 2.21.0.593.g511ec345e18-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [v2,4/4] ARM: dts: rockchip: Add quirk for resetting rk3288's dwc2 host on wakeup @ 2019-04-16 21:53 ` Doug Anderson 0 siblings, 0 replies; 21+ messages in thread From: Doug Anderson @ 2019-04-16 21:53 UTC (permalink / raw) To: Rob Herring, Minas Harutyunyan, Heiko Stuebner, Felipe Balbi Cc: amstan, linux-rockchip, linux-usb, Randy Li, mka, ryandcase, jwerner, Elaine Zhang, Douglas Anderson, devicetree, linux-kernel, Mark Rutland, linux-arm-kernel The "host" USB port on rk3288 has a hardware errata where we've got to assert a PHY reset whenever we see a remote wakeup. Add that quirk property to the device tree. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> --- Changes in v2: None arch/arm/boot/dts/rk3288.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 7e70ecf2b95a..aa017abf4f42 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -621,6 +621,7 @@ dr_mode = "host"; phys = <&usbphy2>; phy-names = "usb2-phy"; + snps,reset-phy-on-wake; status = "disabled"; }; ^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2019-04-30 13:51 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-16 21:53 [PATCH v2 0/4] usb: dwc2: Another attempt handling rk3288's remote wake quirk Douglas Anderson
2019-04-16 21:53 ` Douglas Anderson
[not found] ` <20190416215351.242246-1-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2019-04-16 21:53 ` [PATCH v2 1/4] dt-bindings: usb: dwc2: Document quirk to reset PHY upon wakeup Douglas Anderson
2019-04-16 21:53 ` Douglas Anderson
2019-04-16 21:53 ` [v2,1/4] " Doug Anderson
2019-04-30 0:53 ` [PATCH v2 1/4] " Rob Herring
2019-04-30 0:53 ` [v2,1/4] " Rob Herring
2019-04-30 5:29 ` [PATCH v2 1/4] " Doug Anderson
2019-04-30 5:29 ` Doug Anderson
2019-04-30 5:29 ` [v2,1/4] " Doug Anderson
2019-04-30 13:51 ` [PATCH v2 1/4] " Rob Herring
2019-04-30 13:51 ` [v2,1/4] " Rob Herring
2019-04-16 21:53 ` [PATCH v2 2/4] usb: dwc2: optionally assert phy reset when waking up Douglas Anderson
2019-04-16 21:53 ` Douglas Anderson
2019-04-16 21:53 ` [v2,2/4] " Doug Anderson
2019-04-16 21:53 ` [PATCH v2 3/4] ARM: dts: rockchip: Hook resets up to USB PHYs on rk3288 Douglas Anderson
2019-04-16 21:53 ` Douglas Anderson
2019-04-16 21:53 ` [v2,3/4] " Doug Anderson
2019-04-16 21:53 ` [PATCH v2 4/4] ARM: dts: rockchip: Add quirk for resetting rk3288's dwc2 host on wakeup Douglas Anderson
2019-04-16 21:53 ` Douglas Anderson
2019-04-16 21:53 ` [v2,4/4] " Doug Anderson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.