* [PATCH net-next v2 0/3] net: phy: remove genphy_config_init
@ 2019-08-16 20:30 Heiner Kallweit
2019-08-16 20:31 ` [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init Heiner Kallweit
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Heiner Kallweit @ 2019-08-16 20:30 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller, Kevin Hilman,
Vivien Didelot
Cc: netdev, open list:ARM/Amlogic Meson...
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
Heiner Kallweit (3):
net: phy: remove calls to genphy_config_init
net: dsa: remove calls to genphy_config_init
net: phy: remove genphy_config_init
drivers/net/phy/adin.c | 4 ---
drivers/net/phy/at803x.c | 4 ---
drivers/net/phy/dp83822.c | 5 ----
drivers/net/phy/dp83848.c | 16 +++++------
drivers/net/phy/dp83tc811.c | 4 ---
drivers/net/phy/meson-gxl.c | 2 +-
drivers/net/phy/microchip.c | 1 -
drivers/net/phy/microchip_t1.c | 1 -
drivers/net/phy/mscc.c | 4 +--
drivers/net/phy/phy_device.c | 51 ----------------------------------
drivers/net/phy/vitesse.c | 6 ++--
include/linux/phy.h | 1 -
net/dsa/port.c | 5 ----
13 files changed, 14 insertions(+), 90 deletions(-)
--
2.22.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init
2019-08-16 20:30 [PATCH net-next v2 0/3] net: phy: remove genphy_config_init Heiner Kallweit
@ 2019-08-16 20:31 ` Heiner Kallweit
2019-08-16 21:58 ` Florian Fainelli
2019-08-16 20:31 ` [PATCH net-next v2 2/3] net: dsa: " Heiner Kallweit
2019-08-16 20:32 ` [PATCH net-next v2 3/3] net: phy: remove genphy_config_init Heiner Kallweit
2 siblings, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2019-08-16 20:31 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller, Kevin Hilman,
Vivien Didelot
Cc: netdev, open list:ARM/Amlogic Meson...
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 such calls from
all PHY drivers.
v2:
- remove call also from new adin PHY driver
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/adin.c | 4 ----
drivers/net/phy/at803x.c | 4 ----
drivers/net/phy/dp83822.c | 5 -----
drivers/net/phy/dp83848.c | 16 ++++++++--------
drivers/net/phy/dp83tc811.c | 4 ----
drivers/net/phy/meson-gxl.c | 2 +-
drivers/net/phy/microchip.c | 1 -
drivers/net/phy/microchip_t1.c | 1 -
drivers/net/phy/mscc.c | 4 ++--
drivers/net/phy/vitesse.c | 6 +++---
10 files changed, 14 insertions(+), 33 deletions(-)
diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index ac79e16cd..4dec83df0 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -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;
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 222ccd9ec..d98aa5671 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -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
diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index 7ed4760fb..8a4b1d167 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -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,
diff --git a/drivers/net/phy/dp83848.c b/drivers/net/phy/dp83848.c
index 6f9bc7d91..11644579a 100644
--- a/drivers/net/phy/dp83848.c
+++ b/drivers/net/phy/dp83848.c
@@ -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
*/
@@ -85,6 +80,11 @@ static int dp83848_config_init(struct phy_device *phydev)
return 0;
}
+static int dummy_config_init(struct phy_device *phydev)
+{
+ return 0;
+}
+
static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
{ TI_DP83848C_PHY_ID, 0xfffffff0 },
{ NS_DP83848C_PHY_ID, 0xfffffff0 },
@@ -113,13 +113,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),
+ dummy_config_init),
DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY",
- genphy_config_init),
+ dummy_config_init),
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),
+ dummy_config_init),
};
module_phy_driver(dp83848_driver);
diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c
index ac27da168..06f08832e 100644
--- a/drivers/net/phy/dp83tc811.c
+++ b/drivers/net/phy/dp83tc811.c
@@ -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,
diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
index fa80d6dce..e8f2ca625 100644
--- a/drivers/net/phy/meson-gxl.c
+++ b/drivers/net/phy/meson-gxl.c
@@ -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
diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c
index eb1b3287f..a644e8e50 100644
--- a/drivers/net/phy/microchip.c
+++ b/drivers/net/phy/microchip.c
@@ -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);
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 3d09b4716..001def450 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -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,
diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 645d354ff..7ada1fd9c 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -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);
@@ -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)
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 43691b1ac..bb6803527 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -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)
@@ -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)
@@ -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)
--
2.22.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v2 2/3] net: dsa: remove calls to genphy_config_init
2019-08-16 20:30 [PATCH net-next v2 0/3] net: phy: remove genphy_config_init Heiner Kallweit
2019-08-16 20:31 ` [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init Heiner Kallweit
@ 2019-08-16 20:31 ` Heiner Kallweit
2019-08-16 20:32 ` [PATCH net-next v2 3/3] net: phy: remove genphy_config_init Heiner Kallweit
2 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2019-08-16 20:31 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller, Kevin Hilman,
Vivien Didelot
Cc: netdev, open list:ARM/Amlogic Meson...
Supported PHY features are either auto-detected or explicitly set.
In both cases calling genphy_config_init isn't needed.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
net/dsa/port.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/net/dsa/port.c b/net/dsa/port.c
index f071acf28..f75301456 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -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;
@@ -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)
--
2.22.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v2 3/3] net: phy: remove genphy_config_init
2019-08-16 20:30 [PATCH net-next v2 0/3] net: phy: remove genphy_config_init Heiner Kallweit
2019-08-16 20:31 ` [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init Heiner Kallweit
2019-08-16 20:31 ` [PATCH net-next v2 2/3] net: dsa: " Heiner Kallweit
@ 2019-08-16 20:32 ` Heiner Kallweit
2 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2019-08-16 20:32 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller, Kevin Hilman,
Vivien Didelot
Cc: netdev, open list:ARM/Amlogic Meson...
Now that all users have been removed we can remove genphy_config_init.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy_device.c | 51 ------------------------------------
include/linux/phy.h | 1 -
2 files changed, 52 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9c546bae9..d5db7604d 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -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
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 5ac7d2137..d26779f1f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -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);
--
2.22.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init
2019-08-16 20:31 ` [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init Heiner Kallweit
@ 2019-08-16 21:58 ` Florian Fainelli
2019-08-17 10:25 ` Heiner Kallweit
0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2019-08-16 21:58 UTC (permalink / raw)
To: Heiner Kallweit, Andrew Lunn, David Miller, Kevin Hilman, Vivien Didelot
Cc: netdev, open list:ARM/Amlogic Meson...
On 8/16/19 1:31 PM, Heiner Kallweit wrote:
> 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 such calls from
> all PHY drivers.
>
> v2:
> - remove call also from new adin PHY driver
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Looks good, just one question below:
> +static int dummy_config_init(struct phy_device *phydev)
> +{
> + return 0;
> +}
> +
> static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
> { TI_DP83848C_PHY_ID, 0xfffffff0 },
> { NS_DP83848C_PHY_ID, 0xfffffff0 },
> @@ -113,13 +113,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),
> + dummy_config_init),
> DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY",
> - genphy_config_init),
> + dummy_config_init),
> 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),
> + dummy_config_init),
drv->config_init is an optional callback so you could just either pass
NULL as an argument to the macro, or simply remove that parameter?
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init
2019-08-16 21:58 ` Florian Fainelli
@ 2019-08-17 10:25 ` Heiner Kallweit
0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2019-08-17 10:25 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, David Miller, Kevin Hilman,
Vivien Didelot
Cc: netdev, open list:ARM/Amlogic Meson...
On 16.08.2019 23:58, Florian Fainelli wrote:
> On 8/16/19 1:31 PM, Heiner Kallweit wrote:
>> 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 such calls from
>> all PHY drivers.
>>
>> v2:
>> - remove call also from new adin PHY driver
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>
> Looks good, just one question below:
>
>> +static int dummy_config_init(struct phy_device *phydev)
>> +{
>> + return 0;
>> +}
>> +
>> static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
>> { TI_DP83848C_PHY_ID, 0xfffffff0 },
>> { NS_DP83848C_PHY_ID, 0xfffffff0 },
>> @@ -113,13 +113,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),
>> + dummy_config_init),
>> DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY",
>> - genphy_config_init),
>> + dummy_config_init),
>> 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),
>> + dummy_config_init),
>
> drv->config_init is an optional callback so you could just either pass
> NULL as an argument to the macro, or simply remove that parameter?
>
Yes, this can be simplified. Let's pass NULL. Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-08-17 10:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16 20:30 [PATCH net-next v2 0/3] net: phy: remove genphy_config_init Heiner Kallweit
2019-08-16 20:31 ` [PATCH net-next v2 1/3] net: phy: remove calls to genphy_config_init Heiner Kallweit
2019-08-16 21:58 ` Florian Fainelli
2019-08-17 10:25 ` Heiner Kallweit
2019-08-16 20:31 ` [PATCH net-next v2 2/3] net: dsa: " Heiner Kallweit
2019-08-16 20:32 ` [PATCH net-next v2 3/3] net: phy: remove genphy_config_init Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).