From: Gregory Herrero Date: Mon, 7 Dec 2015 11:07:31 +0000 (+0100) Subject: UPSTREAM: usb: dwc2: gadget: don't overwrite DCTL register on NAKEFF interrupts X-Git-Tag: firefly_0821_release~908 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=263c63c383c1d74ba463fb57a21e2b2c885f3183;p=firefly-linux-kernel-4.4.55.git UPSTREAM: usb: dwc2: gadget: don't overwrite DCTL register on NAKEFF interrupts When receiving GINTSTS_GINNAKEFF or GINTSTS_GOUTNAKEFF interrupt, DCTL will be overwritten with DCTL_CGOUTNAK or DCTL_CGNPINNAK values. Instead of overwriting it, write only needed bits. It could cause an issue if GINTSTS_GINNAKEFF or GINTSTS_GOUTNAKEFF interrupt is received after dwc2 disabled pullup by writing DCTL_SFTDISCON bit. Pullup will then be re-enabled whereas it should not. Change-Id: Idd93b20c3d780fffdf03cc30481eb4aed9aafe1e Acked-by: John Youn Signed-off-by: Gregory Herrero Signed-off-by: Felipe Balbi Signed-off-by: Huang, Tao (cherry picked from commit 3be99cd0e882dd2127b8cfe3942f5e464915aeba) --- diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 92a182feb936..3a24cbf355a9 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2585,7 +2585,7 @@ irq_retry: if (gintsts & GINTSTS_GOUTNAKEFF) { dev_info(hsotg->dev, "GOUTNakEff triggered\n"); - dwc2_writel(DCTL_CGOUTNAK, hsotg->regs + DCTL); + __orr32(hsotg->regs + DCTL, DCTL_CGOUTNAK); dwc2_hsotg_dump(hsotg); } @@ -2593,7 +2593,7 @@ irq_retry: if (gintsts & GINTSTS_GINNAKEFF) { dev_info(hsotg->dev, "GINNakEff triggered\n"); - dwc2_writel(DCTL_CGNPINNAK, hsotg->regs + DCTL); + __orr32(hsotg->regs + DCTL, DCTL_CGNPINNAK); dwc2_hsotg_dump(hsotg); }