Skip to content

Commit

Permalink
fix(ksz8863): replaced deprecated SMI GPIO configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kostaond committed Sep 17, 2024
1 parent 6315a47 commit adbd8dc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
6 changes: 6 additions & 0 deletions eth_dummy_phy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ Note that usage of the `Dummy PHY` component does not conform with the RevMII st
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
// Update vendor specific MAC config based on board configuration
// No SMI, speed/duplex must be statically configured the same in both devices
// MIIM interface is not used since does not provide access to all registers
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
esp32_emac_config.smi_gpio.mdc_num = -1;
esp32_emac_config.smi_gpio.mdio_num = -1;
#else
esp32_emac_config.smi_mdc_gpio_num = -1;
esp32_emac_config.smi_mdio_gpio_num = -1;
#endif

// Create new ESP32 Ethernet MAC instance
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
Expand Down
5 changes: 3 additions & 2 deletions ksz8863/examples/simple_switch/main/simple_switch_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ void app_main(void)
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();

phy_config.reset_gpio_num = -1; // KSZ8863 is reset by separate function call since multiple instances exist
esp32_emac_config.smi_mdc_gpio_num = -1; // MIIM interface is not used since does not provide access to all registers
esp32_emac_config.smi_mdio_gpio_num = -1;
// MIIM interface is not used since does not provide access to all registers
esp32_emac_config.smi_gpio.mdc_num = -1;
esp32_emac_config.smi_gpio.mdio_num = -1;

// Init Host Ethernet Interface (Port 3)
esp_eth_mac_t *host_mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
Expand Down
5 changes: 3 additions & 2 deletions ksz8863/examples/switch_mode/main/switch_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ void app_main(void)
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();

phy_config.reset_gpio_num = -1; // KSZ8863 is reset by separate function call since multiple instances exist
esp32_emac_config.smi_mdc_gpio_num = -1; // MIIM interface is not used since does not provide access to all registers
esp32_emac_config.smi_mdio_gpio_num = -1;
// MIIM interface is not used since does not provide access to all registers
esp32_emac_config.smi_gpio.mdc_num = -1;
esp32_emac_config.smi_gpio.mdio_num = -1;

// Init Host Ethernet Interface (Port 3)
esp_eth_mac_t *host_mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
Expand Down
5 changes: 3 additions & 2 deletions ksz8863/examples/two_ports_mode/main/two_ports_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ void app_main(void)
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();

phy_config.reset_gpio_num = -1; // KSZ8863 is reset by separate function call since multiple instances exist
esp32_emac_config.smi_mdc_gpio_num = -1; // MIIM interface is not used since does not provide access to all registers
esp32_emac_config.smi_mdio_gpio_num = -1;
// MIIM interface is not used since does not provide access to all registers
esp32_emac_config.smi_gpio.mdc_num = -1;
esp32_emac_config.smi_gpio.mdio_num = -1;

// Init Host Ethernet Interface (Port 3)
esp_eth_mac_t *host_mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
Expand Down
2 changes: 1 addition & 1 deletion ksz8863/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.2.5"
version: "0.2.6"
targets:
- esp32
- esp32p4
Expand Down
2 changes: 1 addition & 1 deletion ksz8863/src/esp_eth_pmac_ksz8863.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static esp_err_t pmac_ksz8863_get_mac_tbl(pmac_ksz8863_t *pmac, ksz8863_indir_ac
return ret;
}

static esp_err_t pmac_ksz8863_custom_ioctl(esp_eth_mac_t *mac, uint32_t cmd, void *data)
static esp_err_t pmac_ksz8863_custom_ioctl(esp_eth_mac_t *mac, int cmd, void *data)
{
esp_err_t ret = ESP_OK;
pmac_ksz8863_t *pmac = __containerof(mac, pmac_ksz8863_t, parent);
Expand Down

0 comments on commit adbd8dc

Please sign in to comment.