Skip to content

Commit dae81c5

Browse files
committed
feat(eth): Add support for LAN867X ETH PHY
1 parent d136bce commit dae81c5

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

idf_component.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ dependencies:
125125
chmorgan/esp-libhelix-mp3:
126126
version: "1.0.3"
127127
require: public
128+
espressif/lan867x:
129+
version: "^2.0.0"
130+
rules:
131+
- if: "target in [esp32, esp32p4]"
128132
examples:
129133
- path: ./idf_component_examples/hello_world
130134
- path: ./idf_component_examples/hw_cdc_hello_world

libraries/Ethernet/src/ETH.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#if defined __has_include && __has_include("soc/emac_ext_struct.h")
3535
#include "soc/emac_ext_struct.h"
3636
#endif /* __has_include("soc/emac_ext_struct.h" */
37+
#if ETH_PHY_LAN867X_SUPPORTED
38+
#include "esp_eth_phy_lan867x.h"
39+
#endif
3740
#include "soc/rtc.h"
3841
#endif /* CONFIG_ETH_USE_ESP32_EMAC */
3942
#include "esp32-hal-periman.h"
@@ -292,6 +295,9 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i
292295
case ETH_PHY_DP83848: _phy = esp_eth_phy_new_dp83848(&phy_config); break;
293296
case ETH_PHY_KSZ8041: _phy = esp_eth_phy_new_ksz80xx(&phy_config); break;
294297
case ETH_PHY_KSZ8081: _phy = esp_eth_phy_new_ksz80xx(&phy_config); break;
298+
#if ETH_PHY_LAN867X_SUPPORTED
299+
case ETH_PHY_LAN867X: _phy = esp_eth_phy_new_lan867x(&phy_config); break;
300+
#endif
295301
default: log_e("Unsupported PHY %d", type); break;
296302
}
297303
if (_phy == NULL) {

libraries/Ethernet/src/ETH.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
#include "esp_netif.h"
7979

8080
#if CONFIG_ETH_USE_ESP32_EMAC
81+
#if defined __has_include && __has_include("esp_eth_phy_lan867x.h")
82+
#define ETH_PHY_LAN867X_SUPPORTED 1
83+
#endif
8184
#define ETH_PHY_IP101 ETH_PHY_TLK110
8285
#if CONFIG_IDF_TARGET_ESP32
8386
typedef enum {
@@ -138,6 +141,9 @@ typedef enum {
138141
ETH_PHY_DP83848,
139142
ETH_PHY_KSZ8041,
140143
ETH_PHY_KSZ8081,
144+
#if ETH_PHY_LAN867X_SUPPORTED
145+
ETH_PHY_LAN867X,
146+
#endif
141147
#endif /* CONFIG_ETH_USE_ESP32_EMAC */
142148
#if CONFIG_ETH_SPI_ETHERNET_DM9051
143149
ETH_PHY_DM9051,

0 commit comments

Comments
 (0)