]> granicus.if.org Git - esp-idf/commitdiff
ethernet: phy init timeout
authormorris <maoshengrong@espressif.com>
Tue, 4 Dec 2018 09:13:48 +0000 (17:13 +0800)
committermorris <maoshengrong@espressif.com>
Tue, 4 Dec 2018 09:13:48 +0000 (17:13 +0800)
When ethernet enable again after disable it before, phy init will report timeout.
The cause of this problem is that the enabling of emac clock is too late, and should be placed before phy init.

components/ethernet/emac_main.c

index b70682b561c059b092bc17549eb9ea5b8aef8ebf..6ddcdc71277fe6c24d5dc8f19d42b8eb185b4448 100644 (file)
@@ -809,7 +809,6 @@ static void emac_start(void *param)
 
     ESP_LOGD(TAG, "emac start");
     cmd->err = EMAC_CMD_OK;
-    emac_enable_clk(true);
 
     if (emac_reset() != ESP_OK) {
         return;
@@ -870,6 +869,7 @@ esp_err_t esp_eth_enable(void)
     esp_pm_lock_acquire(s_pm_lock);
 #endif //CONFIG_PM_ENABLE
 
+    emac_enable_clk(true);
     /* init phy device */
     if (emac_config.phy_init() != ESP_OK) {
         ESP_LOGE(TAG, "Initialise PHY device Timeout");