usb: dwc3: Kconfig: get rid of obsolete mode selection
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Wed, 11 Sep 2019 09:33:53 +0000 (11:33 +0200)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Thu, 24 Oct 2019 09:28:17 +0000 (11:28 +0200)
The mode selection for the DWC3 is kind of obsolete. The driver does not
have to be host only or gadget only. This choice is confusing.
All the remaining callers of dwc3_uboot_init() explicitly set dr_mode
before calling the function, so none rely on a default behavior.

Remove the choice menu and keep only the USB_DWC3_GADGET option. Enable it
by default if USB_GADGET and USB_DWC3 are enabled.
It must be disabled for the evb-rk3328 as it uses DWC2 for the gadget and
DWC3 for the host.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
configs/evb-rk3328_defconfig
configs/odroid-n2_defconfig
configs/rock64-rk3328_defconfig
configs/sei510_defconfig
configs/u200_defconfig
drivers/usb/dwc3/Kconfig
drivers/usb/dwc3/core.c

index 3761077..f161c40 100644 (file)
@@ -86,6 +86,7 @@ CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
 CONFIG_USB_GADGET_VENDOR_NUM=0x2207
index abd945a..1caa391 100644 (file)
@@ -44,6 +44,7 @@ CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
 CONFIG_USB_DWC3_MESON_G12A=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
index 3ab0af1..60a0d14 100644 (file)
@@ -88,6 +88,7 @@ CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
 CONFIG_USB_GADGET_VENDOR_NUM=0x2207
index 9df04c3..302480e 100644 (file)
@@ -65,6 +65,7 @@ CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
 CONFIG_USB_DWC3_MESON_G12A=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_VENDOR_NUM=0x18d1
index ced6ca8..009d564 100644 (file)
@@ -44,6 +44,7 @@ CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
 CONFIG_USB_DWC3_MESON_G12A=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
index 25e1a38..c302486 100644 (file)
@@ -7,25 +7,11 @@ config USB_DWC3
 
 if USB_DWC3
 
-choice
-       bool "DWC3 Mode Selection"
-
-config USB_DWC3_HOST
-       bool "Host only mode"
-       depends on USB
-       help
-         Select this when you want to use DWC3 in host mode only,
-         thereby the gadget feature will be regressed.
-
 config USB_DWC3_GADGET
-       bool "Gadget only mode"
+       bool "USB Gadget support for DWC3"
+       default y
        depends on USB_GADGET
        select USB_GADGET_DUALSPEED
-       help
-         Select this when you want to use DWC3 in gadget mode only,
-         thereby the host feature will be regressed.
-
-endchoice
 
 comment "Platform Glue Driver Support"
 
index 5fe5bfa..23af60c 100644 (file)
@@ -707,9 +707,9 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
                return -ENOMEM;
        }
 
-       if (IS_ENABLED(CONFIG_USB_DWC3_HOST))
+       if (!IS_ENABLED(CONFIG_USB_DWC3_GADGET))
                dwc->dr_mode = USB_DR_MODE_HOST;
-       else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
+       else if (!IS_ENABLED(CONFIG_USB_HOST))
                dwc->dr_mode = USB_DR_MODE_PERIPHERAL;
 
        if (dwc->dr_mode == USB_DR_MODE_UNKNOWN)