On 01/28/2015 11:26 PM, Kaukab, Yousaf wrote: > >> -----Original Message----- >> From: John Youn [mailto:john.y...@synopsys.com] >> Sent: Thursday, January 29, 2015 3:25 AM >> To: Kaukab, Yousaf; linux-usb@vger.kernel.org; ba...@ti.com; >> john.y...@synopsys.com >> Cc: Herrero, Gregory; r.bald...@samsung.com; >> dingu...@opensource.altera.com; sergei.shtyl...@cogentembedded.com >> Subject: RE: [PATCH v1 01/13] usb: dwc2: host: register hcd handle to the phy >> >>> From: Mian Yousaf Kaukab [mailto:yousaf.kau...@intel.com] >>> Sent: Wednesday, January 21, 2015 6:37 AM >>> >>> From: Gregory Herrero <gregory.herr...@intel.com> >>> >>> If phy driver is present, register hcd handle to it and let it take >>> care of calling usb_add_hcd. Otherwise, add hcd here. >>> >>> Moreover, save irq number so that it can be used to call usb_add_hcd. >>> >>> Signed-off-by: Gregory Herrero <gregory.herr...@intel.com> >>> --- >>> drivers/usb/dwc2/hcd.c | 35 ++++++++++++++++++++++++++++++----- >>> 1 file changed, 30 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index >>> 755e16b..4375d4f 100644 >>> --- a/drivers/usb/dwc2/hcd.c >>> +++ b/drivers/usb/dwc2/hcd.c >>> @@ -2779,6 +2779,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int >>> irq, >>> u32 hcfg; >>> int i, num_channels; >>> int retval; >>> + bool add_host = true; >>> >>> if (usb_disabled()) >>> return -ENODEV; >>> @@ -2935,14 +2936,30 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, >>> int irq, >>> /* Don't support SG list at this point */ >>> hcd->self.sg_tablesize = 0; >>> >>> + /* Save irq number */ >>> + hcd->irq = irq; >>> + >>> /* >>> * Finish generic HCD initialization and start the HCD. This >> function >>> * allocates the DMA buffer pool, registers the USB bus, requests >> the >>> * IRQ line, and calls hcd_start method. >>> + * If a phy driver is present, let it handle the hcd initialization. >>> */ >>> - retval = usb_add_hcd(hcd, irq, IRQF_SHARED); >>> - if (retval < 0) >>> - goto error3; >>> + if (!IS_ERR_OR_NULL(hsotg->uphy)) { >>> + retval = otg_set_host(hsotg->uphy->otg, &hcd- >>> self); >>> + if (retval) { >>> + if (retval != -ENOTSUPP) >>> + goto error3; >>> + } else { >>> + add_host = false; >>> + } >>> + } >>> + >>> + if (add_host) { >>> + retval = usb_add_hcd(hcd, irq, IRQF_SHARED); >>> + if (retval) >>> + goto error3; >>> + } >>> >>> device_wakeup_enable(hcd->self.controller); >>> >>> @@ -2976,7 +2993,8 @@ EXPORT_SYMBOL_GPL(dwc2_hcd_init); void >>> dwc2_hcd_remove(struct dwc2_hsotg *hsotg) { >>> struct usb_hcd *hcd; >>> - >>> + bool remove_host = true; >>> + int retval; >>> dev_dbg(hsotg->dev, "DWC OTG HCD REMOVE\n"); >>> >>> hcd = dwc2_hsotg_to_hcd(hsotg); >>> @@ -2988,7 +3006,14 @@ void dwc2_hcd_remove(struct dwc2_hsotg >>> *hsotg) >>> return; >>> } >>> >>> - usb_remove_hcd(hcd); >>> + if (!IS_ERR_OR_NULL(hsotg->uphy)) { >>> + retval = otg_set_host(hsotg->uphy->otg, NULL); >>> + if (!retval) >>> + remove_host = false; >>> + } >>> + >>> + if (remove_host) >>> + usb_remove_hcd(hcd); >>> hsotg->priv = NULL; >>> dwc2_hcd_release(hsotg); >>> usb_put_hcd(hcd); >>> -- >>> 1.9.1 >> >> Hi Yousaf, > Hi John, > >> >> This patch seems to break host-mode on the Altera platform. >> >> When it comes up as an A-Host, the HCD doesn't get loaded. When it comes up >> as a B-Peripheral, it gets the connector ID status change interrupt, but >> hangs >> the system. > > Thank you testing this patchset. Can you point me to the phy driver used by > your platform? > I will take a look what's going on.
It is using the generic PHY. > > I can drop this patch for now. Are you ok with rest of the patches in this > set? If so, can you send your conditional ACK for them? May be there is still > time to get them queued for v3.20. Yes, I'm ok with that. Hi Felipe, Could you queue patch 2-13 for 3.20 or would you like it respun? Patch 2-13: Acked-by: John Youn <johny...@synopsys.com> Also Robert Baldyga gave Tested-by previously: > [for gadget part] > Tested-by: Robert Baldyga <r.bald...@samsung.com> Thanks, John -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html