diff --git a/components/esp_eth/include/esp_eth_phy_802_3.h b/components/esp_eth/include/esp_eth_phy_802_3.h index e90646bd37..57a2ff901e 100644 --- a/components/esp_eth/include/esp_eth_phy_802_3.h +++ b/components/esp_eth/include/esp_eth_phy_802_3.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -200,15 +200,14 @@ esp_err_t esp_eth_phy_802_3_deinit(phy_802_3_t *phy_802_3); esp_err_t esp_eth_phy_802_3_del(phy_802_3_t *phy_802_3); /** - * @brief Performs hardware reset with specific reset pin assertion time + * @brief Performs hardware reset with internal timing configuration defined during initialization * * @param phy_802_3 IEEE 802.3 PHY object infostructure - * @param reset_assert_us Hardware reset pin assertion time * @return * - ESP_OK: reset Ethernet PHY successfully * - ESP_ERR_NOT_ALLOWED: reset GPIO not defined */ -esp_err_t esp_eth_phy_802_3_reset_hw(phy_802_3_t *phy_802_3, uint32_t reset_assert_us); +esp_err_t esp_eth_phy_802_3_reset_hw(phy_802_3_t *phy_802_3); /** * @brief Detect PHY address diff --git a/components/esp_eth/src/phy/esp_eth_phy_802_3.c b/components/esp_eth/src/phy/esp_eth_phy_802_3.c index 49a2b55a61..af69afa8f6 100644 --- a/components/esp_eth/src/phy/esp_eth_phy_802_3.c +++ b/components/esp_eth/src/phy/esp_eth_phy_802_3.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,9 +22,6 @@ static const char *TAG = "eth_phy_802_3"; -// TODO: IDF-11362 (should be renamed to esp_eth_phy_802_3_reset_hw with the next major release) -static esp_err_t esp_eth_phy_802_3_reset_hw_internal(phy_802_3_t *phy_802_3); - static esp_err_t set_mediator(esp_eth_phy_t *phy, esp_eth_mediator_t *eth) { phy_802_3_t *phy_802_3 = esp_eth_phy_into_phy_802_3(phy); @@ -40,7 +37,7 @@ static esp_err_t reset(esp_eth_phy_t *phy) static esp_err_t reset_hw(esp_eth_phy_t *phy) { phy_802_3_t *phy_802_3 = esp_eth_phy_into_phy_802_3(phy); - return esp_eth_phy_802_3_reset_hw_internal(phy_802_3); + return esp_eth_phy_802_3_reset_hw(phy_802_3); } static esp_err_t autonego_ctrl(esp_eth_phy_t *phy, eth_phy_autoneg_cmd_t cmd, bool *autonego_en_stat) @@ -438,39 +435,25 @@ esp_err_t esp_eth_phy_802_3_del(phy_802_3_t *phy_802_3) return ESP_OK; } -esp_err_t esp_eth_phy_802_3_reset_hw(phy_802_3_t *phy_802_3, uint32_t reset_assert_us) +esp_err_t esp_eth_phy_802_3_reset_hw(phy_802_3_t *phy_802_3) { + esp_err_t ret = ESP_OK; if (phy_802_3->reset_gpio_num >= 0) { gpio_func_sel(phy_802_3->reset_gpio_num, PIN_FUNC_GPIO); gpio_set_level(phy_802_3->reset_gpio_num, 0); gpio_output_enable(phy_802_3->reset_gpio_num); - if (reset_assert_us < 10000) { - esp_rom_delay_us(reset_assert_us); + if (phy_802_3->hw_reset_assert_time_us < 10000) { + esp_rom_delay_us(phy_802_3->hw_reset_assert_time_us); } else { - vTaskDelay(pdMS_TO_TICKS(reset_assert_us/1000)); + vTaskDelay(pdMS_TO_TICKS(phy_802_3->hw_reset_assert_time_us/1000)); } gpio_set_level(phy_802_3->reset_gpio_num, 1); - return ESP_OK; - } - return ESP_ERR_NOT_ALLOWED; -} - -/** - * @brief Hardware reset with internal timing configuration defined during initialization - * - * @param phy_802_3 IEEE 802.3 PHY object infostructure - * @return - * - ESP_OK: reset Ethernet PHY successfully - * - ESP_ERR_NOT_ALLOWED: reset GPIO not defined - */ -static esp_err_t esp_eth_phy_802_3_reset_hw_internal(phy_802_3_t *phy_802_3) -{ - esp_err_t ret = ESP_OK; - if ((ret = esp_eth_phy_802_3_reset_hw(phy_802_3, phy_802_3->hw_reset_assert_time_us)) == ESP_OK) { if (phy_802_3->post_hw_reset_delay_ms > 0) { vTaskDelay(pdMS_TO_TICKS(phy_802_3->post_hw_reset_delay_ms)); } + return ESP_OK; } + return ret; } diff --git a/docs/en/migration-guides/release-6.x/6.0/index.rst b/docs/en/migration-guides/release-6.x/6.0/index.rst index 8d44ac3fa6..d3bdeb8ffb 100644 --- a/docs/en/migration-guides/release-6.x/6.0/index.rst +++ b/docs/en/migration-guides/release-6.x/6.0/index.rst @@ -8,6 +8,7 @@ Migration from 5.5 to 6.0 :SOC_BT_CLASSIC_SUPPORTED: bluetooth-classic build-system + networking peripherals provisioning protocols diff --git a/docs/en/migration-guides/release-6.x/6.0/networking.rst b/docs/en/migration-guides/release-6.x/6.0/networking.rst new file mode 100644 index 0000000000..7d8b11844a --- /dev/null +++ b/docs/en/migration-guides/release-6.x/6.0/networking.rst @@ -0,0 +1,18 @@ +Networking +=========== + +:link_to_translation:`zh_CN:[中文]` + +Ethernet +******** + +``esp_eth_phy_802_3_reset_hw()`` API Changes +-------------------------------------------- + +This change only applies if you maintain your own Ethernet PHY driver based on :component_file:`esp_eth/src/phy/esp_eth_phy_802_3.c` common functions. The :cpp:func:`esp_eth_phy_802_3_reset_hw` API accepts only one parameter now and resets the Ethernet PHY with internal timing configuration which is defined during initialization. Previously, the API required a ``reset_assert_us`` parameter to specify the reset pin assertion time. This parameter has been removed. + +Usage example: + +.. code-block:: c + + esp_eth_phy_802_3_reset_hw(phy_802_3); diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst index f0c59a265a..28a7207af2 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst @@ -8,6 +8,7 @@ :SOC_BT_CLASSIC_SUPPORTED: bluetooth-classic build-system + networking peripherals provisioning protocols diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/networking.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/networking.rst new file mode 100644 index 0000000000..5531f3e7d6 --- /dev/null +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/networking.rst @@ -0,0 +1,18 @@ +网络 +===== + +:link_to_translation:`en:[English]` + +以太网 +****** + +``esp_eth_phy_802_3_reset_hw()`` API 变更 +------------------------------------------ + +此变更仅适用于维护自己的以太网 PHY 驱动程序,该驱动程序基于 :component_file:`esp_eth/src/phy/esp_eth_phy_802_3.c` 通用函数。现在 :cpp:func:`esp_eth_phy_802_3_reset_hw` API 仅接受一个参数,并使用初始化期间定义的内部时序配置重置以太网 PHY。以前,该 API 需要一个 ``reset_assert_us`` 参数来指定复位引脚断言时间。此参数已删除。 + +使用示例: + +.. code-block:: c + + esp_eth_phy_802_3_reset_hw(phy_802_3);