From abcea5197606396668c1901088f2114719e747cd Mon Sep 17 00:00:00 2001 From: morris Date: Thu, 9 Jul 2020 22:03:11 +0800 Subject: [PATCH] ethernet: insert min assert time for PHY HW reset Closes https://github.com/espressif/esp-idf/issues/5528 --- components/esp_eth/src/esp_eth_phy_dm9051.c | 1 + components/esp_eth/src/esp_eth_phy_dp83848.c | 1 + components/esp_eth/src/esp_eth_phy_ip101.c | 1 + components/esp_eth/src/esp_eth_phy_ksz8041.c | 1 + components/esp_eth/src/esp_eth_phy_lan8720.c | 1 + components/esp_eth/src/esp_eth_phy_rtl8201.c | 1 + 6 files changed, 6 insertions(+) diff --git a/components/esp_eth/src/esp_eth_phy_dm9051.c b/components/esp_eth/src/esp_eth_phy_dm9051.c index bfd93ce6b7..a19c1e69b3 100644 --- a/components/esp_eth/src/esp_eth_phy_dm9051.c +++ b/components/esp_eth/src/esp_eth_phy_dm9051.c @@ -193,6 +193,7 @@ static esp_err_t dm9051_reset_hw(esp_eth_phy_t *phy) esp_rom_gpio_pad_select_gpio(dm9051->reset_gpio_num); gpio_set_direction(dm9051->reset_gpio_num, GPIO_MODE_OUTPUT); gpio_set_level(dm9051->reset_gpio_num, 0); + ets_delay_us(100); // insert min input assert time gpio_set_level(dm9051->reset_gpio_num, 1); } return ESP_OK; diff --git a/components/esp_eth/src/esp_eth_phy_dp83848.c b/components/esp_eth/src/esp_eth_phy_dp83848.c index ce2e96cdd2..c83e50306a 100644 --- a/components/esp_eth/src/esp_eth_phy_dp83848.c +++ b/components/esp_eth/src/esp_eth_phy_dp83848.c @@ -182,6 +182,7 @@ static esp_err_t dp83848_reset_hw(esp_eth_phy_t *phy) esp_rom_gpio_pad_select_gpio(dp83848->reset_gpio_num); gpio_set_direction(dp83848->reset_gpio_num, GPIO_MODE_OUTPUT); gpio_set_level(dp83848->reset_gpio_num, 0); + ets_delay_us(100); // insert min input assert time gpio_set_level(dp83848->reset_gpio_num, 1); } return ESP_OK; diff --git a/components/esp_eth/src/esp_eth_phy_ip101.c b/components/esp_eth/src/esp_eth_phy_ip101.c index e05da282dd..0ab53b893b 100644 --- a/components/esp_eth/src/esp_eth_phy_ip101.c +++ b/components/esp_eth/src/esp_eth_phy_ip101.c @@ -222,6 +222,7 @@ static esp_err_t ip101_reset_hw(esp_eth_phy_t *phy) esp_rom_gpio_pad_select_gpio(ip101->reset_gpio_num); gpio_set_direction(ip101->reset_gpio_num, GPIO_MODE_OUTPUT); gpio_set_level(ip101->reset_gpio_num, 0); + ets_delay_us(100); // insert min input assert time gpio_set_level(ip101->reset_gpio_num, 1); } return ESP_OK; diff --git a/components/esp_eth/src/esp_eth_phy_ksz8041.c b/components/esp_eth/src/esp_eth_phy_ksz8041.c index a421b1ae08..b9a43f09c3 100644 --- a/components/esp_eth/src/esp_eth_phy_ksz8041.c +++ b/components/esp_eth/src/esp_eth_phy_ksz8041.c @@ -170,6 +170,7 @@ static esp_err_t ksz8041_reset_hw(esp_eth_phy_t *phy) esp_rom_gpio_pad_select_gpio(ksz8041->reset_gpio_num); gpio_set_direction(ksz8041->reset_gpio_num, GPIO_MODE_OUTPUT); gpio_set_level(ksz8041->reset_gpio_num, 0); + ets_delay_us(100); // insert min input assert time gpio_set_level(ksz8041->reset_gpio_num, 1); } return ESP_OK; diff --git a/components/esp_eth/src/esp_eth_phy_lan8720.c b/components/esp_eth/src/esp_eth_phy_lan8720.c index 52e27a9c22..3b4b9d50d5 100644 --- a/components/esp_eth/src/esp_eth_phy_lan8720.c +++ b/components/esp_eth/src/esp_eth_phy_lan8720.c @@ -267,6 +267,7 @@ static esp_err_t lan8720_reset_hw(esp_eth_phy_t *phy) esp_rom_gpio_pad_select_gpio(lan8720->reset_gpio_num); gpio_set_direction(lan8720->reset_gpio_num, GPIO_MODE_OUTPUT); gpio_set_level(lan8720->reset_gpio_num, 0); + ets_delay_us(100); // insert min input assert time gpio_set_level(lan8720->reset_gpio_num, 1); } return ESP_OK; diff --git a/components/esp_eth/src/esp_eth_phy_rtl8201.c b/components/esp_eth/src/esp_eth_phy_rtl8201.c index ce613348a6..dd9239d67f 100644 --- a/components/esp_eth/src/esp_eth_phy_rtl8201.c +++ b/components/esp_eth/src/esp_eth_phy_rtl8201.c @@ -176,6 +176,7 @@ static esp_err_t rtl8201_reset_hw(esp_eth_phy_t *phy) esp_rom_gpio_pad_select_gpio(rtl8201->reset_gpio_num); gpio_set_direction(rtl8201->reset_gpio_num, GPIO_MODE_OUTPUT); gpio_set_level(rtl8201->reset_gpio_num, 0); + ets_delay_us(100); // insert min input assert time gpio_set_level(rtl8201->reset_gpio_num, 1); } return ESP_OK;