mirror of
https://github.com/apache/nuttx.git
synced 2026-06-09 02:44:53 +08:00
xtensa/esp32: Add option to enable ETH PHY reset pin
This commit is contained in:
@@ -1860,10 +1860,15 @@ config ESP32_ETH_MDIOPIN
|
||||
default 18
|
||||
range 0 39
|
||||
|
||||
config ESP32_ETH_ENABLE_PHY_RSTPIN
|
||||
bool "Enable Reset PHY Pin"
|
||||
default y
|
||||
|
||||
config ESP32_ETH_PHY_RSTPIN
|
||||
int "Reset PHY Pin"
|
||||
default 5
|
||||
range 0 39
|
||||
depends on ESP32_ETH_ENABLE_PHY_RSTPIN
|
||||
|
||||
config ESP32_ETH_PHY_ADDR
|
||||
int "PHY address"
|
||||
|
||||
@@ -146,7 +146,9 @@
|
||||
|
||||
/* Reset PHY chip pins */
|
||||
|
||||
#define EMAC_PHYRST_PIN (CONFIG_ESP32_ETH_PHY_RSTPIN)
|
||||
#ifdef CONFIG_ESP32_ETH_ENABLE_PHY_RSTPIN
|
||||
# define EMAC_PHYRST_PIN (CONFIG_ESP32_ETH_PHY_RSTPIN)
|
||||
#endif
|
||||
|
||||
/* PHY chip address in SMI bus */
|
||||
|
||||
@@ -511,7 +513,9 @@ static void emac_init_gpio(void)
|
||||
esp32_gpio_matrix_out(EMAC_MDIO_PIN, EMAC_MDO_O_IDX, 0, 0);
|
||||
esp32_gpio_matrix_in(EMAC_MDIO_PIN, EMAC_MDI_I_IDX, 0);
|
||||
|
||||
#ifdef CONFIG_ESP32_ETH_ENABLE_PHY_RSTPIN
|
||||
esp32_configgpio(EMAC_PHYRST_PIN, OUTPUT | PULLUP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -538,11 +542,14 @@ static int emac_config(void)
|
||||
uint32_t regval;
|
||||
uint8_t macaddr[6];
|
||||
|
||||
#ifdef CONFIG_ESP32_ETH_ENABLE_PHY_RSTPIN
|
||||
|
||||
/* Hardware reset PHY chip */
|
||||
|
||||
esp32_gpiowrite(EMAC_PHYRST_PIN, false);
|
||||
nxsig_usleep(50);
|
||||
esp32_gpiowrite(EMAC_PHYRST_PIN, true);
|
||||
#endif
|
||||
|
||||
/* Open hardware clock */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user