From 970986e5b6800a1fa69f7b9e05955a0b0a89659d Mon Sep 17 00:00:00 2001 From: Ondrej Kosta Date: Fri, 19 Nov 2021 13:31:12 +0100 Subject: [PATCH] Added KSZ8041/81 and LAN8720 Driver IDF v5.0 migration description LAN8720 function call clean up --- components/esp_eth/include/esp_eth_phy.h | 16 ---------------- .../esp_eth/test_apps/main/Kconfig.projbuild | 2 +- components/esp_eth/test_apps/main/esp_eth_test.c | 16 ++++++++-------- .../esp_eth/test_apps/sdkconfig.ci.lan8720 | 2 +- docs/en/migration-guides/ethernet.rst | 10 ++++++++++ 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/components/esp_eth/include/esp_eth_phy.h b/components/esp_eth/include/esp_eth_phy.h index cb6524dd9d..6e55d33b19 100644 --- a/components/esp_eth/include/esp_eth_phy.h +++ b/components/esp_eth/include/esp_eth_phy.h @@ -294,22 +294,6 @@ esp_eth_phy_t *esp_eth_phy_new_rtl8201(const eth_phy_config_t *config); */ esp_eth_phy_t *esp_eth_phy_new_lan87xx(const eth_phy_config_t *config); -/** -* @brief Create a PHY instance of LAN8720 -* -* @note For ESP-IDF backwards compatibility reasons. In all other cases, use esp_eth_phy_new_lan87xx instead. -* -* @param[in] config: configuration of PHY -* -* @return -* - instance: create PHY instance successfully -* - NULL: create PHY instance failed because some error occurred -*/ -static inline esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *config) -{ - return esp_eth_phy_new_lan87xx(config); -} - /** * @brief Create a PHY instance of DP83848 * diff --git a/components/esp_eth/test_apps/main/Kconfig.projbuild b/components/esp_eth/test_apps/main/Kconfig.projbuild index c10b08d3e0..b5b4cfabaa 100644 --- a/components/esp_eth/test_apps/main/Kconfig.projbuild +++ b/components/esp_eth/test_apps/main/Kconfig.projbuild @@ -8,7 +8,7 @@ menu "esp_eth TEST_APPS Configuration" config TARGET_ETH_PHY_DEVICE_IP101 bool "IP101" - config TARGET_ETH_PHY_DEVICE_LAN8720 + config TARGET_ETH_PHY_DEVICE_LAN87XX bool "LAN8720" endchoice endmenu diff --git a/components/esp_eth/test_apps/main/esp_eth_test.c b/components/esp_eth/test_apps/main/esp_eth_test.c index 2ed5a685f2..b934b51b59 100644 --- a/components/esp_eth/test_apps/main/esp_eth_test.c +++ b/components/esp_eth/test_apps/main/esp_eth_test.c @@ -53,8 +53,8 @@ TEST_CASE("start_and_stop", "[esp_eth]") eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration #if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101) esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); // create PHY instance -#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN8720) - esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config); +#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN87XX) + esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config); #endif TEST_ASSERT_NOT_NULL(phy); esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); // apply default driver configuration @@ -104,8 +104,8 @@ TEST_CASE("get_set_mac", "[esp_eth]") eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration #if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101) esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); // create PHY instance -#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN8720) - esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config); +#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN87XX) + esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config); #endif TEST_ASSERT_NOT_NULL(phy); esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); // apply default driver configuration @@ -157,8 +157,8 @@ TEST_CASE("ethernet_broadcast_transmit", "[esp_eth]") eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration #if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101) esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); // create PHY instance -#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN8720) - esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config); +#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN87XX) + esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config); #endif TEST_ASSERT_NOT_NULL(phy); esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); // apply default driver configuration @@ -227,8 +227,8 @@ TEST_CASE("recv_pkt", "[esp_eth]") eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration #if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101) esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); // create PHY instance -#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN8720) - esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config); +#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN87XX) + esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config); #endif TEST_ASSERT_NOT_NULL(phy); esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); // apply default driver configuration diff --git a/components/esp_eth/test_apps/sdkconfig.ci.lan8720 b/components/esp_eth/test_apps/sdkconfig.ci.lan8720 index a130a815fb..a061347db0 100644 --- a/components/esp_eth/test_apps/sdkconfig.ci.lan8720 +++ b/components/esp_eth/test_apps/sdkconfig.ci.lan8720 @@ -4,6 +4,6 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ESP_TASK_WDT=n -CONFIG_TARGET_ETH_PHY_DEVICE_LAN8720=y +CONFIG_TARGET_ETH_PHY_DEVICE_LAN87XX=y CONFIG_ETH_RMII_CLK_OUTPUT=y CONFIG_ETH_RMII_CLK_OUT_GPIO=17 diff --git a/docs/en/migration-guides/ethernet.rst b/docs/en/migration-guides/ethernet.rst index 36ee9c7749..200840bc19 100644 --- a/docs/en/migration-guides/ethernet.rst +++ b/docs/en/migration-guides/ethernet.rst @@ -31,3 +31,13 @@ Usage example to get Ethernet configuration: eth_duplex_t duplex_mode; esp_eth_ioctl(eth_handle, ETH_CMD_G_DUPLEX_MODE, &duplex_mode); + + +KSZ8041/81 and LAN8720 Driver Update +------------------------------------ +KSZ8041/81 and LAN8720 Drivers were updated to support more devices (generations) from associated product family. The drivers are able to recognize particular chip number and its potential support by the driver. + +As a result, the specific "chip number" functions calls were replaced by generic ones as follows: + +* :cpp:func:`esp_eth_phy_new_ksz8041` and :cpp:func:`esp_eth_phy_new_ksz8081` were removed, use :cpp:func:`esp_eth_phy_new_ksz80xx` instead +* :cpp:func:`esp_eth_phy_new_lan8720` was removed, use :cpp:func:`esp_eth_phy_new_lan87xx` instead \ No newline at end of file