usb: ulpi: Clean up how we enable support
authorTom Rini <trini@konsulko.com>
Sat, 15 Mar 2025 01:27:36 +0000 (19:27 -0600)
committerMarek Vasut <marex@denx.de>
Sun, 25 May 2025 13:44:13 +0000 (15:44 +0200)
The way we enable ULPI support today isn't something that should work.
The "optional" keyword in a choice statement is not a documented
feature. To make this work in a supported way, make USB_ULPI something
we ask about if USB_HOST is set. Next, we move the choice of what
viewer to use to be after the framework portion and to depend on that.
We then borrow a few words from the top-level README to make the help
text here clearer. Finally we make the Qualcomm driver select ULPI as
it's required and we make the tegra driver not duplicate a check that
Kconfig now handles for us.

Signed-off-by: Tom Rini <trini@konsulko.com>
README
drivers/usb/host/Kconfig
drivers/usb/host/ehci-tegra.c
drivers/usb/ulpi/Kconfig

diff --git a/README b/README
index 334bbcf..88b6e6f 100644 (file)
--- a/README
+++ b/README
@@ -482,18 +482,6 @@ The following options need to be configured:
                        for your device
                        - CONFIG_USBD_PRODUCTID 0xFFFF
 
-- ULPI Layer Support:
-               The ULPI (UTMI Low Pin (count) Interface) PHYs are supported via
-               the generic ULPI layer. The generic layer accesses the ULPI PHY
-               via the platform viewport, so you need both the genric layer and
-               the viewport enabled. Currently only Chipidea/ARC based
-               viewport is supported.
-               To enable the ULPI layer support, define CONFIG_USB_ULPI and
-               CONFIG_USB_ULPI_VIEWPORT in your board configuration file.
-               If your ULPI phy needs a different reference clock than the
-               standard 24 MHz then you have to define CFG_ULPI_REF_CLK to
-               the appropriate value in Hz.
-
 - MMC Support:
                CONFIG_SH_MMCIF
                Support for Renesas on-chip MMCIF controller
index 3dc7977..5c9e8fc 100644 (file)
@@ -262,7 +262,7 @@ endif
 config USB_EHCI_MSM
        bool "Support for Qualcomm on-chip EHCI USB controller"
        depends on DM_USB
-       select USB_ULPI_VIEWPORT
+       select USB_ULPI
        select MSM8916_USB_PHY
        ---help---
          Enables support for the on-chip EHCI controller on Qualcomm
@@ -279,7 +279,10 @@ config USB_EHCI_TEGRA
        depends on ARCH_TEGRA
        select USB_EHCI_IS_TDI
        ---help---
-         Enable support for Tegra on-chip EHCI USB controller
+         Enable support for Tegra on-chip EHCI USB controller. If you enable
+         ULPI and your PHY needs a different reference clock than the standard
+         24 MHz then you have to define CFG_ULPI_REF_CLK to the appropriate
+         value in Hz.
 
 config USB_EHCI_ZYNQ
        bool "Support for Xilinx Zynq on-chip EHCI USB controller"
index 7c73eb6..89b8788 100644 (file)
 #define HOSTPC1_DEVLC  0x84
 #define HOSTPC1_PSPD(x)                (((x) >> 25) & 0x3)
 
-#ifdef CONFIG_USB_ULPI
-       #ifndef CONFIG_USB_ULPI_VIEWPORT
-       #error  "To use CONFIG_USB_ULPI on Tegra Boards you have to also \
-               define CONFIG_USB_ULPI_VIEWPORT"
-       #endif
-#endif
-
 /* Parameters we need for USB */
 enum {
        PARAM_DIVN,                     /* PLL FEEDBACK DIVIDer */
index 482114d..d969360 100644 (file)
@@ -1,8 +1,18 @@
 comment "ULPI drivers"
 
+config USB_ULPI
+       bool "ULPI support"
+       depends on USB_HOST
+       help
+         Select to commnicate with USB PHY via ULPI interface.
+         The ULPI (UTMI Low Pin (count) Interface) is a wrapper on UTMI+ core
+         that is used as PHY Transreceiver for USB controllers.
+
+         This driver uses ULPI viewports that are specific for each SoC.
+
 choice
        prompt "ULPI Viewport type"
-       optional
+       depends on USB_ULPI
        help
          Select ULPI viewport (SoC-side interface to ULPI) implementation
          appropriate for the device if you want to communicate with
@@ -10,18 +20,9 @@ choice
 
 config USB_ULPI_VIEWPORT
        bool "Generic ULPI Viewport"
+       depends on USB_ULPI
        help
          Support generic ULPI Viewport implementation that is used on
          some Tegra and Snapdragon devices.
 
 endchoice
-
-config USB_ULPI
-       bool "ULPI support"
-       depends on (USB_ULPI_VIEWPORT || USB_ULPI_VIEWPORT_OMAP)
-       help
-         Select to commnicate with USB PHY via ULPI interface.
-         ULPI is wrapper on UTMI+ core that is used as
-         PHY Transreceiver for USB controllers.
-
-         This driver uses ULPI viewports that are specific for each SoC.