]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
usb: dwc3: otg: don't clear event buffers when changing to Host mode from Device...
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Wed, 7 Mar 2018 11:32:17 +0000 (17:02 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 9 Mar 2018 08:09:50 +0000 (09:09 +0100)
Clearing event buffers when changing from Device mode -> Host mode
may require allocating event buffers again during role swap from
Host mode -> Device mode. Changing the event buffers at runtime are
not triggering events in device mode and also the role swap can happen
at any time. So, better not to clear the event buffers during role
swap instead reuse the previously allocated event buffers.
This patch does the same.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/dwc3/otg.c

index 86a8bbc030d040f2fe829aae576ca6411c7976d2..db38565fa49386abe13c0f6a40db01f900f74d4d 100644 (file)
@@ -298,7 +298,6 @@ static int start_host(struct dwc3_otg *otg)
        u32 octl;
        u32 osts;
        u32 dctl;
-       u32 event_addr;
        struct usb_hcd *hcd;
        struct xhci_hcd *xhci;
 
@@ -314,12 +313,6 @@ static int start_host(struct dwc3_otg *otg)
                otg_write(otg, DCTL, dctl);
        }
 
-       event_addr = dwc3_readl(otg->dwc->regs, DWC3_GEVNTADRLO(0));
-       if (event_addr != 0x0) {
-               otg_dbg(otg, "Freeing the device event buffers\n");
-               dwc3_free_event_buffers(otg->dwc);
-       }
-
        if (!set_peri_mode(otg, PERI_MODE_HOST)) {
                otg_err(otg, "Failed to start host\n");
                return -EINVAL;
@@ -337,7 +330,6 @@ static int start_host(struct dwc3_otg *otg)
        /* Start host driver */
 
        *(struct xhci_hcd **)hcd->hcd_priv = xhci;
-       otg_dbg(otg, "1- calling usb_add_hcd() irq=%d\n", otg->hcd_irq);
        ret = usb_add_hcd(hcd, otg->hcd_irq, IRQF_SHARED);
        if (ret) {
                otg_err(otg, "%s: failed to start primary hcd, ret=%d\n",
@@ -347,7 +339,6 @@ static int start_host(struct dwc3_otg *otg)
 
        *(struct xhci_hcd **)xhci->shared_hcd->hcd_priv = xhci;
        if (xhci->shared_hcd) {
-               otg_dbg(otg, "2- calling usb_add_hcd() irq=%d\n", otg->hcd_irq);
                ret = usb_add_hcd(xhci->shared_hcd, otg->hcd_irq, IRQF_SHARED);
                if (ret) {
                        otg_err(otg,
@@ -490,15 +481,7 @@ static void host_release(struct dwc3_otg *otg)
 static void dwc3_otg_setup_event_buffers(struct dwc3_otg *otg)
 {
        if (dwc3_readl(otg->dwc->regs, DWC3_GEVNTADRLO(0)) == 0x0) {
-               int ret;
 
-               otg_dbg(otg, "allocating the event buffer\n");
-               ret = dwc3_alloc_event_buffers(otg->dwc,
-                               DWC3_EVENT_BUFFERS_SIZE);
-               if (ret) {
-                       dev_err(otg->dwc->dev,
-                                       "failed to allocate event buffers\n");
-               }
                otg_dbg(otg, "setting up event buffers\n");
                dwc3_event_buffers_setup(otg->dwc);
        }