[U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig

Marek Vasut marex at denx.de
Wed May 18 14:52:51 CEST 2016


On 05/18/2016 02:47 PM, Roger Quadros wrote:
> On 17/05/16 13:33, Masahiro Yamada wrote:
>> Hi.
>>
>>
>> 2016-05-13 21:17 GMT+09:00 Roger Quadros <rogerq at ti.com>:
>>> DWC3 can be used in host only or gadget only mode.
>>>
>>> Signed-off-by: Roger Quadros <rogerq at ti.com>
>>> ---
>>>  drivers/usb/dwc3/Kconfig | 9 +++++----
>>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>>> index e93398f..caf695b 100644
>>> --- a/drivers/usb/dwc3/Kconfig
>>> +++ b/drivers/usb/dwc3/Kconfig
>>> @@ -1,15 +1,16 @@
>>>  config USB_DWC3
>>>         bool "DesignWare USB3 DRD Core Support"
>>> -       depends on (USB && USB_GADGET)
>>> -       select USB_GADGET_DUALSPEED
>>> +       depends on (USB || USB_GADGET)
>>> +       select USB_GADGET_DUALSPEED if USB_GADGET
>>>         help
>>> -         Say Y here if your system has a Dual Role SuperSpeed
>>> -         USB controller based on the DesignWare USB3 IP Core.
>>> +         Say Y here if your system has DesignWare USB3 IP Core.
>>>
>>>  if USB_DWC3
>>>
>>>  choice
>>>         bool "DWC3 Mode Selection"
>>> +       default USB_DWC3_HOST if (USB && !USB_GADGET)
>>> +       default USB_DWC3_GADGET if (!USB && USB_GADGET)
>>>
>>>  config USB_DWC3_HOST
>>>         bool "Host only mode"
>>> --
>>> 2.7.4
>>>
>>> _______________________________________________
>>> U-Boot mailing list
>>> U-Boot at lists.denx.de
>>> http://lists.denx.de/mailman/listinfo/u-boot
>>
>>
>> Please note the following commit changed
>> the meaning of CONFIG_USB.
>>
>>
>> commit 68f7c5db2d1e714c15b49b0759ddef8f8344f184
>> Author:     Paul Kocialkowski <contact at paulk.fr>
>> AuthorDate: Tue Aug 4 17:04:05 2015 +0200
>> Commit:     Marek Vasut <marex at denx.de>
>> CommitDate: Wed Aug 5 17:20:34 2015 +0200
>>
>>     usb: Generic USB Kconfig option, that fits both host and gadget and comments
>>
>>     There is no particular reason why the USB Kconfig option should be specific
>>     host mode. In prevision of adding MUSB host and gadget to Kconfig, this move
>>     the title and help message of the USB Kconfig option to a more generic forma
>>
>>     Adding comments to the usb Kconfig allows for a better separation and more
>>     readability in generated configs and in menuconfig.
>>
>>     Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
>>
>>
>>
>> In Linux, CONFIG_USB enables the host mode of USB.
>> So, "depends on (USB || USB_GADGET)" makes sense.
>>
>>
>> In U-Boot, since the commit above, CONFIG_USB enables
>> the whole of USB frame-work, including host, gadget.
>>
>> USB_DWC3 already resides inside of if USB ... endif
>> so, depends on (USB || USB_GADGET) does not make sense.
>>
>>
>>
> OK, thanks for pointing this out.
> 
> But USB doesn't mean Host is active and USB_GADGET means gadget
> framework is available.
> 
> So I think we have incomplete information for deciding about Host role
> based on just Kconfig.

On an OTG controller, you should check the ID pin at runtime to
determine which mode the controller should work in. The Kconfig
options should select the supported modes, not enforce particular
one. If the ID pin is not available or you want to force the controller
into particular mode, do it via DT or platdata.


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list