aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-11 12:30:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-11 12:30:35 -0400
commit224f6e4036f2c1c20eb8dd12906d5a9583a6224b (patch)
tree2cebf201f95d32aba051e41f4aa642995d97e73a
parent59b71f774fc2ec2d985251e72fde0f9f88164547 (diff)
parenta0ad85ae866f8a01f29a18ffa1e9b1aa8ca888bd (diff)
Merge tag 'fixes-for-v4.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes: usb: fixes for v4.8-rc1 First set of fixes for v4.8-rc cycle. Again, dwc3 is the most active driver with over 60% of this pull request touching it. The most important fixes are related to scatterlist usage with dwc3. Before this pull request, we were increment request->actual multiple times and this would result in request->actual being larger than request->length. Also, if a we received a short packet midway through processing a scatterlist, we were not clearning HWO bit as we should. Other than the large dwc3 scatterlist fixes, we have a new Device ID for Intel's Kabylake silicon. Other drivers, such as fsl_qe_udc and renesas udc, also got a few minor fixes. Details are in shortlog.
-rw-r--r--drivers/usb/dwc3/dwc3-of-simple.c1
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c2
-rw-r--r--drivers/usb/dwc3/gadget.c55
-rw-r--r--drivers/usb/gadget/composite.c6
-rw-r--r--drivers/usb/gadget/configfs.c2
-rw-r--r--drivers/usb/gadget/function/rndis.c6
-rw-r--r--drivers/usb/gadget/function/u_ether.c3
-rw-r--r--drivers/usb/gadget/function/uvc_configfs.c2
-rw-r--r--drivers/usb/gadget/legacy/inode.c4
-rw-r--r--drivers/usb/gadget/udc/core.c5
-rw-r--r--drivers/usb/gadget/udc/fsl_qe_udc.c2
-rw-r--r--drivers/usb/phy/phy-omap-otg.c2
-rw-r--r--drivers/usb/renesas_usbhs/common.c3
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c4
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c7
15 files changed, 69 insertions, 35 deletions
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index 974335377d9f..e56d59b19a0e 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -61,6 +61,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
61 if (!simple->clks) 61 if (!simple->clks)
62 return -ENOMEM; 62 return -ENOMEM;
63 63
64 platform_set_drvdata(pdev, simple);
64 simple->dev = dev; 65 simple->dev = dev;
65 66
66 for (i = 0; i < simple->num_clocks; i++) { 67 for (i = 0; i < simple->num_clocks; i++) {
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 45f5a232d9fb..2eb84d6c24a6 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -37,6 +37,7 @@
37#define PCI_DEVICE_ID_INTEL_BXT 0x0aaa 37#define PCI_DEVICE_ID_INTEL_BXT 0x0aaa
38#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa 38#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa
39#define PCI_DEVICE_ID_INTEL_APL 0x5aaa 39#define PCI_DEVICE_ID_INTEL_APL 0x5aaa
40#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0
40 41
41static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; 42static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
42static const struct acpi_gpio_params cs_gpios = { 1, 0, false }; 43static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
@@ -227,6 +228,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
227 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, 228 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), },
228 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, 229 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), },
229 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, 230 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
231 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
230 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, 232 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
231 { } /* Terminating Entry */ 233 { } /* Terminating Entry */
232}; 234};
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8f8c2157910e..1f5597ef945d 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -829,7 +829,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
829 if (!req->request.no_interrupt && !chain) 829 if (!req->request.no_interrupt && !chain)
830 trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI; 830 trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI;
831 831
832 if (last) 832 if (last && !usb_endpoint_xfer_isoc(dep->endpoint.desc))
833 trb->ctrl |= DWC3_TRB_CTRL_LST; 833 trb->ctrl |= DWC3_TRB_CTRL_LST;
834 834
835 if (chain) 835 if (chain)
@@ -1955,7 +1955,8 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
1955 1955
1956static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, 1956static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
1957 struct dwc3_request *req, struct dwc3_trb *trb, 1957 struct dwc3_request *req, struct dwc3_trb *trb,
1958 const struct dwc3_event_depevt *event, int status) 1958 const struct dwc3_event_depevt *event, int status,
1959 int chain)
1959{ 1960{
1960 unsigned int count; 1961 unsigned int count;
1961 unsigned int s_pkt = 0; 1962 unsigned int s_pkt = 0;
@@ -1964,17 +1965,22 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
1964 dep->queued_requests--; 1965 dep->queued_requests--;
1965 trace_dwc3_complete_trb(dep, trb); 1966 trace_dwc3_complete_trb(dep, trb);
1966 1967
1968 /*
1969 * If we're in the middle of series of chained TRBs and we
1970 * receive a short transfer along the way, DWC3 will skip
1971 * through all TRBs including the last TRB in the chain (the
1972 * where CHN bit is zero. DWC3 will also avoid clearing HWO
1973 * bit and SW has to do it manually.
1974 *
1975 * We're going to do that here to avoid problems of HW trying
1976 * to use bogus TRBs for transfers.
1977 */
1978 if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
1979 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1980
1967 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) 1981 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
1968 /* 1982 return 1;
1969 * We continue despite the error. There is not much we 1983
1970 * can do. If we don't clean it up we loop forever. If
1971 * we skip the TRB then it gets overwritten after a
1972 * while since we use them in a ring buffer. A BUG()
1973 * would help. Lets hope that if this occurs, someone
1974 * fixes the root cause instead of looking away :)
1975 */
1976 dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n",
1977 dep->name, trb);
1978 count = trb->size & DWC3_TRB_SIZE_MASK; 1984 count = trb->size & DWC3_TRB_SIZE_MASK;
1979 1985
1980 if (dep->direction) { 1986 if (dep->direction) {
@@ -2013,15 +2019,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
2013 s_pkt = 1; 2019 s_pkt = 1;
2014 } 2020 }
2015 2021
2016 /* 2022 if (s_pkt && !chain)
2017 * We assume here we will always receive the entire data block
2018 * which we should receive. Meaning, if we program RX to
2019 * receive 4K but we receive only 2K, we assume that's all we
2020 * should receive and we simply bounce the request back to the
2021 * gadget driver for further processing.
2022 */
2023 req->request.actual += req->request.length - count;
2024 if (s_pkt)
2025 return 1; 2023 return 1;
2026 if ((event->status & DEPEVT_STATUS_LST) && 2024 if ((event->status & DEPEVT_STATUS_LST) &&
2027 (trb->ctrl & (DWC3_TRB_CTRL_LST | 2025 (trb->ctrl & (DWC3_TRB_CTRL_LST |
@@ -2040,13 +2038,17 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
2040 struct dwc3_trb *trb; 2038 struct dwc3_trb *trb;
2041 unsigned int slot; 2039 unsigned int slot;
2042 unsigned int i; 2040 unsigned int i;
2041 int count = 0;
2043 int ret; 2042 int ret;
2044 2043
2045 do { 2044 do {
2045 int chain;
2046
2046 req = next_request(&dep->started_list); 2047 req = next_request(&dep->started_list);
2047 if (WARN_ON_ONCE(!req)) 2048 if (WARN_ON_ONCE(!req))
2048 return 1; 2049 return 1;
2049 2050
2051 chain = req->request.num_mapped_sgs > 0;
2050 i = 0; 2052 i = 0;
2051 do { 2053 do {
2052 slot = req->first_trb_index + i; 2054 slot = req->first_trb_index + i;
@@ -2054,13 +2056,22 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
2054 slot++; 2056 slot++;
2055 slot %= DWC3_TRB_NUM; 2057 slot %= DWC3_TRB_NUM;
2056 trb = &dep->trb_pool[slot]; 2058 trb = &dep->trb_pool[slot];
2059 count += trb->size & DWC3_TRB_SIZE_MASK;
2057 2060
2058 ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, 2061 ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
2059 event, status); 2062 event, status, chain);
2060 if (ret) 2063 if (ret)
2061 break; 2064 break;
2062 } while (++i < req->request.num_mapped_sgs); 2065 } while (++i < req->request.num_mapped_sgs);
2063 2066
2067 /*
2068 * We assume here we will always receive the entire data block
2069 * which we should receive. Meaning, if we program RX to
2070 * receive 4K but we receive only 2K, we assume that's all we
2071 * should receive and we simply bounce the request back to the
2072 * gadget driver for further processing.
2073 */
2074 req->request.actual += req->request.length - count;
2064 dwc3_gadget_giveback(dep, req, status); 2075 dwc3_gadget_giveback(dep, req, status);
2065 2076
2066 if (ret) 2077 if (ret)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index eb648485a58c..5ebe6af7976e 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1913,6 +1913,8 @@ unknown:
1913 break; 1913 break;
1914 1914
1915 case USB_RECIP_ENDPOINT: 1915 case USB_RECIP_ENDPOINT:
1916 if (!cdev->config)
1917 break;
1916 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f); 1918 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
1917 list_for_each_entry(f, &cdev->config->functions, list) { 1919 list_for_each_entry(f, &cdev->config->functions, list) {
1918 if (test_bit(endp, f->endpoints)) 1920 if (test_bit(endp, f->endpoints))
@@ -2124,14 +2126,14 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
2124 2126
2125 cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL); 2127 cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL);
2126 if (!cdev->os_desc_req) { 2128 if (!cdev->os_desc_req) {
2127 ret = PTR_ERR(cdev->os_desc_req); 2129 ret = -ENOMEM;
2128 goto end; 2130 goto end;
2129 } 2131 }
2130 2132
2131 /* OS feature descriptor length <= 4kB */ 2133 /* OS feature descriptor length <= 4kB */
2132 cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL); 2134 cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
2133 if (!cdev->os_desc_req->buf) { 2135 if (!cdev->os_desc_req->buf) {
2134 ret = PTR_ERR(cdev->os_desc_req->buf); 2136 ret = -ENOMEM;
2135 kfree(cdev->os_desc_req); 2137 kfree(cdev->os_desc_req);
2136 goto end; 2138 goto end;
2137 } 2139 }
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 70cf3477f951..f9237fe2be05 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1490,7 +1490,9 @@ void unregister_gadget_item(struct config_item *item)
1490{ 1490{
1491 struct gadget_info *gi = to_gadget_info(item); 1491 struct gadget_info *gi = to_gadget_info(item);
1492 1492
1493 mutex_lock(&gi->lock);
1493 unregister_gadget(gi); 1494 unregister_gadget(gi);
1495 mutex_unlock(&gi->lock);
1494} 1496}
1495EXPORT_SYMBOL_GPL(unregister_gadget_item); 1497EXPORT_SYMBOL_GPL(unregister_gadget_item);
1496 1498
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 943c21aafd3b..ab6ac1b74ac0 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -680,6 +680,12 @@ static int rndis_reset_response(struct rndis_params *params,
680{ 680{
681 rndis_reset_cmplt_type *resp; 681 rndis_reset_cmplt_type *resp;
682 rndis_resp_t *r; 682 rndis_resp_t *r;
683 u8 *xbuf;
684 u32 length;
685
686 /* drain the response queue */
687 while ((xbuf = rndis_get_next_response(params, &length)))
688 rndis_free_response(params, xbuf);
683 689
684 r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type)); 690 r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type));
685 if (!r) 691 if (!r)
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index a3f7e7c55ebb..5f562c1ec795 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -556,7 +556,8 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
556 /* Multi frame CDC protocols may store the frame for 556 /* Multi frame CDC protocols may store the frame for
557 * later which is not a dropped frame. 557 * later which is not a dropped frame.
558 */ 558 */
559 if (dev->port_usb->supports_multi_frame) 559 if (dev->port_usb &&
560 dev->port_usb->supports_multi_frame)
560 goto multiframe; 561 goto multiframe;
561 goto drop; 562 goto drop;
562 } 563 }
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 66753ba7a42e..31125a4a2658 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -2023,7 +2023,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
2023 if (!data) { 2023 if (!data) {
2024 kfree(*class_array); 2024 kfree(*class_array);
2025 *class_array = NULL; 2025 *class_array = NULL;
2026 ret = PTR_ERR(data); 2026 ret = -ENOMEM;
2027 goto unlock; 2027 goto unlock;
2028 } 2028 }
2029 cl_arr = *class_array; 2029 cl_arr = *class_array;
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index aa3707bdebb4..16104b5ebdcb 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -542,7 +542,7 @@ static ssize_t ep_aio(struct kiocb *iocb,
542 */ 542 */
543 spin_lock_irq(&epdata->dev->lock); 543 spin_lock_irq(&epdata->dev->lock);
544 value = -ENODEV; 544 value = -ENODEV;
545 if (unlikely(epdata->ep)) 545 if (unlikely(epdata->ep == NULL))
546 goto fail; 546 goto fail;
547 547
548 req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC); 548 req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC);
@@ -606,7 +606,7 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to)
606 } 606 }
607 if (is_sync_kiocb(iocb)) { 607 if (is_sync_kiocb(iocb)) {
608 value = ep_io(epdata, buf, len); 608 value = ep_io(epdata, buf, len);
609 if (value >= 0 && copy_to_iter(buf, value, to)) 609 if (value >= 0 && (copy_to_iter(buf, value, to) != value))
610 value = -EFAULT; 610 value = -EFAULT;
611 } else { 611 } else {
612 struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL); 612 struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL);
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index ff8685ea7219..934f83881c30 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -1145,7 +1145,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
1145 if (ret != -EPROBE_DEFER) 1145 if (ret != -EPROBE_DEFER)
1146 list_del(&driver->pending); 1146 list_del(&driver->pending);
1147 if (ret) 1147 if (ret)
1148 goto err4; 1148 goto err5;
1149 break; 1149 break;
1150 } 1150 }
1151 } 1151 }
@@ -1154,6 +1154,9 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
1154 1154
1155 return 0; 1155 return 0;
1156 1156
1157err5:
1158 device_del(&udc->dev);
1159
1157err4: 1160err4:
1158 list_del(&udc->list); 1161 list_del(&udc->list);
1159 mutex_unlock(&udc_lock); 1162 mutex_unlock(&udc_lock);
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 93d28cb00b76..cf8819a5c5b2 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -2053,7 +2053,7 @@ static void setup_received_handle(struct qe_udc *udc,
2053 struct qe_ep *ep; 2053 struct qe_ep *ep;
2054 2054
2055 if (wValue != 0 || wLength != 0 2055 if (wValue != 0 || wLength != 0
2056 || pipe > USB_MAX_ENDPOINTS) 2056 || pipe >= USB_MAX_ENDPOINTS)
2057 break; 2057 break;
2058 ep = &udc->eps[pipe]; 2058 ep = &udc->eps[pipe];
2059 2059
diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 6f6d2a7fd5a0..6523af4f8f93 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -140,6 +140,8 @@ static int omap_otg_probe(struct platform_device *pdev)
140 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id, 140 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id,
141 otg_dev->vbus); 141 otg_dev->vbus);
142 142
143 platform_set_drvdata(pdev, otg_dev);
144
143 return 0; 145 return 0;
144} 146}
145 147
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 8fbbc2d32371..ac67bab9124c 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -514,7 +514,8 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
514 if (gpio > 0) 514 if (gpio > 0)
515 dparam->enable_gpio = gpio; 515 dparam->enable_gpio = gpio;
516 516
517 if (dparam->type == USBHS_TYPE_RCAR_GEN2) 517 if (dparam->type == USBHS_TYPE_RCAR_GEN2 ||
518 dparam->type == USBHS_TYPE_RCAR_GEN3)
518 dparam->has_usb_dmac = 1; 519 dparam->has_usb_dmac = 1;
519 520
520 return info; 521 return info;
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 280ed5ff021b..857e78337324 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -871,7 +871,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
871 871
872 /* use PIO if packet is less than pio_dma_border or pipe is DCP */ 872 /* use PIO if packet is less than pio_dma_border or pipe is DCP */
873 if ((len < usbhs_get_dparam(priv, pio_dma_border)) || 873 if ((len < usbhs_get_dparam(priv, pio_dma_border)) ||
874 usbhs_pipe_is_dcp(pipe)) 874 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
875 goto usbhsf_pio_prepare_push; 875 goto usbhsf_pio_prepare_push;
876 876
877 /* check data length if this driver don't use USB-DMAC */ 877 /* check data length if this driver don't use USB-DMAC */
@@ -976,7 +976,7 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
976 976
977 /* use PIO if packet is less than pio_dma_border or pipe is DCP */ 977 /* use PIO if packet is less than pio_dma_border or pipe is DCP */
978 if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) || 978 if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) ||
979 usbhs_pipe_is_dcp(pipe)) 979 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
980 goto usbhsf_pio_prepare_pop; 980 goto usbhsf_pio_prepare_pop;
981 981
982 fifo = usbhsf_get_dma_fifo(priv, pkt); 982 fifo = usbhsf_get_dma_fifo(priv, pkt);
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 50f3363cc382..92bc83b92d10 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -617,10 +617,13 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
617 * use dmaengine if possible. 617 * use dmaengine if possible.
618 * It will use pio handler if impossible. 618 * It will use pio handler if impossible.
619 */ 619 */
620 if (usb_endpoint_dir_in(desc)) 620 if (usb_endpoint_dir_in(desc)) {
621 pipe->handler = &usbhs_fifo_dma_push_handler; 621 pipe->handler = &usbhs_fifo_dma_push_handler;
622 else 622 } else {
623 pipe->handler = &usbhs_fifo_dma_pop_handler; 623 pipe->handler = &usbhs_fifo_dma_pop_handler;
624 usbhs_xxxsts_clear(priv, BRDYSTS,
625 usbhs_pipe_number(pipe));
626 }
624 627
625 ret = 0; 628 ret = 0;
626 } 629 }