Skip to content

Commit

Permalink
Merge branch 'net-phy-remove-genphy_config_init'
Browse files Browse the repository at this point in the history
Heiner Kallweit says:

====================
net: phy: remove genphy_config_init

Supported PHY features are either auto-detected or explicitly set.
In both cases calling genphy_config_init isn't needed. All that
genphy_config_init does is removing features that are set as
supported but can't be auto-detected. Basically it duplicates the
code in genphy_read_abilities. Therefore remove genphy_config_init.

v2:
- remove call also from new adin driver
v3:
- pass NULL as config_init function pointer for dp83848
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 17, 2019
2 parents a4d2113 + 4b9cb2a commit 59d0f74
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 90 deletions.
4 changes: 0 additions & 4 deletions drivers/net/phy/adin.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,6 @@ static int adin_config_init(struct phy_device *phydev)

phydev->mdix_ctrl = ETH_TP_MDI_AUTO;

rc = genphy_config_init(phydev);
if (rc < 0)
return rc;

rc = adin_config_rgmii_mode(phydev);
if (rc < 0)
return rc;
Expand Down
4 changes: 0 additions & 4 deletions drivers/net/phy/at803x.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ static int at803x_config_init(struct phy_device *phydev)
{
int ret;

ret = genphy_config_init(phydev);
if (ret < 0)
return ret;

/* The RX and TX delay default is:
* after HW reset: RX delay enabled and TX delay disabled
* after SW reset: RX delay enabled, while TX delay retains the
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/phy/dp83822.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,8 @@ static int dp83822_config_intr(struct phy_device *phydev)

static int dp83822_config_init(struct phy_device *phydev)
{
int err;
int value;

err = genphy_config_init(phydev);
if (err < 0)
return err;

value = DP83822_WOL_MAGIC_EN | DP83822_WOL_SECURE_ON | DP83822_WOL_EN;

return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
Expand Down
11 changes: 3 additions & 8 deletions drivers/net/phy/dp83848.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,8 @@ static int dp83848_config_intr(struct phy_device *phydev)

static int dp83848_config_init(struct phy_device *phydev)
{
int err;
int val;

err = genphy_config_init(phydev);
if (err < 0)
return err;

/* DP83620 always reports Auto Negotiation Ability on BMSR. Instead,
* we check initial value of BMCR Auto negotiation enable bit
*/
Expand Down Expand Up @@ -113,13 +108,13 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);

static struct phy_driver dp83848_driver[] = {
DP83848_PHY_DRIVER(TI_DP83848C_PHY_ID, "TI DP83848C 10/100 Mbps PHY",
genphy_config_init),
NULL),
DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY",
genphy_config_init),
NULL),
DP83848_PHY_DRIVER(TI_DP83620_PHY_ID, "TI DP83620 10/100 Mbps PHY",
dp83848_config_init),
DP83848_PHY_DRIVER(TLK10X_PHY_ID, "TI TLK10X 10/100 Mbps PHY",
genphy_config_init),
NULL),
};
module_phy_driver(dp83848_driver);

Expand Down
4 changes: 0 additions & 4 deletions drivers/net/phy/dp83tc811.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ static int dp83811_config_init(struct phy_device *phydev)
{
int value, err;

err = genphy_config_init(phydev);
if (err < 0)
return err;

value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/meson-gxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static int meson_gxl_config_init(struct phy_device *phydev)
if (ret)
return ret;

return genphy_config_init(phydev);
return 0;
}

/* This function is provided to cope with the possible failures of this phy
Expand Down
1 change: 0 additions & 1 deletion drivers/net/phy/microchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ static int lan88xx_config_init(struct phy_device *phydev)
{
int val;

genphy_config_init(phydev);
/*Zerodetect delay enable */
val = phy_read_mmd(phydev, MDIO_MMD_PCS,
PHY_ARDENNES_MMD_DEV_3_PHY_CFG);
Expand Down
1 change: 0 additions & 1 deletion drivers/net/phy/microchip_t1.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ static struct phy_driver microchip_t1_phy_driver[] = {

.features = PHY_BASIC_T1_FEATURES,

.config_init = genphy_config_init,
.config_aneg = genphy_config_aneg,

.ack_interrupt = lan87xx_phy_ack_interrupt,
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/phy/mscc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ static int vsc8584_config_init(struct phy_device *phydev)
return ret;
}

return genphy_config_init(phydev);
return 0;

err:
mutex_unlock(&phydev->mdio.bus->mdio_lock);
Expand Down Expand Up @@ -1767,7 +1767,7 @@ static int vsc85xx_config_init(struct phy_device *phydev)
return rc;
}

return genphy_config_init(phydev);
return 0;
}

static int vsc8584_did_interrupt(struct phy_device *phydev)
Expand Down
51 changes: 0 additions & 51 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1885,57 +1885,6 @@ int genphy_soft_reset(struct phy_device *phydev)
}
EXPORT_SYMBOL(genphy_soft_reset);

int genphy_config_init(struct phy_device *phydev)
{
int val;
__ETHTOOL_DECLARE_LINK_MODE_MASK(features) = { 0, };

linkmode_set_bit_array(phy_basic_ports_array,
ARRAY_SIZE(phy_basic_ports_array),
features);
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, features);
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, features);

/* Do we support autonegotiation? */
val = phy_read(phydev, MII_BMSR);
if (val < 0)
return val;

if (val & BMSR_ANEGCAPABLE)
linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, features);

if (val & BMSR_100FULL)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, features);
if (val & BMSR_100HALF)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, features);
if (val & BMSR_10FULL)
linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, features);
if (val & BMSR_10HALF)
linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, features);

if (val & BMSR_ESTATEN) {
val = phy_read(phydev, MII_ESTATUS);
if (val < 0)
return val;

if (val & ESTATUS_1000_TFULL)
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
features);
if (val & ESTATUS_1000_THALF)
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
features);
if (val & ESTATUS_1000_XFULL)
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
features);
}

linkmode_and(phydev->supported, phydev->supported, features);
linkmode_and(phydev->advertising, phydev->advertising, features);

return 0;
}
EXPORT_SYMBOL(genphy_config_init);

/**
* genphy_read_abilities - read PHY abilities from Clause 22 registers
* @phydev: target phy_device struct
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/phy/vitesse.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int vsc738x_config_init(struct phy_device *phydev)

vsc73xx_config_init(phydev);

return genphy_config_init(phydev);
return 0;
}

static int vsc739x_config_init(struct phy_device *phydev)
Expand Down Expand Up @@ -229,7 +229,7 @@ static int vsc739x_config_init(struct phy_device *phydev)

vsc73xx_config_init(phydev);

return genphy_config_init(phydev);
return 0;
}

static int vsc73xx_config_aneg(struct phy_device *phydev)
Expand Down Expand Up @@ -267,7 +267,7 @@ static int vsc8601_config_init(struct phy_device *phydev)
if (ret < 0)
return ret;

return genphy_config_init(phydev);
return 0;
}

static int vsc824x_ack_interrupt(struct phy_device *phydev)
Expand Down
1 change: 0 additions & 1 deletion include/linux/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,6 @@ void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
void phy_attached_info(struct phy_device *phydev);

/* Clause 22 PHY */
int genphy_config_init(struct phy_device *phydev);
int genphy_read_abilities(struct phy_device *phydev);
int genphy_setup_forced(struct phy_device *phydev);
int genphy_restart_aneg(struct phy_device *phydev);
Expand Down
5 changes: 0 additions & 5 deletions net/dsa/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,6 @@ static int dsa_port_setup_phy_of(struct dsa_port *dp, bool enable)
return PTR_ERR(phydev);

if (enable) {
err = genphy_config_init(phydev);
if (err < 0)
goto err_put_dev;

err = genphy_resume(phydev);
if (err < 0)
goto err_put_dev;
Expand Down Expand Up @@ -589,7 +585,6 @@ static int dsa_port_fixed_link_register_of(struct dsa_port *dp)
mode = PHY_INTERFACE_MODE_NA;
phydev->interface = mode;

genphy_config_init(phydev);
genphy_read_status(phydev);

if (ds->ops->adjust_link)
Expand Down

0 comments on commit 59d0f74

Please sign in to comment.