net: phy: clean up the old gen10g functions
Subsystems (4)
Heiner Kallweit
maintainercover net: phy: clean up the old gen10g functions
The old gen10g_ functions are mainly stubs and have been superseded by genphy_c45_ equivalents. So lets remove / hide the old functions as far as possible.
Heiner Kallweit (5):
net: phy: use genphy_c45_aneg_done in genphy_aneg_done
net: phy: remove gen10g_suspend and gen10g_resume
net: phy: remove gen10g_config_init
net: phy: don't export gen10g_read_status
net: phy: remove gen10g_no_soft_reset
drivers/net/phy/cortina.c | 3 +-- drivers/net/phy/marvell10g.c | 4 ++-- drivers/net/phy/phy-c45.c | 40 ++---------------------------------- drivers/net/phy/phy.c | 12 ++++------- drivers/net/phy/teranetics.c | 3 +-- include/linux/phy.h | 5 ----- 6 files changed, 10 insertions(+), 57 deletions(-)
Signature · 1 line
2.21.0
Heiner Kallweit
maintainerPATCH 1/5 net: phy: use genphy_c45_aneg_done in genphy_aneg_done
Now that we have it let's use genphy_c45_aneg_done() in phy_aneg_done().
--- drivers/net/phy/phy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/net/phy/phy.c +4 -8
@@ -144,14 +144,10 @@ int phy_aneg_done(struct phy_device *phydev) {if (phydev->drv && phydev->drv->aneg_done)return phydev->drv->aneg_done (phydev); - -/* Avoid genphy_aneg_done() if the Clause 45 PHY does not -* implement Clause 22 registers -*/ -if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package &BIT (0 ))) -return -EINVAL ; - -return genphy_aneg_done (phydev); +else if (phydev->is_c45) +return genphy_c45_aneg_done (phydev); +else +return genphy_aneg_done (phydev); }EXPORT_SYMBOL (phy_aneg_done);
Signature · 1 line
2.21.0
Re: [PATCH net-next 1/5] net: phy: use genphy_c45_aneg_done in genphy_aneg_done
Quoted 3 lines · Heiner Kallweit
Now that we have it let's use
genphy_c45_aneg_done()inphy_aneg_done().Signed-off-by Heiner Kallweit <[email protected]>
Andrew
Heiner Kallweit
maintainerPATCH 2/5 net: phy: remove gen10g_suspend and gen10g_resume
In reply to Heiner Kallweitphy_suspend() and phy_resume() are no-ops anyway if no callback is defined. Therefore we don't need these stubs.
--- drivers/net/phy/phy-c45.c | 14 -------------- include/linux/phy.h | 2 -- 2 files changed, 16 deletions(-)
drivers/net/phy/phy-c45.c +0 -14
@@ -529,18 +529,6 @@ int gen10g_config_init(struct phy_device *phydev) }EXPORT_SYMBOL_GPL (gen10g_config_init); -int gen10g_suspend (struct phy_device *phydev) -{ -return 0 ; -} -EXPORT_SYMBOL_GPL (gen10g_suspend); - -int gen10g_resume (struct phy_device *phydev) -{ -return 0 ; -} -EXPORT_SYMBOL_GPL (gen10g_resume); -struct phy_driver genphy_10g_driver = { .phy_id =0xffffffff , .phy_id_mask =0xffffffff ,
@@ -550,6 +538,4 @@ struct phy_driver genphy_10g_driver = { .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = gen10g_read_status, - .suspend = gen10g_suspend, - .resume = gen10g_resume, };
include/linux/phy.h +0 -2
@@ -1122,8 +1122,6 @@ int gen10g_config_aneg(struct phy_device *phydev);int gen10g_read_status (struct phy_device *phydev);int gen10g_no_soft_reset (struct phy_device *phydev);int gen10g_config_init (struct phy_device *phydev); -int gen10g_suspend (struct phy_device *phydev); -int gen10g_resume (struct phy_device *phydev);static inline int phy_read_status (struct phy_device *phydev) {
Signature · 1 line
2.21.0
Re: [PATCH net-next 2/5] net: phy: remove gen10g_suspend and gen10g_resume
Quoted 4 lines · Heiner Kallweit
phy_suspend()andphy_resume()are no-ops anyway if no callback is defined. Therefore we don't need these stubs.Signed-off-by Heiner Kallweit <[email protected]>
Andrew
Heiner Kallweit
maintainerPATCH 3/5 net: phy: remove gen10g_config_init
In reply to Heiner KallweitETHTOOL_LINK_MODE_10000baseT_Full_BIT is set anyway in the supported and advertising bitmap because it's part of PHY_10GBIT_FEATURES. And all users of gen10g_config_init use PHY_10GBIT_FEATURES.
--- drivers/net/phy/cortina.c | 1 - drivers/net/phy/phy-c45.c | 14 -------------- drivers/net/phy/teranetics.c | 1 - include/linux/phy.h | 1 - 4 files changed, 17 deletions(-)
drivers/net/phy/cortina.c +0 -1
@@ -80,7 +80,6 @@ static struct phy_driver cortina_driver[] = { .phy_id_mask = 0xffffffff, .name = "Cortina CS4340", .features = PHY_10GBIT_FEATURES, - .config_init = gen10g_config_init, .config_aneg = gen10g_config_aneg, .read_status = cortina_read_status, .soft_reset = gen10g_no_soft_reset,
drivers/net/phy/phy-c45.c +0 -14
@@ -516,25 +516,11 @@ int gen10g_no_soft_reset(struct phy_device *phydev) }EXPORT_SYMBOL_GPL (gen10g_no_soft_reset); -int gen10g_config_init (struct phy_device *phydev) -{ -/* Temporarily just say we support everything */ -linkmode_zero (phydev->supported); - -linkmode_set_bit (ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - phydev->supported); -linkmode_copy (phydev->advertising, phydev->supported); - -return 0 ; -} -EXPORT_SYMBOL_GPL (gen10g_config_init); -struct phy_driver genphy_10g_driver = { .phy_id =0xffffffff , .phy_id_mask =0xffffffff , .name ="Generic 10G PHY" , .soft_reset = gen10g_no_soft_reset, - .config_init = gen10g_config_init, .features =PHY_10GBIT_FEATURES , .config_aneg = gen10g_config_aneg, .read_status = gen10g_read_status,
drivers/net/phy/teranetics.c +0 -1
@@ -80,7 +80,6 @@ static struct phy_driver teranetics_driver[] = { .features = PHY_10GBIT_FEATURES, .soft_reset = gen10g_no_soft_reset, .aneg_done = teranetics_aneg_done, - .config_init = gen10g_config_init, .config_aneg = gen10g_config_aneg, .read_status = teranetics_read_status, .match_phy_device = teranetics_match_phy_device,
include/linux/phy.h +0 -1
@@ -1121,7 +1121,6 @@ int genphy_c45_read_status(struct phy_device *phydev);int gen10g_config_aneg (struct phy_device *phydev);int gen10g_read_status (struct phy_device *phydev);int gen10g_no_soft_reset (struct phy_device *phydev); -int gen10g_config_init (struct phy_device *phydev);static inline int phy_read_status (struct phy_device *phydev) {
Signature · 1 line
2.21.0
Re: [PATCH net-next 3/5] net: phy: remove gen10g_config_init
Quoted 5 lines · Heiner Kallweit
ETHTOOL_LINK_MODE_10000baseT_Full_BITis set anyway in the supported and advertising bitmap because it's part ofPHY_10GBIT_FEATURES. And all users ofgen10g_config_initusePHY_10GBIT_FEATURES.Signed-off-by Heiner Kallweit <[email protected]>
Andrew
Heiner Kallweit
maintainerPATCH 4/5 net: phy: don't export gen10g_read_status
In reply to Heiner Kallweitgen10g_read_status is deprecated, therefore stop exporting it. We don't want to encourage anybody to use it.
--- drivers/net/phy/phy-c45.c | 3 +-- include/linux/phy.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/phy/phy-c45.c +1 -2
@@ -499,7 +499,7 @@ int gen10g_config_aneg(struct phy_device *phydev) }EXPORT_SYMBOL_GPL (gen10g_config_aneg); -int gen10g_read_status (struct phy_device *phydev) +static int gen10g_read_status (struct phy_device *phydev) {/* For now just lie and say it's 10G all the time */ phydev->speed =SPEED_10000 ;
@@ -507,7 +507,6 @@ int gen10g_read_status(struct phy_device *phydev)return genphy_c45_read_link (phydev); } -EXPORT_SYMBOL_GPL (gen10g_read_status);int gen10g_no_soft_reset (struct phy_device *phydev) {
include/linux/phy.h +0 -1
@@ -1119,7 +1119,6 @@ int genphy_c45_read_status(struct phy_device *phydev);/* The gen10g_* functions are the old Clause 45 stub */ int gen10g_config_aneg (struct phy_device *phydev); -int gen10g_read_status (struct phy_device *phydev);int gen10g_no_soft_reset (struct phy_device *phydev);static inline int phy_read_status (struct phy_device *phydev)
Signature · 1 line
2.21.0
Re: [PATCH net-next 4/5] net: phy: don't export gen10g_read_status
Quoted 4 lines · Heiner Kallweit
gen10g_read_statusis deprecated, therefore stop exporting it. We don't want to encourage anybody to use it.Signed-off-by Heiner Kallweit <[email protected]>
Andrew
Andrew Lunn
maintainerRe: [PATCH net-next 4/5] net: phy: don't export gen10g_read_status
In reply to Heiner KallweitQuoted 2 lines · Heiner Kallweit
gen10g_read_statusis deprecated, therefore stop exporting it. We don't want to encourage anybody to use it.
Hi Florian, Heiner
We should consider what we want to do with the generic 10G driver.
Can a c45 PHY be expected to work using a generic driver? We know 1000BaseT is not going to work, that needs vendor registers. But the rest might?
I think we either need to drop the generic 10G driver, or make it use all the new code which has been added over the last month.
Andrew
Heiner Kallweit
maintainerRe: [PATCH net-next 4/5] net: phy: don't export gen10g_read_status
Quoted 6 lines · Andrew Lunn
Quoted 2 lines · Heiner Kallweit
gen10g_read_statusis deprecated, therefore stop exporting it. We don't want to encourage anybody to use it.Hi Florian, Heiner
Hi Andrew,
Quoted 6 lines
We should consider what we want to do with the generic 10G driver.
Can a c45 PHY be expected to work using a generic driver? We know 1000BaseT is not going to work, that needs vendor registers. But the rest might?
I think so. When looking at the Aquantia driver it should work with reduced functionality with a generic c45 driver.
Quoted 3 lines
I think we either need to drop the generic 10G driver, or make it use all the new code which has been added over the last month.
Not sure whether anybody is relying on the gen10g driver currently. I'd say we could replace gen10g with a genc45 driver. It could provide the basic functionality for a new C45 PHY model until there's a dedicated PHY driver supporting the vendor-specific stuff and 1000BaseT.
Quoted 2 lines
Andrew
Heiner
Re: [PATCH net-next 4/5] net: phy: don't export gen10g_read_status
Quoted 1 line · Heiner Kallweit
Not sure whether anybody is relying on the gen10g driver currently.
I do for stmmac (code not upstreamed yet) and it works okay. For debug purposes I ended up writing my own phy driver but this is a plain copy of Generic 10G driver + reset and suspend/resume callbacks.
Andrew Lunn
maintainerRe: [PATCH net-next 4/5] net: phy: don't export gen10g_read_status
Quoted 7 lines · Jose Abreu
Quoted 1 line · Heiner Kallweit
Not sure whether anybody is relying on the gen10g driver currently.
I do for stmmac (code not upstreamed yet) and it works okay. For debug purposes I ended up writing my own phy driver but this is a plain copy of Generic 10G driver + reset and suspend/resume callbacks.
I strongly suggest you write a proper PHY driver. There are horrible assumptions in the gen10g, like only 10G support. In order to make it more general purpose, asking the PHY what it actually supports, etc might break your use case. We then need to decided, is that a regression, are we forced to leave it alone, or since your code is not yet upstream, it is not a regression, and we are O.K. breaking it, in order to make upstream code better?
Andrew
Heiner Kallweit
maintainerPATCH 5/5 net: phy: remove gen10g_no_soft_reset
In reply to Heiner Kallweitgenphy_no_soft_reset and gen10g_no_soft_reset are both the same no-ops, one is enough.
--- drivers/net/phy/cortina.c | 2 +- drivers/net/phy/marvell10g.c | 4 ++-- drivers/net/phy/phy-c45.c | 9 +-------- drivers/net/phy/teranetics.c | 2 +- include/linux/phy.h | 1 - 5 files changed, 5 insertions(+), 13 deletions(-)
drivers/net/phy/cortina.c +1 -1
@@ -82,7 +82,7 @@ static struct phy_driver cortina_driver[] = { .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = cortina_read_status, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .probe = cortina_probe, }, };
drivers/net/phy/marvell10g.c +2 -2
@@ -469,7 +469,7 @@ static struct phy_driver mv3310_drivers[] = { .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x3310", .get_features = mv3310_get_features, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .config_init = mv3310_config_init, .probe = mv3310_probe, .suspend = mv3310_suspend,
@@ -484,7 +484,7 @@ static struct phy_driver mv3310_drivers[] = { .name = "mv88x2110", .features = PHY_10GBIT_FEATURES, .probe = mv3310_probe, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .config_init = mv3310_config_init, .config_aneg = mv3310_config_aneg, .aneg_done = mv3310_aneg_done,
drivers/net/phy/phy-c45.c +1 -8
@@ -508,18 +508,11 @@ static int gen10g_read_status(struct phy_device *phydev)return genphy_c45_read_link (phydev); } -int gen10g_no_soft_reset (struct phy_device *phydev) -{ -/* Do nothing for now */ -return 0 ; -} -EXPORT_SYMBOL_GPL (gen10g_no_soft_reset); -struct phy_driver genphy_10g_driver = { .phy_id =0xffffffff , .phy_id_mask =0xffffffff , .name ="Generic 10G PHY" , - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .features =PHY_10GBIT_FEATURES , .config_aneg = gen10g_config_aneg, .read_status = gen10g_read_status,
drivers/net/phy/teranetics.c +1 -1
@@ -78,7 +78,7 @@ static struct phy_driver teranetics_driver[] = { .phy_id_mask = 0xffffffff, .name = "Teranetics TN2020", .features = PHY_10GBIT_FEATURES, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .aneg_done = teranetics_aneg_done, .config_aneg = gen10g_config_aneg, .read_status = teranetics_read_status,
include/linux/phy.h +0 -1
@@ -1119,7 +1119,6 @@ int genphy_c45_read_status(struct phy_device *phydev);/* The gen10g_* functions are the old Clause 45 stub */ int gen10g_config_aneg (struct phy_device *phydev); -int gen10g_no_soft_reset (struct phy_device *phydev);static inline int phy_read_status (struct phy_device *phydev) {
Signature · 1 line
2.21.0
Re: [PATCH net-next 5/5] net: phy: remove gen10g_no_soft_reset
Quoted 4 lines · Heiner Kallweit
genphy_no_soft_resetandgen10g_no_soft_resetare both the same no-ops, one is enough.Signed-off-by Heiner Kallweit <[email protected]>
Andrew
David Miller
maintainerFrom: Heiner Kallweit <[email protected]>
Date: Sat, 2 Mar 2019 17:09:06 +0100
Quoted 3 lines
The old
gen10g_functions are mainly stubs and have been superseded bygenphy_c45_equivalents. So lets remove / hide the old functions as far as possible.
Series applied, thanks Heiner.