TEST: Rework CONFIG_USB and enforce DM_USB for USB host mode

- Make CONFIG_USB a menu-only option to gate "we have USB".
- Make USB_HOST select DM_USB
- Make sure all host controllers use USB_HOST
- Clean up dependencies on a number of host controllers

Signed-off-by: Tom Rini <trini@konsulko.com>
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index f697573..470a910 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -34,8 +34,8 @@
 if USB
 
 config DM_USB
-	bool "Enable driver model for USB"
-	depends on USB && DM
+	bool
+	depends on DM
 	help
 	  Enable driver model for USB. The USB interface is then implemented
 	  by the USB uclass. Multiple USB controllers of different types
@@ -48,20 +48,20 @@
 	  automatically probed when found on the bus.
 
 config SPL_DM_USB
-	bool "Enable driver model for USB in SPL"
+	bool "Enable driver model for USB host most in SPL"
 	depends on SPL_DM && DM_USB
 	default y
 
 config DM_USB_GADGET
 	bool "Enable driver model for USB Gadget"
-	depends on DM_USB
+	depends on DM
 	help
 	  Enable driver model for USB Gadget (Peripheral
 	  mode)
 
 config SPL_DM_USB_GADGET
 	bool "Enable driver model for USB Gadget in SPL"
-	depends on SPL_DM_USB
+	depends on SPL_DM
 	help
 	  Enable driver model for USB Gadget in SPL
 	  (Peripheral mode)
@@ -84,6 +84,8 @@
 
 source "drivers/usb/ulpi/Kconfig"
 
+if USB_HOST
+
 comment "USB peripherals"
 
 config USB_STORAGE
@@ -129,8 +131,10 @@
 
 endif
 
-source "drivers/usb/gadget/Kconfig"
-
 source "drivers/usb/eth/Kconfig"
 
 endif
+
+source "drivers/usb/gadget/Kconfig"
+
+endif
diff --git a/drivers/usb/cdns3/Kconfig b/drivers/usb/cdns3/Kconfig
index 4cf59c7..05785fc 100644
--- a/drivers/usb/cdns3/Kconfig
+++ b/drivers/usb/cdns3/Kconfig
@@ -1,6 +1,6 @@
 config USB_CDNS3
 	tristate "Cadence USB3 Dual-Role Controller"
-	depends on USB_HOST || USB_GADGET
+	depends on USB_XHCI_HCD || USB_GADGET
 	help
 	  Say Y here if your system has a Cadence USB3 dual-role controller.
 	  It supports: Host-only, and Peripheral-only.
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 802ee50..da46048 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -1,6 +1,6 @@
 config USB_DWC3
 	bool "DesignWare USB3 DRD Core Support"
-	depends on USB_HOST || USB_GADGET
+	depends on USB_XHCI_DWC3 || USB_GADGET
 	help
 	  Say Y here if your system has a Dual Role SuperSpeed
 	  USB controller based on the DesignWare USB3 IP Core.
diff --git a/drivers/usb/emul/Kconfig b/drivers/usb/emul/Kconfig
index ae1ab23..279f6c6 100644
--- a/drivers/usb/emul/Kconfig
+++ b/drivers/usb/emul/Kconfig
@@ -1,6 +1,8 @@
 config USB_EMUL
 	bool "Support for USB device emulation"
-	depends on DM_USB && SANDBOX
+	depends on SANDBOX
+	select DM_USB
+	select USB_HOST
 	help
 	  Since sandbox does not have access to a real USB bus, it is possible
 	  to use device emulators instead. This allows testing of the USB
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index f34cba2..61d61d3 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -5,6 +5,7 @@
 
 config USB_HOST
 	bool
+	select DM_USB
 
 config USB_XHCI_HCD
 	bool "xHCI HCD (USB 3.0) support"
@@ -17,6 +18,7 @@
 
 config USB_XHCI_DWC3
 	bool "DesignWare USB3 DRD Core Support"
+	select USB_DWC3
 	help
 	  Say Y or if your system has a Dual Role SuperSpeed
 	  USB controller based on the DesignWare USB3 IP Core.
@@ -33,6 +35,7 @@
 config USB_XHCI_MTK
 	bool "Support for MediaTek on-chip xHCI USB controller"
 	depends on ARCH_MEDIATEK
+	select USB_MTU3
 	help
 	  Enables support for the on-chip xHCI controller on MediaTek SoCs.
 
@@ -234,6 +237,7 @@
 
 config USB_OHCI_HCD
 	bool "OHCI HCD (USB 1.1) support"
+	select USB_HOST
 	---help---
 	  The Open Host Controller Interface (OHCI) is a standard for accessing
 	  USB 1.1 host controller hardware.  It does more in hardware than Intel's
@@ -244,21 +248,18 @@
 	  based system where you're not sure, the "lspci -v" entry will list the
 	  right "prog-if" for your USB controller(s):  EHCI, OHCI, or UHCI.
 
+if USB_OHCI_HCD
+
 config USB_OHCI_PCI
 	bool "Support for PCI-based OHCI USB controller"
-	depends on DM_USB
-	default n
+	depends on PCI
 	help
 	  Enables support for the PCI-based OHCI controller.
 
-if USB_OHCI_HCD
-
 config USB_OHCI_GENERIC
 	bool "Support for generic OHCI USB controller"
 	depends on OF_CONTROL
-	depends on DM_USB
 	default ARCH_SUNXI
-	select USB_HOST
 	---help---
 	  Enables support for generic OHCI controller.
 
@@ -312,7 +313,6 @@
 config USB_R8A66597_HCD
 	bool "Renesas R8A66597 USB Core support"
 	depends on OF_CONTROL
-	depends on DM_USB
 	select USB_HOST
 	---help---
 	  This enables support for the on-chip Renesas R8A66597 USB 2.0
diff --git a/drivers/usb/mtu3/Kconfig b/drivers/usb/mtu3/Kconfig
index a2a5991..7b51e4f 100644
--- a/drivers/usb/mtu3/Kconfig
+++ b/drivers/usb/mtu3/Kconfig
@@ -4,7 +4,7 @@
 
 config USB_MTU3
 	bool "MediaTek USB3 Dual Role controller"
-	depends on USB_HOST || USB_GADGET
+	depends on USB_XHCI_MTK || USB_GADGET
 	depends on ARCH_MEDIATEK
 	help
 	  Say Y here if your system runs on MediaTek SoCs with
@@ -21,7 +21,7 @@
 
 config USB_MTU3_HOST
 	bool "Host only mode"
-	depends on USB_XHCI_HCD
+	depends on USB_XHCI_MTK
 	help
 	  Select this when you want to use MTU3 in host mode only,
 	  thereby the gadget feature will be regressed.
diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
index fd6f410..8df4e12 100644
--- a/drivers/usb/musb-new/Kconfig
+++ b/drivers/usb/musb-new/Kconfig
@@ -7,20 +7,23 @@
 	bool "MUSB host mode support"
 	select SPL_SPRINTF if SPL
 	select TPL_SPRINTF if TPL
+	select USB_HOST
 	help
 	  Enables the MUSB USB dual-role controller in host mode.
 
 config USB_MUSB_GADGET
 	bool "MUSB gadget mode support"
+	depends on USB_GADGET
 	select USB_GADGET_DUALSPEED
 	select SPL_SPRINTF if SPL
 	select TPL_SPRINTF if TPL
 	help
 	  Enables the MUSB USB dual-role controller in gadget mode.
 
+if USB_MUSB_HOST || USB_MUSB_GADGET
 config USB_MUSB_DA8XX
 	bool "Enable DA8xx MUSB Controller"
-	depends on DM_USB
+	depends on DM_USB && ARCH_DAVINCI
 	help
 	  Say y here to enable support for the dual role high
 	  speed USB controller based on the Mentor Graphics
@@ -28,7 +31,7 @@
 
 config USB_MUSB_TI
 	bool "Enable TI OTG USB controller"
-	depends on DM_USB
+	depends on DM_USB && AM33XX
 	select USB_MUSB_DSPS
 	default n
 	help
@@ -46,7 +49,6 @@
 config USB_MUSB_DSPS
 	bool "TI DSPS platforms"
 
-if USB_MUSB_HOST || USB_MUSB_GADGET
 config USB_MUSB_MT85XX
 	bool "Enable Mediatek MT85XX DRC USB controller"
 	depends on DM_USB && ARCH_MEDIATEK
diff --git a/include/configs/topic_miami.h b/include/configs/topic_miami.h
index c12cd7c..b668817 100644
--- a/include/configs/topic_miami.h
+++ b/include/configs/topic_miami.h
@@ -34,7 +34,7 @@
 
 /* Setup proper boot sequences for Miami boards */
 
-#if defined(CONFIG_USB)
+#if defined(CONFIG_USB_HOST)
 # define EXTRA_ENV_USB \
 	"usbreset=i2c dev 1 && i2c mw 41 1 ff && i2c mw 41 3 fe && "\
 		"i2c mw 41 1 fe && i2c mw 41 1 ff\0" \