aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/gadget.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 1f64e7c1c34f..c30ab6da3d0e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -172,6 +172,7 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
172 for (num = 0; num < DWC3_ENDPOINTS_NUM; num++) { 172 for (num = 0; num < DWC3_ENDPOINTS_NUM; num++) {
173 struct dwc3_ep *dep = dwc->eps[num]; 173 struct dwc3_ep *dep = dwc->eps[num];
174 int fifo_number = dep->number >> 1; 174 int fifo_number = dep->number >> 1;
175 int mult = 1;
175 int tmp; 176 int tmp;
176 177
177 if (!(dep->number & 1)) 178 if (!(dep->number & 1))
@@ -180,11 +181,26 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
180 if (!(dep->flags & DWC3_EP_ENABLED)) 181 if (!(dep->flags & DWC3_EP_ENABLED))
181 continue; 182 continue;
182 183
183 tmp = dep->endpoint.maxpacket; 184 if (usb_endpoint_xfer_bulk(dep->desc)
184 tmp += mdwidth; 185 || usb_endpoint_xfer_isoc(dep->desc))
186 mult = 3;
187
188 /*
189 * REVISIT: the following assumes we will always have enough
190 * space available on the FIFO RAM for all possible use cases.
191 * Make sure that's true somehow and change FIFO allocation
192 * accordingly.
193 *
194 * If we have Bulk or Isochronous endpoints, we want
195 * them to be able to be very, very fast. So we're giving
196 * those endpoints a fifo_size which is enough for 3 full
197 * packets
198 */
199 tmp = mult * (dep->endpoint.maxpacket + mdwidth);
185 tmp += mdwidth; 200 tmp += mdwidth;
186 201
187 fifo_size = DIV_ROUND_UP(tmp, mdwidth); 202 fifo_size = DIV_ROUND_UP(tmp, mdwidth);
203
188 fifo_size |= (last_fifo_depth << 16); 204 fifo_size |= (last_fifo_depth << 16);
189 205
190 dev_vdbg(dwc->dev, "%s: Fifo Addr %04x Size %d\n", 206 dev_vdbg(dwc->dev, "%s: Fifo Addr %04x Size %d\n",