diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2018-10-05 11:28:15 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-10-05 11:28:15 -0700 |
commit | e75118f5d96125cd287d4152fa1a18622baa7b9a (patch) | |
tree | d94ae4d66cb4eb681667bf42a7b96d3ca4032b1e /drivers/usb/dwc3 | |
parent | e772a5206ca5db530d247bdf2feee6ee32a869f1 (diff) | |
parent | cbc94245022b90fe551b334d6dfaa0c750b6c5d7 (diff) |
Merge "dwc3: Preserve TxFIFO of IN/INT EP for UDC without tx-fifo-resize"
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/ep0.c | 38 | ||||
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 3 |
2 files changed, 25 insertions, 16 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index dd9a41af43bd..1633807aee36 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -612,22 +612,30 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) return -EINVAL; case USB_STATE_ADDRESS: - /* Read ep0IN related TXFIFO size */ - dwc->last_fifo_depth = (dwc3_readl(dwc->regs, - DWC3_GTXFIFOSIZ(0)) & 0xFFFF); - /* Clear existing allocated TXFIFO for all IN eps except ep0 */ - for (num = 0; num < dwc->num_in_eps; num++) { - dep = dwc->eps[(num << 1) | 1]; - if (num) { - dwc3_writel(dwc->regs, DWC3_GTXFIFOSIZ(num), 0); - dep->fifo_depth = 0; - } else { - dep->fifo_depth = dwc->last_fifo_depth; - } - - dev_dbg(dwc->dev, "%s(): %s dep->fifo_depth:%x\n", + /* + * If tx-fifo-resize flag is not set for the controller, then + * do not clear existing allocated TXFIFO since we do not + * allocate it again in dwc3_gadget_resize_tx_fifos + */ + if (dwc->needs_fifo_resize) { + /* Read ep0IN related TXFIFO size */ + dwc->last_fifo_depth = (dwc3_readl(dwc->regs, + DWC3_GTXFIFOSIZ(0)) & 0xFFFF); + /* Clear existing TXFIFO for all IN eps except ep0 */ + for (num = 0; num < dwc->num_in_eps; num++) { + dep = dwc->eps[(num << 1) | 1]; + if (num) { + dwc3_writel(dwc->regs, + DWC3_GTXFIFOSIZ(num), 0); + dep->fifo_depth = 0; + } else { + dep->fifo_depth = dwc->last_fifo_depth; + } + + dev_dbg(dwc->dev, "%s(): %s fifo_depth:%x\n", __func__, dep->name, dep->fifo_depth); - dbg_event(0xFF, "fifo_reset", dep->number); + dbg_event(0xFF, "fifo_reset", dep->number); + } } ret = dwc3_ep0_delegate_req(dwc, ctrl); diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index b9c5c9ba8419..48bfe2aaef1a 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -207,7 +207,8 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc, struct dwc3_ep *dep) tmp = ((max_packet + mdwidth) * mult) + mdwidth; fifo_size = DIV_ROUND_UP(tmp, mdwidth); dep->fifo_depth = fifo_size; - fifo_size |= (dwc->last_fifo_depth << 16); + fifo_size |= (dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(0)) & 0xffff0000) + + (dwc->last_fifo_depth << 16); dwc->last_fifo_depth += (fifo_size & 0xffff); dev_dbg(dwc->dev, "%s ep_num:%d last_fifo_depth:%04x fifo_depth:%d\n", |