mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
Merge branch 'feat/phy802_rst' into 'master'
feat(esp_eth): changed ETH PHY API of esp_eth_phy_802_3_reset_hw Closes IDF-11362 See merge request espressif/esp-idf!41759
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,7 @@ Migration from 5.5 to 6.0
|
||||
|
||||
:SOC_BT_CLASSIC_SUPPORTED: bluetooth-classic
|
||||
build-system
|
||||
networking
|
||||
peripherals
|
||||
provisioning
|
||||
protocols
|
||||
|
18
docs/en/migration-guides/release-6.x/6.0/networking.rst
Normal file
18
docs/en/migration-guides/release-6.x/6.0/networking.rst
Normal file
@@ -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);
|
@@ -8,6 +8,7 @@
|
||||
|
||||
:SOC_BT_CLASSIC_SUPPORTED: bluetooth-classic
|
||||
build-system
|
||||
networking
|
||||
peripherals
|
||||
provisioning
|
||||
protocols
|
||||
|
18
docs/zh_CN/migration-guides/release-6.x/6.0/networking.rst
Normal file
18
docs/zh_CN/migration-guides/release-6.x/6.0/networking.rst
Normal file
@@ -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);
|
Reference in New Issue
Block a user