@@ -159,17 +159,28 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
159159
160160 esp_eth_mac_t *mac = esp_eth_mac_new_esp32 (&esp32_emac_config, &mac_config);
161161
162- ESP_LOGI (TAG, " Ethernet mdio %d mdc %d\n " , ETH_MDIO_GPIO, ETH_MDC_GPIO);
163-
164162 // Reserve all pins used by ethernet interface
165163 CPU_GPIO_ReservePin (esp32_emac_config.smi_gpio .mdio_num , true ); // MDIO
164+ CPU_GPIO_ReservePin (esp32_emac_config.smi_gpio .mdc_num , true ); // MDC
165+
166+ #if SOC_EMAC_USE_MULTI_IO_MUX || SOC_EMAC_MII_USE_GPIO_MATRIX
167+ // ESP32_P4 with Ethernet
168+ const eth_mac_rmii_gpio_config_t &rmii = esp32_emac_config.emac_dataif_gpio .rmii ;
169+ CPU_GPIO_ReservePin (rmii.txd0_num , true );
170+ CPU_GPIO_ReservePin (rmii.tx_en_num , true );
171+ CPU_GPIO_ReservePin (rmii.txd1_num , true );
172+ CPU_GPIO_ReservePin (rmii.rxd0_num , true );
173+ CPU_GPIO_ReservePin (rmii.rxd1_num , true );
174+ CPU_GPIO_ReservePin (rmii.crs_dv_num ,true );
175+ #else
176+ // ESP32 with Ethernet
166177 CPU_GPIO_ReservePin (19 , true ); // TXD0
167178 CPU_GPIO_ReservePin (21 , true ); // TX_EN
168179 CPU_GPIO_ReservePin (22 , true ); // TXD1
169- CPU_GPIO_ReservePin (esp32_emac_config.smi_gpio .mdc_num , true ); // MDC
170180 CPU_GPIO_ReservePin (25 , true ); // RXD0
171181 CPU_GPIO_ReservePin (26 , true ); // RXD1
172182 CPU_GPIO_ReservePin (27 , true ); // CRS_DV
183+ #endif
173184
174185 // Define PHY to use with internal Ethernet
175186#if defined(ESP32_ETHERNET_PHY_IP101)
0 commit comments