diff mbox

[1/4] usb: dwc3: fix kconfig

Message ID 1463141873-10604-2-git-send-email-rogerq@ti.com
State New
Headers show

Commit Message

Roger Quadros May 13, 2016, 12:17 p.m. UTC
DWC3 can be used in host only or gadget only mode.

Signed-off-by: Roger Quadros <rogerq@ti.com>

---
 drivers/usb/dwc3/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Comments

Roger Quadros May 13, 2016, 12:27 p.m. UTC | #1
On 13/05/16 15:23, Marek Vasut wrote:
> On 05/13/2016 02:17 PM, Roger Quadros wrote:

>> DWC3 can be used in host only or gadget only mode.

>>

>> Signed-off-by: Roger Quadros <rogerq@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)

> 

> What happens if I select both USB and USB_GADGET ?


Ideally we want to have dual role operation but that code seems
to have been stripped off from the dwc3/core.c.

So till dual-role is added back it will work in HOST mode by default
but user can still choose GADGET mode.
> 

>>  config USB_DWC3_HOST

>>  	bool "Host only mode"

>>

> 

> 


cheers,
-roger
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Masahiro Yamada May 17, 2016, 10:33 a.m. UTC | #2
Hi.


2016-05-13 21:17 GMT+09:00 Roger Quadros <rogerq@ti.com>:
> DWC3 can be used in host only or gadget only mode.

>

> Signed-off-by: Roger Quadros <rogerq@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@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@paulk.fr>
AuthorDate: Tue Aug 4 17:04:05 2015 +0200
Commit:     Marek Vasut <marex@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@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.



-- 
Best Regards
Masahiro Yamada
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Masahiro Yamada May 17, 2016, 10:37 a.m. UTC | #3
2016-05-13 21:23 GMT+09:00 Marek Vasut <marex@denx.de>:
> On 05/13/2016 02:17 PM, Roger Quadros wrote:

>> DWC3 can be used in host only or gadget only mode.

>>

>> Signed-off-by: Roger Quadros <rogerq@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)

>

> What happens if I select both USB and USB_GADGET ?

>


Unlike Linux, CONFIG_USB_GADGET depends on CONFIG_USB in U-Boot.

So, (!USB && USB_GADGET) never happens.


-- 
Best Regards
Masahiro Yamada
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Roger Quadros May 18, 2016, 12:47 p.m. UTC | #4
On 17/05/16 13:33, Masahiro Yamada wrote:
> Hi.

> 

> 

> 2016-05-13 21:17 GMT+09:00 Roger Quadros <rogerq@ti.com>:

>> DWC3 can be used in host only or gadget only mode.

>>

>> Signed-off-by: Roger Quadros <rogerq@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@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@paulk.fr>

> AuthorDate: Tue Aug 4 17:04:05 2015 +0200

> Commit:     Marek Vasut <marex@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@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.

cheers,
-roger
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

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"