History

Add genphy_c45_config_aneg() function to phy-c45.c

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")

Marco Hartmann committed 7 years ago

Commit 94acaeb1 parent 981471b3 files · +28 −1Browse files

Unified · Split

3 files
  1. drivers/net/phy/phy-c45.c +26 −0
  2. drivers/net/phy/phy.c +1 −1
  3. include/linux/phy.h +1 −0
drivers/net/phy/phy-c45.c+26−0
@@ -523,6 +523,32 @@ int genphy_c45_read_status(struct phy_device *phydev) · 522 unmodified lines
523}523}
524EXPORT_SYMBOL_GPL(genphy_c45_read_status);524EXPORT_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 */
534int 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}
550EXPORT_SYMBOL_GPL(genphy_c45_config_aneg);
551
526/* The gen10g_* functions are the old Clause 45 stub */552/* The gen10g_* functions are the old Clause 45 stub */
527 553
528int gen10g_config_aneg(struct phy_device *phydev)554int gen10g_config_aneg(struct phy_device *phydev)
drivers/net/phy/phy.c+1−1
@@ -507,7 +507,7 @@ static int phy_config_aneg(struct phy_device *phydev) · 506 unmodified lines
507 * allowed to call genphy_config_aneg()507 * allowed to call genphy_config_aneg()
508 */508 */
509 if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))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 return genphy_config_aneg(phydev);512 return genphy_config_aneg(phydev);
513}513}
include/linux/phy.h+1−0
@@ -1107,6 +1107,7 @@ int genphy_c45_an_disable_aneg(struct phy_device *phydev); · 1106 unmodified lines
1107int genphy_c45_read_mdix(struct phy_device *phydev);1107int genphy_c45_read_mdix(struct phy_device *phydev);
1108int genphy_c45_pma_read_abilities(struct phy_device *phydev);1108int genphy_c45_pma_read_abilities(struct phy_device *phydev);
1109int genphy_c45_read_status(struct phy_device *phydev);1109int genphy_c45_read_status(struct phy_device *phydev);
1110int genphy_c45_config_aneg(struct phy_device *phydev);
1110 1111
1111/* The gen10g_* functions are the old Clause 45 stub */1112/* The gen10g_* functions are the old Clause 45 stub */
1112int gen10g_config_aneg(struct phy_device *phydev);1113int gen10g_config_aneg(struct phy_device *phydev);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t