usb: dwc3: gadget: prevent DCTL register corruption
authorFelipe Balbi <balbi@ti.com>
Thu, 24 May 2012 07:27:56 +0000 (10:27 +0300)
committerFelipe Balbi <balbi@ti.com>
Sun, 3 Jun 2012 20:08:25 +0000 (23:08 +0300)
If we don't read out the contents of the register
(in order to reinitialize 'reg' variable) we will
be writing unknown contents to the DCTL register
whenever we try to use dwc3_gadget_wakeup() function.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c

index 04048333ec1a3e971f86e0d964acf87e12070793..867c476853ecaa06360298fcb07aaaaf31bef1b2 100644 (file)
@@ -1307,6 +1307,7 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g)
        /* Recent versions do this automatically */
        if (dwc->revision < DWC3_REVISION_194A) {
                /* write zeroes to Link Change Request */
+               reg = dwc3_readl(dwc->regs, DWC3_DCTL);
                reg &= ~DWC3_DCTL_ULSTCHNGREQ_MASK;
                dwc3_writel(dwc->regs, DWC3_DCTL, reg);
        }