From ae074e81d4a375578b108af5509d52536ace8b85 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 29 Jun 2021 18:48:30 +0200 Subject: [PATCH] usb: remove Kconfig option CONFIG_USB The USB configuration option is actually a global switch to enable USB drivers in general, but currently only the device controller drivers are meant. USB device controller drivers also have USB_DEVICE_DRIVER option. Thus the option USB is actually redundant and can be replaced by the self-explanatory option USB_DEVICE_DRIVER. The name USB itself is not unique and should not be used as an configuration option. With these changes the option USB_DEVICE_DRIVER generally enables USB device controller drivers. The option USB_DEVICE_STACK enables USB device support. It is sufficient to enable only option USB_DEVICE_STACK because it selects USB_DEVICE_DRIVER. CONFIG_USB Kconfig option is temporary added to subsys/usb/Kconfig. This is necessary to pass CI and will be removed again when the USB configuration has been adapted in modules. Signed-off-by: Johann Fischer --- drivers/CMakeLists.txt | 2 +- drivers/usb/CMakeLists.txt | 2 +- drivers/usb/Kconfig | 5 ---- drivers/usb/device/Kconfig | 44 +++++++++++++------------------ drivers/usb/device/usb_dc_stm32.c | 2 +- subsys/CMakeLists.txt | 2 +- subsys/tracing/Kconfig | 2 +- subsys/usb/Kconfig | 9 +++++-- 8 files changed, 31 insertions(+), 37 deletions(-) diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index aa6fd19403..14650cfbaa 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(interrupt_controller) add_subdirectory(misc) add_subdirectory(pcie) add_subdirectory(disk) +add_subdirectory(usb) add_subdirectory_ifdef(CONFIG_ADC adc) add_subdirectory_ifdef(CONFIG_CLOCK_CONTROL clock_control) @@ -28,7 +29,6 @@ add_subdirectory_ifdef(CONFIG_PINMUX pinmux) add_subdirectory_ifdef(CONFIG_PWM pwm) add_subdirectory_ifdef(CONFIG_SENSOR sensor) add_subdirectory_ifdef(CONFIG_SPI spi) -add_subdirectory_ifdef(CONFIG_USB usb) add_subdirectory_ifdef(CONFIG_WATCHDOG watchdog) add_subdirectory_ifdef(CONFIG_WIFI wifi) add_subdirectory_ifdef(CONFIG_CAN can) diff --git a/drivers/usb/CMakeLists.txt b/drivers/usb/CMakeLists.txt index 197bb1e35e..bcab43d088 100644 --- a/drivers/usb/CMakeLists.txt +++ b/drivers/usb/CMakeLists.txt @@ -1,3 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 -add_subdirectory_ifdef(CONFIG_USB device) +add_subdirectory_ifdef(CONFIG_USB_DEVICE_DRIVER device) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 4e3f0f7a35..55b3a20b6f 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -3,9 +3,4 @@ # Copyright (c) 2016 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 -menuconfig USB - bool "USB" - help - Enable USB drivers. - source "drivers/usb/device/Kconfig" diff --git a/drivers/usb/device/Kconfig b/drivers/usb/device/Kconfig index e734d7f8dd..42196380d2 100644 --- a/drivers/usb/device/Kconfig +++ b/drivers/usb/device/Kconfig @@ -3,14 +3,15 @@ # Copyright (c) 2016 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 -if USB +menuconfig USB_DEVICE_DRIVER + bool "Enable USB device controller drivers" + help + Enable USB device controller drivers. -config USB_DEVICE_DRIVER - bool +if USB_DEVICE_DRIVER config USB_DW bool "Designware USB Device Controller Driver" - select USB_DEVICE_DRIVER help Designware USB Device Controller Driver. @@ -23,7 +24,6 @@ config USB_DW_USB_2_0 config USB_DC_STM32 bool "USB device controller driver for STM32 devices" depends on SOC_FAMILY_STM32 - select USB_DEVICE_DRIVER select USE_STM32_LL_USB select USE_STM32_HAL_PCD select USE_STM32_HAL_PCD_EX @@ -31,11 +31,17 @@ config USB_DC_STM32 Enable USB support on the STM32 F0, F1, F2, F3, F4, F7, L0, L4 and G4 family of processors. +config USB_DC_STM32_DISCONN_ENABLE + bool + depends on USB_DC_STM32 + help + Say Y if your board uses USB DISCONNECT pin to enable the + pull-up resistor on USB DP. + config USB_DC_SAM0 bool "SAM0 series USB Device Controller driver" default y depends on SOC_FAMILY_SAM0 - select USB_DEVICE_DRIVER help SAM0 family USB device controller Driver. @@ -43,15 +49,13 @@ config USB_DC_SAM_USBHS bool "SAM series USB HS Device Controller driver" depends on SOC_SERIES_SAME70 || \ SOC_SERIES_SAMV71 - select USB_DEVICE_DRIVER help SAM family USB HS device controller Driver. -menuconfig USB_NRFX +config USB_NRFX bool "Nordic Semiconductor USB Device Controller Driver" default y depends on HAS_HW_NRF_USBD - select USB_DEVICE_DRIVER select NRFX_USBD select NRFX_POWER help @@ -86,33 +90,23 @@ config USB_NRFX_ATTACHED_EVENT_DELAY config USB_KINETIS bool "Kinetis USB Device Controller Driver" - select USB_DEVICE_DRIVER help Kinetis USB Device Controller Driver. config USB_DC_NXP_EHCI bool "Kinetis and RT EHCI USB Device Controller Driver" depends on HAS_MCUX_USB_EHCI - select USB_DEVICE_DRIVER select NOCACHE_MEMORY if HAS_MCUX_CACHE help Kinetis and RT EHCI USB Device Controller Driver. +config USB_NATIVE_POSIX + bool "Native Posix USB Device Controller Driver" + help + Native Posix USB Device Controller Driver. + module = USB_DRIVER module-str = usb driver source "subsys/logging/Kconfig.template.log_config" -config USB_DC_STM32_DISCONN_ENABLE - bool - depends on USB_DC_STM32 - help - Say Y if your board uses USB DISCONNECT pin to enable the - pull-up resistor on USB DP. - -config USB_NATIVE_POSIX - bool "Native Posix USB Device Controller Driver" - select USB_DEVICE_DRIVER - help - Native Posix USB Device Controller Driver. - -endif # USB +endif # USB_DEVICE_DRIVER diff --git a/drivers/usb/device/usb_dc_stm32.c b/drivers/usb/device/usb_dc_stm32.c index c8db1d160a..e76f701990 100644 --- a/drivers/usb/device/usb_dc_stm32.c +++ b/drivers/usb/device/usb_dc_stm32.c @@ -72,7 +72,7 @@ static const struct soc_gpio_pinctrl usb_pinctrl[] = * controller. STM32 F4 and F7 series support USB_OTG_FS device controller. * STM32 F1 and L4 series support either USB or USB_OTG_FS device controller. * - * WARNING: Don't mix USB defined in STM32Cube HAL and CONFIG_USB from Zephyr + * WARNING: Don't mix USB defined in STM32Cube HAL and CONFIG_USB_* from Zephyr * Kconfig system. */ #ifdef USB diff --git a/subsys/CMakeLists.txt b/subsys/CMakeLists.txt index 8b8b2b518e..35f47bfb03 100644 --- a/subsys/CMakeLists.txt +++ b/subsys/CMakeLists.txt @@ -14,7 +14,7 @@ add_subdirectory(ipc) add_subdirectory(mgmt) add_subdirectory_ifdef(CONFIG_MCUBOOT_IMG_MANAGER dfu) add_subdirectory_ifdef(CONFIG_NET_BUF net) -add_subdirectory_ifdef(CONFIG_USB usb) +add_subdirectory_ifdef(CONFIG_USB_DEVICE_STACK usb) add_subdirectory(random) add_subdirectory(storage) add_subdirectory_ifdef(CONFIG_SETTINGS settings) diff --git a/subsys/tracing/Kconfig b/subsys/tracing/Kconfig index 1a1924e5cb..293e4899d0 100644 --- a/subsys/tracing/Kconfig +++ b/subsys/tracing/Kconfig @@ -137,7 +137,7 @@ config TRACING_BACKEND_UART config TRACING_BACKEND_USB bool "Enable USB backend" - depends on USB + depends on USB_DEVICE_STACK depends on TRACING_ASYNC help Use USB to output tracing data. diff --git a/subsys/usb/Kconfig b/subsys/usb/Kconfig index 1c701297c8..1578adf431 100644 --- a/subsys/usb/Kconfig +++ b/subsys/usb/Kconfig @@ -3,9 +3,15 @@ # Copyright (c) 2016 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 +config USB + bool "Enable USB device stack (DEPRECATED)" + select USB_DEVICE_STACK + help + Compatibility option for the external modules. + menuconfig USB_DEVICE_STACK bool "USB Device Support" - depends on USB_DEVICE_DRIVER || ARCH_POSIX + select USB_DEVICE_DRIVER select HWINFO help Enable USB device stack. @@ -52,7 +58,6 @@ config USB_DEVICE_SN config USB_COMPOSITE_DEVICE bool "Enable composite device driver" - depends on USB help Enable composite USB device driver.