Browse Source

esp32/network_lan: Add support for LAN8710 PHY.

LAN8710 uses the same drivers as LAN8720, so this commit just adds the
names.  Alternatively, both could be summarised under LAN87xx, like the
esp-idf does.
pull/10329/head
robert-hh 2 years ago
committed by Damien George
parent
commit
efb4bd3555
  1. 1
      ports/esp32/modnetwork.c
  2. 2
      ports/esp32/modnetwork.h
  3. 4
      ports/esp32/network_lan.c

1
ports/esp32/modnetwork.c

@ -261,6 +261,7 @@ STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
#endif
#if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 1) && (CONFIG_IDF_TARGET_ESP32)
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8710), MP_ROM_INT(PHY_LAN8710) },
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8720), MP_ROM_INT(PHY_LAN8720) },
{ MP_ROM_QSTR(MP_QSTR_PHY_IP101), MP_ROM_INT(PHY_IP101) },
{ MP_ROM_QSTR(MP_QSTR_PHY_RTL8201), MP_ROM_INT(PHY_RTL8201) },

2
ports/esp32/modnetwork.h

@ -28,7 +28,7 @@
#include "esp_event.h"
enum { PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
enum { PHY_LAN8710, PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
enum { ETH_INITIALIZED, ETH_STARTED, ETH_STOPPED, ETH_CONNECTED, ETH_DISCONNECTED, ETH_GOT_IP };
// Cases similar to ESP8266 user_interface.h

4
ports/esp32/network_lan.c

@ -125,7 +125,8 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
}
self->phy_addr = args[ARG_phy_addr].u_int;
if (args[ARG_phy_type].u_int != PHY_LAN8720 &&
if (args[ARG_phy_type].u_int != PHY_LAN8710 &&
args[ARG_phy_type].u_int != PHY_LAN8720 &&
args[ARG_phy_type].u_int != PHY_IP101 &&
args[ARG_phy_type].u_int != PHY_RTL8201 &&
#if ESP_IDF_VERSION_MINOR >= 3 // KSZ8041 is new in ESP-IDF v4.3
@ -146,6 +147,7 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
self->phy = NULL;
switch (args[ARG_phy_type].u_int) {
case PHY_LAN8710:
case PHY_LAN8720:
self->phy = esp_eth_phy_new_lan8720(&phy_config);
break;

Loading…
Cancel
Save