diff options
author | Felipe Balbi <balbi@ti.com> | 2012-01-18 16:04:09 (GMT) |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-02-06 09:48:34 (GMT) |
commit | 457e84b6624b4d97e6ffae437887ea51a22d54a0 (patch) | |
tree | e1ca1503cdda97570fa692589e44a1ca43e72d8b /drivers/usb/dwc3/ep0.c | |
parent | bb5cfd6811c63c47403e98028bde7e98bd7a1751 (diff) | |
download | linux-457e84b6624b4d97e6ffae437887ea51a22d54a0.tar.xz |
usb: dwc3: gadget: dynamically re-size TxFifos
We need to dynamically re-size TxFifos for the
cases where default values will not do.
While at that, we create a simple function which,
for now, will just allocate one full packet fifo
space for each of the enabled endpoints.
This can be improved later in order to allow for
better throughput by allocating more space for
endpoints which could make good use of that like
isochronous and bulk.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/ep0.c')
-rw-r--r-- | drivers/usb/dwc3/ep0.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index e90ebb9..5104dbf 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -457,8 +457,11 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) case DWC3_ADDRESS_STATE: ret = dwc3_ep0_delegate_req(dwc, ctrl); /* if the cfg matches and the cfg is non zero */ - if (cfg && (!ret || (ret == USB_GADGET_DELAYED_STATUS))) + if (cfg && (!ret || (ret == USB_GADGET_DELAYED_STATUS))) { dwc->dev_state = DWC3_CONFIGURED_STATE; + dwc->resize_fifos = true; + dev_dbg(dwc->dev, "resize fifos flag SET\n"); + } break; case DWC3_CONFIGURED_STATE: @@ -707,6 +710,12 @@ static void dwc3_ep0_do_control_status(struct dwc3 *dwc, u32 epnum) { struct dwc3_ep *dep = dwc->eps[epnum]; + if (dwc->resize_fifos) { + dev_dbg(dwc->dev, "starting to resize fifos\n"); + dwc3_gadget_resize_tx_fifos(dwc); + dwc->resize_fifos = 0; + } + WARN_ON(dwc3_ep0_start_control_status(dep)); } |