On 4/4/2016 12:49 PM, Felipe Balbi wrote:
Synopsys Databook says we should move link to U0
Why "databook" is capitalized? :-)
before issuing a Start Transfer command. We could require the gadget driver to call usb_gadget_wakeup() however I feel that changing all gagdget drivers to keep track of Link State and
Gadget.
conditionally call usb_gadget_wakeup() would be far too much work. For now we will handle this at the UDC level, but at some point composite.c should be one handling this.
The one?
Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> --- drivers/usb/dwc3/gadget.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 552ebdf972b4..404573fcb3c9 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c
[...]
@@ -242,12 +244,24 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, * by the same section on Synopsys databook. */ if (cmd == DWC3_DEPCMD_STARTTRANSFER) { + int needs_wakeup; + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) { susphy = true; reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); } + + needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 || + dwc->link_state == DWC3_LINK_STATE_U2 || + dwc->link_state == DWC3_LINK_STATE_U3);
Parens not needed.
+
Empty line here is hardly needed as well...
+ if (unlikely(needs_wakeup)) { + ret = __dwc3_gadget_wakeup(dwc); + dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", + ret); + } } dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(ep), params->param0);
MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html