RE: [PATCH v1 01/13] usb: dwc2: host: register hcd handle to the phy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: John Youn [mailto:John.Youn@xxxxxxxxxxxx]
> Sent: Thursday, January 29, 2015 3:25 AM
> To: Kaukab, Yousaf; linux-usb@xxxxxxxxxxxxxxx; balbi@xxxxxx;
> john.youn@xxxxxxxxxxxx
> Cc: Herrero, Gregory; r.baldyga@xxxxxxxxxxx;
> dinguyen@xxxxxxxxxxxxxxxxxxxxx; sergei.shtylyov@xxxxxxxxxxxxxxxxxx
> Subject: RE: [PATCH v1 01/13] usb: dwc2: host: register hcd handle to the phy
> 
> > From: Mian Yousaf Kaukab [mailto:yousaf.kaukab@xxxxxxxxx]
> > Sent: Wednesday, January 21, 2015 6:37 AM
> >
> > From: Gregory Herrero <gregory.herrero@xxxxxxxxx>
> >
> > 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.herrero@xxxxxxxxx>
> > ---
> >  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. 

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.

> 
> Dinh,
> 
> Have you tried this on your platform yet? Do you see the same thing?
> 
> Thanks,
> John
> 
> 

BR,
Yousaf
--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux