@@ -159,17 +159,28 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
159
159
160
160
esp_eth_mac_t *mac = esp_eth_mac_new_esp32 (&esp32_emac_config, &mac_config);
161
161
162
- ESP_LOGI (TAG, " Ethernet mdio %d mdc %d\n " , ETH_MDIO_GPIO, ETH_MDC_GPIO);
163
-
164
162
// Reserve all pins used by ethernet interface
165
163
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
166
177
CPU_GPIO_ReservePin (19 , true ); // TXD0
167
178
CPU_GPIO_ReservePin (21 , true ); // TX_EN
168
179
CPU_GPIO_ReservePin (22 , true ); // TXD1
169
- CPU_GPIO_ReservePin (esp32_emac_config.smi_gpio .mdc_num , true ); // MDC
170
180
CPU_GPIO_ReservePin (25 , true ); // RXD0
171
181
CPU_GPIO_ReservePin (26 , true ); // RXD1
172
182
CPU_GPIO_ReservePin (27 , true ); // CRS_DV
183
+ #endif
173
184
174
185
// Define PHY to use with internal Ethernet
175
186
#if defined(ESP32_ETHERNET_PHY_IP101)
0 commit comments