From 2bb30e64938e9d0fd6db611c95eb13f1691fa9c2 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sun, 24 Dec 2023 02:55:49 +0800 Subject: [PATCH] refactor(usb): Deprecate CONFIG_USB_OTG_SUPPORTED, use SOC_USB_OTG_SUPPORTED instead Previously, USB build dependencies used the CONFIG_USB_OTG_SUPPORTED. However, they could depend on `soc_caps.h` instead. --- components/esp_phy/Kconfig | 2 +- components/usb/CMakeLists.txt | 14 +++++++------- components/usb/Kconfig | 21 +++++++++------------ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index b94aca1cbe..59d7fe783d 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -107,7 +107,7 @@ menu "PHY" config ESP_PHY_ENABLE_USB bool "Enable USB when phy init" - depends on USB_OTG_SUPPORTED || ESP_CONSOLE_USB_SERIAL_JTAG || ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG + depends on SOC_USB_OTG_SUPPORTED || ESP_CONSOLE_USB_SERIAL_JTAG || ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG default y if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 default n help diff --git a/components/usb/CMakeLists.txt b/components/usb/CMakeLists.txt index 84fdacccc9..2b72863a88 100644 --- a/components/usb/CMakeLists.txt +++ b/components/usb/CMakeLists.txt @@ -6,13 +6,13 @@ endif() set(srcs) set(include) -set(priv_include) -# As CONFIG_USB_OTG_SUPPORTED comes from Kconfig, it is not evaluated yet +set(priv_includes) +# As CONFIG_SOC_USB_OTG_SUPPORTED comes from Kconfig, it is not evaluated yet # when components are being registered. # Thus, always add the (private) requirements, regardless of Kconfig -set(priv_require esp_driver_gpio) # usb_phy driver relies on gpio driver API +set(priv_requires esp_driver_gpio) # usb_phy driver relies on gpio driver API -if(CONFIG_USB_OTG_SUPPORTED) +if(CONFIG_SOC_USB_OTG_SUPPORTED) list(APPEND srcs "hcd_dwc.c" "hub.c" "usb_helpers.c" @@ -21,11 +21,11 @@ if(CONFIG_USB_OTG_SUPPORTED) "usbh.c" "usb_phy.c") list(APPEND include "include") - list(APPEND priv_include "private_include") + list(APPEND priv_includes "private_include") endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${include} - PRIV_INCLUDE_DIRS ${priv_include} - PRIV_REQUIRES ${priv_require} + PRIV_INCLUDE_DIRS ${priv_includes} + PRIV_REQUIRES ${priv_requires} ) diff --git a/components/usb/Kconfig b/components/usb/Kconfig index 993d9ccb5f..5e02abe0d8 100644 --- a/components/usb/Kconfig +++ b/components/usb/Kconfig @@ -1,13 +1,7 @@ menu "USB-OTG" - visible if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 - - # Invisible item, enabled when USB_OTG peripheral does exist - config USB_OTG_SUPPORTED - bool - default y if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + depends on SOC_USB_OTG_SUPPORTED config USB_HOST_CONTROL_TRANSFER_MAX_SIZE - depends on USB_OTG_SUPPORTED int "Largest size (in bytes) of transfers to/from default endpoints" default 256 help @@ -18,7 +12,6 @@ menu "USB-OTG" - Device's with configuration descriptors larger than this limit cannot be supported choice USB_HOST_HW_BUFFER_BIAS - depends on USB_OTG_SUPPORTED prompt "Hardware FIFO size biasing" default USB_HOST_HW_BUFFER_BIAS_BALANCED help @@ -56,7 +49,6 @@ menu "USB-OTG" menu "Root Hub configuration" config USB_HOST_DEBOUNCE_DELAY_MS - depends on USB_OTG_SUPPORTED int "Debounce delay in ms" default 250 help @@ -67,7 +59,6 @@ menu "USB-OTG" The default value is set to 250 ms to be safe. config USB_HOST_RESET_HOLD_MS - depends on USB_OTG_SUPPORTED int "Reset hold in ms" default 30 help @@ -79,7 +70,6 @@ menu "USB-OTG" The default value is set to 30 ms to be safe. config USB_HOST_RESET_RECOVERY_MS - depends on USB_OTG_SUPPORTED int "Reset recovery delay in ms" default 30 help @@ -92,7 +82,6 @@ menu "USB-OTG" config USB_HOST_SET_ADDR_RECOVERY_MS - depends on USB_OTG_SUPPORTED int "SetAddress() recovery time in ms" default 10 help @@ -107,4 +96,12 @@ menu "USB-OTG" endmenu #Root Hub configuration + # Hidden or compatibility options + + config USB_OTG_SUPPORTED + # Invisible config kept for compatibility + # Todo: Remove in v6.0 (IDF-8936) + bool + default y + endmenu #USB-OTG