void phy_lan8720_power_enable(bool enable) { if (enable) { esp_eth_smi_write(SW_STRAP_CONTROL_REG, DEFAULT_STRAP_CONFIG | SW_STRAP_CONFIG_DONE); // TODO: only enable if config.flow_ctrl_enable == true phy_mii_enable_flow_ctrl(); } }
void phy_tlk110_init(void) { ESP_LOGD(TAG, "phy_tlk110_init()"); phy_tlk110_dump_registers(); esp_eth_smi_write(PHY_RESET_CONTROL_REG, SOFTWARE_RESET); esp_err_t res1, res2; do { // Call esp_eth_smi_wait_value() with a timeout so it prints an error periodically res1 = esp_eth_smi_wait_value(MII_PHY_IDENTIFIER_1_REG, TLK110_PHY_ID1, UINT16_MAX, 1000); res2 = esp_eth_smi_wait_value(MII_PHY_IDENTIFIER_2_REG, TLK110_PHY_ID2, TLK110_PHY_ID2_MASK, 1000); } while(res1 != ESP_OK || res2 != ESP_OK); esp_eth_smi_write(SW_STRAP_CONTROL_REG, DEFAULT_STRAP_CONFIG | SW_STRAP_CONFIG_DONE); ets_delay_us(300); // TODO: only do this if config.flow_ctrl_enable == true phy_mii_enable_flow_ctrl(); }