public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
  • * [RESEND PATCH 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform
           [not found] <4c931176-a09a-546c-d2b6-ea74028c78a2@cogentembedded.com>
           [not found] ` <4c931176-a09a-546c-d2b6-ea74028c78a2-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
    @ 2016-08-21 19:31 ` Randy Li
           [not found]   ` <1471807905-11323-1-git-send-email-ayaka-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>
      1 sibling, 1 reply; 16+ messages in thread
    From: Randy Li @ 2016-08-21 19:31 UTC (permalink / raw)
      To: linux-usb
      Cc: johnyoun, gregkh, robh+dt, mark.rutland, devicetree, eddie.cai,
    	randy.li, kishon, linux-kernel, heiko, linux-rockchip, Randy Li
    
    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) in chip, 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: Randy Li <ayaka@soulik.info>
    ---
     drivers/usb/dwc2/core_intr.c | 11 +++++++++++
     1 file changed, 11 insertions(+)
    
    diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
    index d85c5c9..f57c48a 100644
    --- a/drivers/usb/dwc2/core_intr.c
    +++ b/drivers/usb/dwc2/core_intr.c
    @@ -345,6 +345,7 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg)
     static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
     {
     	int ret;
    +	struct device_node *np = hsotg->dev->of_node;
     
     	/* Clear interrupt */
     	dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
    @@ -379,6 +380,16 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
     			/* Restart the Phy Clock */
     			pcgcctl &= ~PCGCTL_STOPPCLK;
     			dwc2_writel(pcgcctl, hsotg->regs + PCGCTL);
    +
    +			/* 
    +			 * It is a quirk in Rockchip RK3288, causing by
    +			 * a hardware bug. This will propagate out and
    +			 * eventually we'll re-enumerate the device. 
    +			 * Not great but the best we can do 
    +			 */
    +			if (of_device_is_compatible(np, "rockchip,rk3288-usb"))
    +				hsotg->phy->ops->reset(hsotg->phy);
    +
     			mod_timer(&hsotg->wkp_timer,
     				  jiffies + msecs_to_jiffies(71));
     		} else {
    -- 
    2.7.4
    
    ^ permalink raw reply related	[flat|nested] 16+ messages in thread

  • end of thread, other threads:[~2016-08-29 18:24 UTC | newest]
    
    Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <4c931176-a09a-546c-d2b6-ea74028c78a2@cogentembedded.com>
         [not found] ` <4c931176-a09a-546c-d2b6-ea74028c78a2-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
    2016-08-21  7:56   ` [PATCH 0/4 v5] usb: dwc2: fix the usb host for host port at RK32 Randy Li
    2016-08-21  7:56     ` [PATCH 1/4] phy: Add reset callback Randy Li
         [not found]     ` <1471766205-12940-1-git-send-email-ayaka-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>
    2016-08-21  7:56       ` [PATCH 2/4] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup Randy Li
         [not found]         ` <1471766205-12940-3-git-send-email-ayaka-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>
    2016-08-23 17:53           ` Rob Herring
    2016-08-21  7:56     ` [PATCH 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform Randy Li
    2016-08-21  7:56     ` [PATCH 4/4] ARM: dts: rockchip: Point rk3288 dwc2 usb at the full PHY reset Randy Li
    2016-08-21 11:06       ` Sergei Shtylyov
         [not found]         ` <95d6e178-b9c5-ed40-2adc-5ffd1d78db07-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
    2016-08-21 12:19           ` ayaka
         [not found]             ` <b60bcef2-31d7-5a15-a09a-b71006c99c92-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>
    2016-08-22 10:30               ` Sergei Shtylyov
    2016-08-21 19:31 ` [RESEND PATCH 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform Randy Li
         [not found]   ` <1471807905-11323-1-git-send-email-ayaka-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>
    2016-08-21 19:31     ` [RESEND PATCH 4/4] ARM: dts: rockchip: Point rk3288 dwc2 usb at the full PHY reset Randy Li
    2016-08-23 20:46     ` [RESEND PATCH 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform John Youn
         [not found]       ` <49d2baf7-5f81-fc20-a805-f7a378d67a5e-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
    2016-08-24  8:54         ` Randy Li
         [not found]           ` <76f0ffdb-a3c6-f1e6-8177-b254ff5badaa-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
    2016-08-25 18:23             ` John Youn
    2016-08-29  7:51               ` Felipe Balbi
    2016-08-29 18:24                 ` John Youn
    

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