Re: [PATCH 1/2] usb: dwc3: adapt to use dr_mode device tree helper

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

 



On Tue, Jul 09, 2013 at 02:16:32PM +0300, Roger Quadros wrote:
> Hi,
> 
> On 07/06/2013 03:52 PM, Ruchika Kharwar wrote:
> > This patch adapts the dwc3 to use the device tree helper
> > "of_usb_get_dr_mode" for the mode of operation of the dwc3 instance
> > being probed.
> > 
> > Signed-off-by: Ruchika Kharwar <ruchika@xxxxxx>
> > ---
> >  drivers/usb/dwc3/core.c |   51 +++++++++++++++++++++++++----------------------
> >  drivers/usb/dwc3/core.h |    5 -----
> >  2 files changed, 27 insertions(+), 29 deletions(-)
> > 
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index c35d49d..7b98e4f 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -517,14 +517,17 @@ static int dwc3_probe(struct platform_device *pdev)
> >  	}
> >  
> >  	if (IS_ENABLED(CONFIG_USB_DWC3_HOST))
> > -		mode = DWC3_MODE_HOST;
> > +		mode = USB_DR_MODE_HOST;
> >  	else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
> > -		mode = DWC3_MODE_DEVICE;
> > +		mode = USB_DR_MODE_PERIPHERAL;
> >  	else
> > -		mode = DWC3_MODE_DRD;
> > +		mode = of_usb_get_dr_mode(node);
> 
> You need to check if "node" is not NULL before using
> of_usb_get_dr_mode.
> 
> Also what would happen if DT passes a mode which can't be supported
> due to missing device driver? e.g. DT passes mode = "host" whereas
> HOST is not enabled.

hmm... look closely, she's already handling that, right ? If DWC3
Host-only, then mode is hardcoded to host, if DWC3 is Gadget-only, then
mode is hardcoded to peripheral and if DWC3 is DRD, then she checks
DeviceTree.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux