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.
This commit is contained in:
Darian Leung 2023-12-24 02:55:49 +08:00
parent d837836f84
commit 2ba1790ef6
No known key found for this signature in database
GPG Key ID: 8AC9127B487AA4EF
3 changed files with 17 additions and 20 deletions

View File

@ -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

View File

@ -1,12 +1,12 @@
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 driver) # usb_phy driver relies on gpio driver API
set(priv_requires driver) # 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"
@ -15,11 +15,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}
)

View File

@ -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