]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/usb/dwc2/gadget.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
[karo-tx-linux.git] / drivers / usb / dwc2 / gadget.c
index 5f63058f854ea5f5482c5fed8f5d8c0847ccb3df..422ab7da4eb51b99e238900f413d069d62a468c2 100644 (file)
@@ -2095,7 +2095,7 @@ static void dwc2_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg)
         */
 
        /* catch both EnumSpd_FS and EnumSpd_FS48 */
-       switch (dsts & DSTS_ENUMSPD_MASK) {
+       switch ((dsts & DSTS_ENUMSPD_MASK) >> DSTS_ENUMSPD_SHIFT) {
        case DSTS_ENUMSPD_FS:
        case DSTS_ENUMSPD_FS48:
                hsotg->gadget.speed = USB_SPEED_FULL;
@@ -2243,54 +2243,6 @@ static void dwc2_hsotg_irq_fifoempty(struct dwc2_hsotg *hsotg, bool periodic)
                        GINTSTS_PTXFEMP |  \
                        GINTSTS_RXFLVL)
 
-/**
- * dwc2_hsotg_corereset - issue softreset to the core
- * @hsotg: The device state
- *
- * Issue a soft reset to the core, and await the core finishing it.
- */
-static int dwc2_hsotg_corereset(struct dwc2_hsotg *hsotg)
-{
-       int timeout;
-       u32 grstctl;
-
-       dev_dbg(hsotg->dev, "resetting core\n");
-
-       /* issue soft reset */
-       dwc2_writel(GRSTCTL_CSFTRST, hsotg->regs + GRSTCTL);
-
-       timeout = 10000;
-       do {
-               grstctl = dwc2_readl(hsotg->regs + GRSTCTL);
-       } while ((grstctl & GRSTCTL_CSFTRST) && timeout-- > 0);
-
-       if (grstctl & GRSTCTL_CSFTRST) {
-               dev_err(hsotg->dev, "Failed to get CSftRst asserted\n");
-               return -EINVAL;
-       }
-
-       timeout = 10000;
-
-       while (1) {
-               u32 grstctl = dwc2_readl(hsotg->regs + GRSTCTL);
-
-               if (timeout-- < 0) {
-                       dev_info(hsotg->dev,
-                                "%s: reset failed, GRSTCTL=%08x\n",
-                                __func__, grstctl);
-                       return -ETIMEDOUT;
-               }
-
-               if (!(grstctl & GRSTCTL_AHBIDLE))
-                       continue;
-
-               break;          /* reset done */
-       }
-
-       dev_dbg(hsotg->dev, "reset successful\n");
-       return 0;
-}
-
 /**
  * dwc2_hsotg_core_init - issue softreset to the core
  * @hsotg: The device state
@@ -2307,7 +2259,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
        kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
 
        if (!is_usb_reset)
-               if (dwc2_hsotg_corereset(hsotg))
+               if (dwc2_core_reset(hsotg))
                        return;
 
        /*
@@ -3593,8 +3545,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
                return ret;
        }
 
-       dwc2_hsotg_init(hsotg);
-
        hsotg->ctrl_buff = devm_kzalloc(hsotg->dev,
                        DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
        if (!hsotg->ctrl_buff) {