forked from espressif/esp-idf
eth: dont warn nego timeout if link is down
This commit is contained in:
@@ -212,6 +212,11 @@ static esp_err_t dm9051_reset_hw(esp_eth_phy_t *phy)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note This function is responsible for restarting a new auto-negotiation,
|
||||||
|
* the result of negotiation won't be relected to uppler layers.
|
||||||
|
* Instead, the negotiation result is fetched by linker timer, see `dm9051_get_link()`
|
||||||
|
*/
|
||||||
static esp_err_t dm9051_negotiate(esp_eth_phy_t *phy)
|
static esp_err_t dm9051_negotiate(esp_eth_phy_t *phy)
|
||||||
{
|
{
|
||||||
phy_dm9051_t *dm9051 = __containerof(phy, phy_dm9051_t, parent);
|
phy_dm9051_t *dm9051 = __containerof(phy, phy_dm9051_t, parent);
|
||||||
@@ -241,7 +246,7 @@ static esp_err_t dm9051_negotiate(esp_eth_phy_t *phy)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (to >= dm9051->autonego_timeout_ms / 100) {
|
if ((to >= dm9051->autonego_timeout_ms / 100) && (dm9051->link_status == ETH_LINK_UP)) {
|
||||||
ESP_LOGW(TAG, "Ethernet PHY auto negotiation timeout");
|
ESP_LOGW(TAG, "Ethernet PHY auto negotiation timeout");
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@@ -201,6 +201,11 @@ static esp_err_t dp83848_reset_hw(esp_eth_phy_t *phy)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note This function is responsible for restarting a new auto-negotiation,
|
||||||
|
* the result of negotiation won't be relected to uppler layers.
|
||||||
|
* Instead, the negotiation result is fetched by linker timer, see `dp83848_get_link()`
|
||||||
|
*/
|
||||||
static esp_err_t dp83848_negotiate(esp_eth_phy_t *phy)
|
static esp_err_t dp83848_negotiate(esp_eth_phy_t *phy)
|
||||||
{
|
{
|
||||||
phy_dp83848_t *dp83848 = __containerof(phy, phy_dp83848_t, parent);
|
phy_dp83848_t *dp83848 = __containerof(phy, phy_dp83848_t, parent);
|
||||||
@@ -230,8 +235,7 @@ static esp_err_t dp83848_negotiate(esp_eth_phy_t *phy)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
if ((to >= dp83848->autonego_timeout_ms / 100) && (dp83848->link_status == ETH_LINK_UP)) {
|
||||||
if (to >= dp83848->autonego_timeout_ms / 100) {
|
|
||||||
ESP_LOGW(TAG, "auto negotiation timeout");
|
ESP_LOGW(TAG, "auto negotiation timeout");
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@@ -241,6 +241,11 @@ static esp_err_t ip101_reset_hw(esp_eth_phy_t *phy)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note This function is responsible for restarting a new auto-negotiation,
|
||||||
|
* the result of negotiation won't be relected to uppler layers.
|
||||||
|
* Instead, the negotiation result is fetched by linker timer, see `ip101_get_link()`
|
||||||
|
*/
|
||||||
static esp_err_t ip101_negotiate(esp_eth_phy_t *phy)
|
static esp_err_t ip101_negotiate(esp_eth_phy_t *phy)
|
||||||
{
|
{
|
||||||
phy_ip101_t *ip101 = __containerof(phy, phy_ip101_t, parent);
|
phy_ip101_t *ip101 = __containerof(phy, phy_ip101_t, parent);
|
||||||
@@ -267,8 +272,7 @@ static esp_err_t ip101_negotiate(esp_eth_phy_t *phy)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
if ((to >= ip101->autonego_timeout_ms / 100) && (ip101->link_status == ETH_LINK_UP)) {
|
||||||
if (to >= ip101->autonego_timeout_ms / 100) {
|
|
||||||
ESP_LOGW(TAG, "auto negotiation timeout");
|
ESP_LOGW(TAG, "auto negotiation timeout");
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@@ -189,6 +189,11 @@ static esp_err_t ksz8041_reset_hw(esp_eth_phy_t *phy)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note This function is responsible for restarting a new auto-negotiation,
|
||||||
|
* the result of negotiation won't be relected to uppler layers.
|
||||||
|
* Instead, the negotiation result is fetched by linker timer, see `ksz8041_get_link()`
|
||||||
|
*/
|
||||||
static esp_err_t ksz8041_negotiate(esp_eth_phy_t *phy)
|
static esp_err_t ksz8041_negotiate(esp_eth_phy_t *phy)
|
||||||
{
|
{
|
||||||
phy_ksz8041_t *ksz8041 = __containerof(phy, phy_ksz8041_t, parent);
|
phy_ksz8041_t *ksz8041 = __containerof(phy, phy_ksz8041_t, parent);
|
||||||
@@ -205,8 +210,8 @@ static esp_err_t ksz8041_negotiate(esp_eth_phy_t *phy)
|
|||||||
bmsr_reg_t bmsr;
|
bmsr_reg_t bmsr;
|
||||||
pc2r_reg_t pc2r;
|
pc2r_reg_t pc2r;
|
||||||
uint32_t to = 0;
|
uint32_t to = 0;
|
||||||
for (to = 0; to < ksz8041->autonego_timeout_ms / 10; to++) {
|
for (to = 0; to < ksz8041->autonego_timeout_ms / 100; to++) {
|
||||||
vTaskDelay(pdMS_TO_TICKS(10));
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
PHY_CHECK(eth->phy_reg_read(eth, ksz8041->addr, ETH_PHY_BMSR_REG_ADDR, &(bmsr.val)) == ESP_OK,
|
PHY_CHECK(eth->phy_reg_read(eth, ksz8041->addr, ETH_PHY_BMSR_REG_ADDR, &(bmsr.val)) == ESP_OK,
|
||||||
"read BMSR failed", err);
|
"read BMSR failed", err);
|
||||||
PHY_CHECK(eth->phy_reg_read(eth, ksz8041->addr, ETH_PHY_PC2R_REG_ADDR, &(pc2r.val)) == ESP_OK,
|
PHY_CHECK(eth->phy_reg_read(eth, ksz8041->addr, ETH_PHY_PC2R_REG_ADDR, &(pc2r.val)) == ESP_OK,
|
||||||
@@ -216,7 +221,7 @@ static esp_err_t ksz8041_negotiate(esp_eth_phy_t *phy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
||||||
if (to >= ksz8041->autonego_timeout_ms / 10) {
|
if ((to >= ksz8041->autonego_timeout_ms / 100) && (ksz8041->link_status == ETH_LINK_UP)) {
|
||||||
ESP_LOGW(TAG, "auto negotiation timeout");
|
ESP_LOGW(TAG, "auto negotiation timeout");
|
||||||
}
|
}
|
||||||
/* Updata information about link, speed, duplex */
|
/* Updata information about link, speed, duplex */
|
||||||
|
@@ -286,6 +286,11 @@ static esp_err_t lan8720_reset_hw(esp_eth_phy_t *phy)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note This function is responsible for restarting a new auto-negotiation,
|
||||||
|
* the result of negotiation won't be relected to uppler layers.
|
||||||
|
* Instead, the negotiation result is fetched by linker timer, see `lan8720_get_link()`
|
||||||
|
*/
|
||||||
static esp_err_t lan8720_negotiate(esp_eth_phy_t *phy)
|
static esp_err_t lan8720_negotiate(esp_eth_phy_t *phy)
|
||||||
{
|
{
|
||||||
phy_lan8720_t *lan8720 = __containerof(phy, phy_lan8720_t, parent);
|
phy_lan8720_t *lan8720 = __containerof(phy, phy_lan8720_t, parent);
|
||||||
@@ -315,7 +320,7 @@ static esp_err_t lan8720_negotiate(esp_eth_phy_t *phy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
||||||
if (to >= lan8720->autonego_timeout_ms / 100) {
|
if (to >= lan8720->autonego_timeout_ms / 100 && (lan8720->link_status == ETH_LINK_UP)) {
|
||||||
ESP_LOGW(TAG, "auto negotiation timeout");
|
ESP_LOGW(TAG, "auto negotiation timeout");
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@@ -195,6 +195,11 @@ static esp_err_t rtl8201_reset_hw(esp_eth_phy_t *phy)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note This function is responsible for restarting a new auto-negotiation,
|
||||||
|
* the result of negotiation won't be relected to uppler layers.
|
||||||
|
* Instead, the negotiation result is fetched by linker timer, see `rtl8201_get_link()`
|
||||||
|
*/
|
||||||
static esp_err_t rtl8201_negotiate(esp_eth_phy_t *phy)
|
static esp_err_t rtl8201_negotiate(esp_eth_phy_t *phy)
|
||||||
{
|
{
|
||||||
phy_rtl8201_t *rtl8201 = __containerof(phy, phy_rtl8201_t, parent);
|
phy_rtl8201_t *rtl8201 = __containerof(phy, phy_rtl8201_t, parent);
|
||||||
@@ -221,8 +226,7 @@ static esp_err_t rtl8201_negotiate(esp_eth_phy_t *phy)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
|
if ((to >= rtl8201->autonego_timeout_ms / 100) && (rtl8201->link_status == ETH_LINK_UP)) {
|
||||||
if (to >= rtl8201->autonego_timeout_ms / 100) {
|
|
||||||
ESP_LOGW(TAG, "auto negotiation timeout");
|
ESP_LOGW(TAG, "auto negotiation timeout");
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
Reference in New Issue
Block a user