diff --git a/esphome/components/ethernet/__init__.py b/esphome/components/ethernet/__init__.py index 6f0f3741dd52..f43abaf0d2dd 100644 --- a/esphome/components/ethernet/__init__.py +++ b/esphome/components/ethernet/__init__.py @@ -36,6 +36,7 @@ "JL1101": EthernetType.ETHERNET_TYPE_JL1101, "KSZ8081": EthernetType.ETHERNET_TYPE_KSZ8081, "KSZ8081RNA": EthernetType.ETHERNET_TYPE_KSZ8081RNA, + "LAN867X": EthernetType.ETHERNET_TYPE_LAN867X, } emac_rmii_clock_mode_t = cg.global_ns.enum("emac_rmii_clock_mode_t") diff --git a/esphome/components/ethernet/ethernet_component.cpp b/esphome/components/ethernet/ethernet_component.cpp index 50d5855e6a0b..f46fa3897219 100644 --- a/esphome/components/ethernet/ethernet_component.cpp +++ b/esphome/components/ethernet/ethernet_component.cpp @@ -69,6 +69,12 @@ void EthernetComponent::setup() { this->phy_ = esp_eth_phy_new_lan87xx(&phy_config); break; } +#if ESP_IDF_VERSION_MAJOR >= 5 + case ETHERNET_TYPE_LAN867X: { + this->phy_ = esp_eth_phy_new_lan867x(&phy_config); + break; + } +#endif case ETHERNET_TYPE_RTL8201: { this->phy_ = esp_eth_phy_new_rtl8201(&phy_config); break; @@ -102,6 +108,8 @@ void EthernetComponent::setup() { esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, this->phy_); this->eth_handle_ = nullptr; + + ESP_LOGCONFIG(TAG, "Setting up Ethernet... pre install driver"); err = esp_eth_driver_install(ð_config, &this->eth_handle_); ESPHL_ERROR_CHECK(err, "ETH driver install error"); @@ -190,6 +198,12 @@ void EthernetComponent::dump_config() { eth_type = "LAN8720"; break; +#if ESP_IDF_VERSION_MAJOR >= 5 + case ETHERNET_TYPE_LAN867X: + eth_type = "LAN867X"; + break; +#endif + case ETHERNET_TYPE_RTL8201: eth_type = "RTL8201"; break; diff --git a/esphome/components/ethernet/ethernet_component.h b/esphome/components/ethernet/ethernet_component.h index 11f50af966f0..0cc8878fecee 100644 --- a/esphome/components/ethernet/ethernet_component.h +++ b/esphome/components/ethernet/ethernet_component.h @@ -23,6 +23,9 @@ enum EthernetType { ETHERNET_TYPE_JL1101, ETHERNET_TYPE_KSZ8081, ETHERNET_TYPE_KSZ8081RNA, +#if ESP_IDF_VERSION_MAJOR >= 5 + ETHERNET_TYPE_LAN867X, +#endif }; struct ManualIP { @@ -102,6 +105,10 @@ class EthernetComponent : public Component { extern EthernetComponent *global_eth_component; extern "C" esp_eth_phy_t *esp_eth_phy_new_jl1101(const eth_phy_config_t *config); +#if ESP_IDF_VERSION_MAJOR >= 5 +extern "C" esp_eth_phy_t *esp_eth_phy_new_lan867x(const eth_phy_config_t *config); +#endif + } // namespace ethernet } // namespace esphome