Explorar o código

fix(phy): Fix PHY enabled enter WiFi RX state default

alanmaxwell %!s(int64=2) %!d(string=hai) anos
pai
achega
503299fb32

+ 29 - 0
components/esp_phy/include/esp_phy_init.h

@@ -269,6 +269,35 @@ esp_err_t esp_phy_apply_phy_init_data(uint8_t *init_data);
  */
 char * get_phy_version_str(void);
 
+/**
+ * @brief Enable phy track pll
+ *
+ */
+void phy_track_pll_init(void);
+
+/**
+ * @brief Disable phy track pll
+ *
+ */
+void phy_track_pll_deinit(void);
+
+/**
+ * @brief Set PHY init parameters
+ * @param param is 1 means combo module
+ */
+void phy_init_param_set(uint8_t param);
+
+/**
+ * @brief Wi-Fi RX enable
+ */
+void phy_wifi_enable_set(uint8_t enable);
+
+/**
+  * @brief PHY temperature track
+  */
+void phy_param_track_tot(bool en_wifi, bool en_bt_154);
+
+
 #ifdef __cplusplus
 }
 #endif

+ 7 - 0
components/esp_phy/src/phy_init.c

@@ -773,6 +773,13 @@ void esp_phy_load_cal_and_init(void)
 #if CONFIG_IDF_TARGET_ESP32S2
     phy_eco_version_sel(efuse_hal_chip_revision() / 100);
 #endif
+
+    // Set PHY whether in combo module
+    // For comode mode, phy enable will be not in WiFi RX state
+#if SOC_PHY_COMBO_MODULE
+    phy_init_param_set(1);
+#endif
+
     esp_phy_calibration_data_t* cal_data =
             (esp_phy_calibration_data_t*) calloc(sizeof(esp_phy_calibration_data_t), 1);
     if (cal_data == NULL) {

+ 12 - 2
components/esp_wifi/esp32/esp_adapter.c

@@ -547,6 +547,16 @@ static void IRAM_ATTR esp_empty_wrapper(void)
 
 }
 
+static void esp_phy_enable_wrapper(void)
+{
+    esp_phy_enable(PHY_MODEM_WIFI);
+}
+
+static void esp_phy_disable_wrapper(void)
+{
+    esp_phy_disable(PHY_MODEM_WIFI);
+}
+
 wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._version = ESP_WIFI_OS_ADAPTER_VERSION,
     ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
@@ -600,8 +610,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._dport_access_stall_other_cpu_end_wrap = s_esp_dport_access_stall_other_cpu_end,
     ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
     ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
-    ._phy_disable = esp_phy_disable,
-    ._phy_enable = esp_phy_enable,
+    ._phy_disable = esp_phy_disable_wrapper,
+    ._phy_enable = esp_phy_enable_wrapper,
     ._phy_common_clock_enable = esp_phy_common_clock_enable,
     ._phy_common_clock_disable = esp_phy_common_clock_disable,
     ._phy_update_country_info = esp_phy_update_country_info,

+ 14 - 2
components/esp_wifi/esp32c2/esp_adapter.c

@@ -517,6 +517,18 @@ static void IRAM_ATTR esp_empty_wrapper(void)
 
 }
 
+static void esp_phy_enable_wrapper(void)
+{
+    esp_phy_enable(PHY_MODEM_WIFI);
+    phy_wifi_enable_set(1);
+}
+
+static void esp_phy_disable_wrapper(void)
+{
+    phy_wifi_enable_set(0);
+    esp_phy_disable(PHY_MODEM_WIFI);
+}
+
 wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._version = ESP_WIFI_OS_ADAPTER_VERSION,
     ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
@@ -570,8 +582,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper,
     ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
     ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
-    ._phy_disable = esp_phy_disable,
-    ._phy_enable = esp_phy_enable,
+    ._phy_disable = esp_phy_disable_wrapper,
+    ._phy_enable = esp_phy_enable_wrapper,
     ._phy_update_country_info = esp_phy_update_country_info,
     ._read_mac = esp_read_mac_wrapper,
     ._timer_arm = timer_arm_wrapper,

+ 14 - 2
components/esp_wifi/esp32c3/esp_adapter.c

@@ -534,6 +534,18 @@ static void IRAM_ATTR esp_empty_wrapper(void)
 
 }
 
+static void esp_phy_enable_wrapper(void)
+{
+    esp_phy_enable(PHY_MODEM_WIFI);
+    phy_wifi_enable_set(1);
+}
+
+static void esp_phy_disable_wrapper(void)
+{
+    phy_wifi_enable_set(0);
+    esp_phy_disable(PHY_MODEM_WIFI);
+}
+
 wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._version = ESP_WIFI_OS_ADAPTER_VERSION,
     ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
@@ -587,8 +599,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper,
     ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
     ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
-    ._phy_disable = esp_phy_disable,
-    ._phy_enable = esp_phy_enable,
+    ._phy_disable = esp_phy_disable_wrapper,
+    ._phy_enable = esp_phy_enable_wrapper,
     ._phy_update_country_info = esp_phy_update_country_info,
     ._read_mac = esp_read_mac_wrapper,
     ._timer_arm = timer_arm_wrapper,

+ 14 - 2
components/esp_wifi/esp32c6/esp_adapter.c

@@ -523,6 +523,18 @@ static void IRAM_ATTR esp_empty_wrapper(void)
 
 }
 
+static void esp_phy_enable_wrapper(void)
+{
+    esp_phy_enable(PHY_MODEM_WIFI);
+    phy_wifi_enable_set(1);
+}
+
+static void esp_phy_disable_wrapper(void)
+{
+    phy_wifi_enable_set(0);
+    esp_phy_disable(PHY_MODEM_WIFI);
+}
+
 wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._version = ESP_WIFI_OS_ADAPTER_VERSION,
     ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
@@ -576,8 +588,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper,
     ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
     ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
-    ._phy_disable = esp_phy_disable,
-    ._phy_enable = esp_phy_enable,
+    ._phy_disable = esp_phy_disable_wrapper,
+    ._phy_enable = esp_phy_enable_wrapper,
     ._phy_update_country_info = esp_phy_update_country_info,
     ._read_mac = esp_read_mac_wrapper,
     ._timer_arm = timer_arm_wrapper,

+ 12 - 2
components/esp_wifi/esp32s2/esp_adapter.c

@@ -542,6 +542,16 @@ static void IRAM_ATTR esp_empty_wrapper(void)
 
 }
 
+static void esp_phy_enable_wrapper(void)
+{
+    esp_phy_enable(PHY_MODEM_WIFI);
+}
+
+static void esp_phy_disable_wrapper(void)
+{
+    esp_phy_disable(PHY_MODEM_WIFI);
+}
+
 wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._version = ESP_WIFI_OS_ADAPTER_VERSION,
     ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
@@ -595,8 +605,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper,
     ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
     ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
-    ._phy_disable = esp_phy_disable,
-    ._phy_enable = esp_phy_enable,
+    ._phy_disable = esp_phy_disable_wrapper,
+    ._phy_enable = esp_phy_enable_wrapper,
     ._phy_common_clock_enable = esp_phy_common_clock_enable,
     ._phy_common_clock_disable = esp_phy_common_clock_disable,
     ._phy_update_country_info = esp_phy_update_country_info,

+ 15 - 2
components/esp_wifi/esp32s3/esp_adapter.c

@@ -559,6 +559,19 @@ static void IRAM_ATTR esp_empty_wrapper(void)
 
 }
 
+
+static void esp_phy_enable_wrapper(void)
+{
+    esp_phy_enable(PHY_MODEM_WIFI);
+    phy_wifi_enable_set(1);
+}
+
+static void esp_phy_disable_wrapper(void)
+{
+    phy_wifi_enable_set(0);
+    esp_phy_disable(PHY_MODEM_WIFI);
+}
+
 wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._version = ESP_WIFI_OS_ADAPTER_VERSION,
     ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
@@ -612,8 +625,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper,
     ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
     ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
-    ._phy_disable = esp_phy_disable,
-    ._phy_enable = esp_phy_enable,
+    ._phy_disable = esp_phy_disable_wrapper,
+    ._phy_enable = esp_phy_enable_wrapper,
     ._phy_update_country_info = esp_phy_update_country_info,
     ._read_mac = esp_read_mac,
     ._timer_arm = timer_arm_wrapper,

+ 4 - 0
components/soc/esp32/include/soc/Kconfig.soc_caps.in

@@ -894,3 +894,7 @@ config SOC_BLUFI_SUPPORTED
 config SOC_ULP_HAS_ADC
     bool
     default y
+
+config SOC_PHY_COMBO_MODULE
+    bool
+    default y

+ 3 - 0
components/soc/esp32/include/soc/soc_caps.h

@@ -435,3 +435,6 @@
 
 /*-------------------------- ULP CAPS ----------------------------------------*/
 #define SOC_ULP_HAS_ADC                     (1)    /* ADC can be accessed from ULP */
+
+/*------------------------------------- PHY CAPS -------------------------------------*/
+#define SOC_PHY_COMBO_MODULE                  (1) /*!< Support Wi-Fi, BT and BLE*/

+ 4 - 0
components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

@@ -710,3 +710,7 @@ config SOC_BLUFI_SUPPORTED
 config SOC_PHY_IMPROVE_RX_11B
     bool
     default y
+
+config SOC_PHY_COMBO_MODULE
+    bool
+    default y

+ 1 - 0
components/soc/esp32c2/include/soc/soc_caps.h

@@ -330,3 +330,4 @@
 
 /*------------------------------------- PHY CAPS -------------------------------------*/
 #define SOC_PHY_IMPROVE_RX_11B              (1)
+#define SOC_PHY_COMBO_MODULE                  (1) /*!< Support Wi-Fi and BLE*/

+ 4 - 0
components/soc/esp32c3/include/soc/Kconfig.soc_caps.in

@@ -1026,3 +1026,7 @@ config SOC_BLE_DEVICE_PRIVACY_SUPPORTED
 config SOC_BLUFI_SUPPORTED
     bool
     default y
+
+config SOC_PHY_COMBO_MODULE
+    bool
+    default y

+ 3 - 0
components/soc/esp32c3/include/soc/soc_caps.h

@@ -442,3 +442,6 @@
 #define SOC_BLE_50_SUPPORTED            (1)    /*!< Support Bluetooth 5.0 */
 #define SOC_BLE_DEVICE_PRIVACY_SUPPORTED (1)   /*!< Support BLE device privacy mode */
 #define SOC_BLUFI_SUPPORTED             (1)    /*!< Support BLUFI */
+
+/*------------------------------------- PHY CAPS -------------------------------------*/
+#define SOC_PHY_COMBO_MODULE                  (1) /*!< Support Wi-Fi and BLE*/

+ 4 - 0
components/soc/esp32c6/include/soc/Kconfig.soc_caps.in

@@ -1346,3 +1346,7 @@ config SOC_BLE_MULTI_CONN_OPTIMIZATION
 config SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
     bool
     default y
+
+config SOC_PHY_COMBO_MODULE
+    bool
+    default y

+ 3 - 0
components/soc/esp32c6/include/soc/soc_caps.h

@@ -550,3 +550,6 @@
 #define SOC_BLE_MULTI_CONN_OPTIMIZATION (1)    /*!< Support multiple connections optimization */
 
 #define SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND (1)
+
+/*------------------------------------- PHY CAPS -------------------------------------*/
+#define SOC_PHY_COMBO_MODULE                  (1) /*!< Support Wi-Fi, BLE and 15.4*/

+ 4 - 0
components/soc/esp32s2/include/soc/Kconfig.soc_caps.in

@@ -1114,3 +1114,7 @@ config SOC_WIFI_NAN_SUPPORT
 config SOC_ULP_HAS_ADC
     bool
     default y
+
+config SOC_PHY_COMBO_MODULE
+    bool
+    default n

+ 3 - 0
components/soc/esp32s2/include/soc/soc_caps.h

@@ -480,3 +480,6 @@
 #define SOC_WIFI_NAN_SUPPORT                (1)    /*!< Support WIFI Aware (NAN) */
 /*-------------------------- ULP CAPS ----------------------------------------*/
 #define SOC_ULP_HAS_ADC                     (1)    /* ADC can be accessed from ULP */
+
+/*------------------------------------- PHY CAPS -------------------------------------*/
+#define SOC_PHY_COMBO_MODULE                  (0) /*!< Only support Wi-Fi*/

+ 4 - 0
components/soc/esp32s3/include/soc/Kconfig.soc_caps.in

@@ -1322,3 +1322,7 @@ config SOC_BLUFI_SUPPORTED
 config SOC_ULP_HAS_ADC
     bool
     default y
+
+config SOC_PHY_COMBO_MODULE
+    bool
+    default y

+ 3 - 0
components/soc/esp32s3/include/soc/soc_caps.h

@@ -532,3 +532,6 @@
 
 /*-------------------------- ULP CAPS ----------------------------------------*/
 #define SOC_ULP_HAS_ADC                     (1)    /* ADC can be accessed from ULP */
+
+/*------------------------------------- PHY CAPS -------------------------------------*/
+#define SOC_PHY_COMBO_MODULE                  (1) /*!< Support Wi-Fi and BLE*/