From 5d4fc6626df9d897c2fb72f027cc2a7579a3e513 Mon Sep 17 00:00:00 2001 From: William Wu Date: Tue, 14 Jul 2020 18:38:19 +0800 Subject: [PATCH] usb: dwc3: gadget: fix the txfifo resize for isoc ep The dwc3 driver sets the mult to 6 and alloc 0x307 * 8 Bytes for each isoc ep txfifo. It aims to improve isoc ep throughput, but it's wasteful. This patch sets the mult to dep->endpoint.mult * 2 for each isoc ep, it's enough to improve isoc ep throughput, and it can avoid exceeding the total size of txfifo if multiple isoc eps are used at the same time. Change-Id: I01d77d19b85e5f5930ff94ef40714129afe10b54 Signed-off-by: William Wu --- drivers/usb/dwc3/gadget.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index d535425bb6bf..840aef9d165c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -185,10 +185,14 @@ static int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc) if (!(dep->flags & DWC3_EP_ENABLED)) continue; - if (usb_endpoint_xfer_bulk(dep->endpoint.desc)) + if (usb_endpoint_xfer_bulk(dep->endpoint.desc)) { mult = 3; - else if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) - mult = 6; + } else if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { + if (dep->endpoint.mult > 0) + mult = dep->endpoint.mult * 2; + else + mult = 3; + } /* * REVISIT: the following assumes we will always have enough