Commit 34786005eca3 ("net: phy: prevent PHYs w/o Clause 22 regs from calling genphy_config_aneg") introduced a check that aborts phy_config_aneg() if the phy is a C45 phy. This causes phy_state_machine() to call phy_error() so that the phy ends up in PHY_HALTED state. Instead of returning -EOPNOTSUPP, call genphy_c45_config_aneg() (analogous to the C22 case) so that the state machine can run correctly. genphy_c45_config_aneg() closely resembles mv3310_config_aneg() in drivers/net/phy/marvell10g.c, excluding vendor specific configurations for 1000BaseT. Fixes: 22b56e827093 ("net: phy: replace genphy_10g_driver with genphy_c45_driver")
Unified · Split
| @@ -523,6 +523,32 @@ int genphy_c45_read_status(struct phy_device *phydev) · 522 unmodified lines | ||
| 523 | 523 | } |
| 524 | 524 | EXPORT_SYMBOL_GPL(genphy_c45_read_status); |
| 525 | 525 | |
| 526 | +/** | |
| 527 | + * genphy_c45_config_aneg - restart auto-negotiation or forced setup | |
| 528 | + * @phydev: target phy_device struct | |
| 529 | + * | |
| 530 | + * Description: If auto-negotiation is enabled, we configure the | |
| 531 | + * advertising, and then restart auto-negotiation. If it is not | |
| 532 | + * enabled, then we force a configuration. | |
| 533 | + */ | |
| 534 | +int genphy_c45_config_aneg(struct phy_device *phydev) | |
| 535 | +{ | |
| 536 | + bool changed = false; | |
| 537 | + int ret; | |
| 538 | + | |
| 539 | + if (phydev->autoneg == AUTONEG_DISABLE) | |
| 540 | + return genphy_c45_pma_setup_forced(phydev); | |
| 541 | + | |
| 542 | + ret = genphy_c45_an_config_aneg(phydev); | |
| 543 | + if (ret < 0) | |
| 544 | + return ret; | |
| 545 | + if (ret > 0) | |
| 546 | + changed = true; | |
| 547 | + | |
| 548 | + return genphy_c45_check_and_restart_aneg(phydev, changed); | |
| 549 | +} | |
| 550 | +EXPORT_SYMBOL_GPL(genphy_c45_config_aneg); | |
| 551 | + | |
| 526 | 552 | /* The gen10g_* functions are the old Clause 45 stub */ |
| 527 | 553 | |
| 528 | 554 | int gen10g_config_aneg(struct phy_device *phydev) |
| @@ -507,7 +507,7 @@ static int phy_config_aneg(struct phy_device *phydev) · 506 unmodified lines | ||
| 507 | 507 | * allowed to call genphy_config_aneg() |
| 508 | 508 | */ |
| 509 | 509 | if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0))) |
| 510 | − return -EOPNOTSUPP; | |
| 510 | + return genphy_c45_config_aneg(phydev); | |
| 511 | 511 | |
| 512 | 512 | return genphy_config_aneg(phydev); |
| 513 | 513 | } |
| @@ -1107,6 +1107,7 @@ int genphy_c45_an_disable_aneg(struct phy_device *phydev); · 1106 unmodified lines | ||
| 1107 | 1107 | int genphy_c45_read_mdix(struct phy_device *phydev); |
| 1108 | 1108 | int genphy_c45_pma_read_abilities(struct phy_device *phydev); |
| 1109 | 1109 | int genphy_c45_read_status(struct phy_device *phydev); |
| 1110 | +int genphy_c45_config_aneg(struct phy_device *phydev); | |
| 1110 | 1111 | |
| 1111 | 1112 | /* The gen10g_* functions are the old Clause 45 stub */ |
| 1112 | 1113 | int gen10g_config_aneg(struct phy_device *phydev); |