Skip to content

Commit d36a830

Browse files
committed
Add support for the Microchip LAN8742 Ethernet PHY chip and increase
stack size for the emac_rx task.
1 parent 9fc92ba commit d36a830

File tree

10 files changed

+77
-5
lines changed

10 files changed

+77
-5
lines changed

libraries/Ethernet/src/ETH.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "eth_phy/phy.h"
4040
#include "eth_phy/phy_tlk110.h"
4141
#include "eth_phy/phy_lan8720.h"
42+
#include "eth_phy/phy_lan8742.h"
4243
#endif
4344
#include "lwip/err.h"
4445
#include "lwip/dns.h"
@@ -280,6 +281,9 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
280281
case ETH_PHY_LAN8720:
281282
eth_phy = esp_eth_phy_new_lan8720(&phy_config);
282283
break;
284+
case ETH_PHY_LAN8742:
285+
eth_phy = esp_eth_phy_new_lan8742(&phy_config);
286+
break;
283287
case ETH_PHY_TLK110:
284288
eth_phy = esp_eth_phy_new_ip101(&phy_config);
285289
break;
@@ -356,6 +360,9 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
356360
if(type == ETH_PHY_LAN8720){
357361
eth_config_t config = phy_lan8720_default_ethernet_config;
358362
memcpy(&eth_config, &config, sizeof(eth_config_t));
363+
} else if(type == ETH_PHY_LAN8742){
364+
eth_config_t config = phy_lan8742_default_ethernet_config;
365+
memcpy(&eth_config, &config, sizeof(eth_config_t));
359366
} else if(type == ETH_PHY_TLK110){
360367
eth_config_t config = phy_tlk110_default_ethernet_config;
361368
memcpy(&eth_config, &config, sizeof(eth_config_t));

libraries/Ethernet/src/ETH.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
typedef enum { ETH_CLOCK_GPIO0_IN, ETH_CLOCK_GPIO0_OUT, ETH_CLOCK_GPIO16_OUT, ETH_CLOCK_GPIO17_OUT } eth_clock_mode_t;
5757
#endif
5858

59-
typedef enum { ETH_PHY_LAN8720, ETH_PHY_TLK110, ETH_PHY_RTL8201, ETH_PHY_DP83848, ETH_PHY_DM9051, ETH_PHY_KSZ8041, ETH_PHY_KSZ8081, ETH_PHY_MAX } eth_phy_type_t;
59+
typedef enum { ETH_PHY_LAN8720, ETH_PHY_LAN8742, ETH_PHY_TLK110, ETH_PHY_RTL8201, ETH_PHY_DP83848, ETH_PHY_DM9051, ETH_PHY_KSZ8041, ETH_PHY_KSZ8081, ETH_PHY_MAX } eth_phy_type_t;
6060
#define ETH_PHY_IP101 ETH_PHY_TLK110
6161

6262
class ETHClass {

tools/sdk/esp32/include/esp_eth/include/esp_eth_mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ typedef struct {
391391
#define ETH_MAC_DEFAULT_CONFIG() \
392392
{ \
393393
.sw_reset_timeout_ms = 100, \
394-
.rx_task_stack_size = 2048, \
394+
.rx_task_stack_size = 4096, \
395395
.rx_task_prio = 15, \
396396
.smi_mdc_gpio_num = 23, \
397397
.smi_mdio_gpio_num = 18, \

tools/sdk/esp32/include/esp_eth/include/esp_eth_phy.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ static inline esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *con
271271
return esp_eth_phy_new_lan87xx(config);
272272
}
273273

274+
/**
275+
* @brief Create a PHY instance of LAN8742
276+
*
277+
* @note For ESP-IDF backwards compatibility reasons. In all other cases, use esp_eth_phy_new_lan87xx instead.
278+
*
279+
* @param[in] config: configuration of PHY
280+
*
281+
* @return
282+
* - instance: create PHY instance successfully
283+
* - NULL: create PHY instance failed because some error occurred
284+
*/
285+
static inline esp_eth_phy_t *esp_eth_phy_new_lan8742(const eth_phy_config_t *config)
286+
{
287+
return esp_eth_phy_new_lan87xx(config);
288+
}
289+
274290
/**
275291
* @brief Create a PHY instance of DP83848
276292
*

tools/sdk/esp32c3/include/esp_eth/include/esp_eth_mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ typedef struct {
391391
#define ETH_MAC_DEFAULT_CONFIG() \
392392
{ \
393393
.sw_reset_timeout_ms = 100, \
394-
.rx_task_stack_size = 2048, \
394+
.rx_task_stack_size = 4096, \
395395
.rx_task_prio = 15, \
396396
.smi_mdc_gpio_num = 23, \
397397
.smi_mdio_gpio_num = 18, \

tools/sdk/esp32c3/include/esp_eth/include/esp_eth_phy.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ static inline esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *con
271271
return esp_eth_phy_new_lan87xx(config);
272272
}
273273

274+
/**
275+
* @brief Create a PHY instance of LAN8742
276+
*
277+
* @note For ESP-IDF backwards compatibility reasons. In all other cases, use esp_eth_phy_new_lan87xx instead.
278+
*
279+
* @param[in] config: configuration of PHY
280+
*
281+
* @return
282+
* - instance: create PHY instance successfully
283+
* - NULL: create PHY instance failed because some error occurred
284+
*/
285+
static inline esp_eth_phy_t *esp_eth_phy_new_lan8742(const eth_phy_config_t *config)
286+
{
287+
return esp_eth_phy_new_lan87xx(config);
288+
}
289+
274290
/**
275291
* @brief Create a PHY instance of DP83848
276292
*

tools/sdk/esp32s2/include/esp_eth/include/esp_eth_mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ typedef struct {
391391
#define ETH_MAC_DEFAULT_CONFIG() \
392392
{ \
393393
.sw_reset_timeout_ms = 100, \
394-
.rx_task_stack_size = 2048, \
394+
.rx_task_stack_size = 4096, \
395395
.rx_task_prio = 15, \
396396
.smi_mdc_gpio_num = 23, \
397397
.smi_mdio_gpio_num = 18, \

tools/sdk/esp32s2/include/esp_eth/include/esp_eth_phy.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ static inline esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *con
271271
return esp_eth_phy_new_lan87xx(config);
272272
}
273273

274+
/**
275+
* @brief Create a PHY instance of LAN8742
276+
*
277+
* @note For ESP-IDF backwards compatibility reasons. In all other cases, use esp_eth_phy_new_lan87xx instead.
278+
*
279+
* @param[in] config: configuration of PHY
280+
*
281+
* @return
282+
* - instance: create PHY instance successfully
283+
* - NULL: create PHY instance failed because some error occurred
284+
*/
285+
static inline esp_eth_phy_t *esp_eth_phy_new_lan8742(const eth_phy_config_t *config)
286+
{
287+
return esp_eth_phy_new_lan87xx(config);
288+
}
289+
274290
/**
275291
* @brief Create a PHY instance of DP83848
276292
*

tools/sdk/esp32s3/include/esp_eth/include/esp_eth_mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ typedef struct {
391391
#define ETH_MAC_DEFAULT_CONFIG() \
392392
{ \
393393
.sw_reset_timeout_ms = 100, \
394-
.rx_task_stack_size = 2048, \
394+
.rx_task_stack_size = 4096, \
395395
.rx_task_prio = 15, \
396396
.smi_mdc_gpio_num = 23, \
397397
.smi_mdio_gpio_num = 18, \

tools/sdk/esp32s3/include/esp_eth/include/esp_eth_phy.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,23 @@ static inline esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *con
271271
return esp_eth_phy_new_lan87xx(config);
272272
}
273273

274+
/**
275+
* @brief Create a PHY instance of LAN8742
276+
*
277+
* @note For ESP-IDF backwards compatibility reasons. In all other cases, use esp_eth_phy_new_lan87xx instead.
278+
*
279+
* @param[in] config: configuration of PHY
280+
*
281+
* @return
282+
* - instance: create PHY instance successfully
283+
* - NULL: create PHY instance failed because some error occurred
284+
*/
285+
static inline esp_eth_phy_t *esp_eth_phy_new_lan8742(const eth_phy_config_t *config)
286+
{
287+
return esp_eth_phy_new_lan87xx(config);
288+
}
289+
290+
274291
/**
275292
* @brief Create a PHY instance of DP83848
276293
*

0 commit comments

Comments
 (0)