From bf523af21d89577ec5c95335ce7a3bc1ba61886c Mon Sep 17 00:00:00 2001 From: Cao Sen Miao Date: Wed, 22 Dec 2021 12:44:00 +0800 Subject: [PATCH 1/2] usb_serial_jtag: can print when wifi enabled by default Closes https://github.com/espressif/esp-idf/issues/8131 --- components/esp_phy/Kconfig | 4 ++-- components/esp_phy/src/phy_init.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index 3b57d38f21..89e4ea4cae 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -106,11 +106,11 @@ menu "PHY" config ESP_PHY_ENABLE_USB bool "Enable USB when phy init" - depends on USB_OTG_SUPPORTED || ESP_CONSOLE_USB_SERIAL_JTAG + depends on 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 When using USB Serial/JTAG/OTG/CDC, PHY should enable USB, otherwise USB module - can not work properly. + can not work properly. Notice: Enabling this configuration option will slightly impact wifi performance. endmenu # PHY diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 449160f165..846197d531 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -29,6 +29,10 @@ #include "esp_rom_crc.h" #include "esp_rom_sys.h" +#if CONFIG_ESP_PHY_ENABLE_USB +#include "hal/usb_serial_jtag_ll.h" +#endif + #include "soc/rtc_cntl_reg.h" #if CONFIG_IDF_TARGET_ESP32C3 #include "soc/syscon_reg.h" @@ -656,7 +660,13 @@ void esp_phy_load_cal_and_init(void) #endif #if CONFIG_ESP_PHY_ENABLE_USB - phy_bbpll_en_usb(true); +#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG + if (usb_serial_jtag_ll_txfifo_writable() == 1) +#endif // Only check usb_jtag status with usb_jtag related config options enabled. + { + // If the USB_SEIRAL_JTAG is really in use. + phy_bbpll_en_usb(true); + } #endif #ifdef CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE From 93be7d5192a33df8bc97c5ebc6cb3b06b054a213 Mon Sep 17 00:00:00 2001 From: Cao Sen Miao Date: Wed, 19 Jan 2022 18:58:38 +0800 Subject: [PATCH 2/2] usb_serial_jtag: remove the strict condition check in esp_phy --- components/esp_phy/src/phy_init.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 846197d531..449160f165 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -29,10 +29,6 @@ #include "esp_rom_crc.h" #include "esp_rom_sys.h" -#if CONFIG_ESP_PHY_ENABLE_USB -#include "hal/usb_serial_jtag_ll.h" -#endif - #include "soc/rtc_cntl_reg.h" #if CONFIG_IDF_TARGET_ESP32C3 #include "soc/syscon_reg.h" @@ -660,13 +656,7 @@ void esp_phy_load_cal_and_init(void) #endif #if CONFIG_ESP_PHY_ENABLE_USB -#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG - if (usb_serial_jtag_ll_txfifo_writable() == 1) -#endif // Only check usb_jtag status with usb_jtag related config options enabled. - { - // If the USB_SEIRAL_JTAG is really in use. - phy_bbpll_en_usb(true); - } + phy_bbpll_en_usb(true); #endif #ifdef CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE