diff mbox series

[RFC,14/18] net: dsa: b53: Call phylib for set_eee and get_eee

Message ID 20230217034230.1249661-15-andrew@lunn.ch (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series Rework MAC drivers EEE support | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 5 this patch: 5
netdev/cc_maintainers warning 6 maintainers not CCed: linux-mediatek@lists.infradead.org pabeni@redhat.com kuba@kernel.org edumazet@google.com linux-arm-kernel@lists.infradead.org davem@davemloft.net
netdev/build_clang fail Errors and warnings before: 5 this patch: 5
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Andrew Lunn Feb. 17, 2023, 3:42 a.m. UTC
phylib should be called in order to manage the EEE settings in the
PHY, and to return EEE status such are supported link modes, and what
the link peer supports.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/b53/b53_common.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 1e8eaf143b65..f782a08a9bc9 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2179,6 +2179,7 @@  EXPORT_SYMBOL(b53_eee_init);
 
 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
 {
+	struct dsa_port *dp = dsa_to_port(ds, port);
 	struct b53_device *dev = ds->priv;
 	struct ethtool_eee *p = &dev->ports[port].eee;
 	u16 reg;
@@ -2190,12 +2191,15 @@  int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
 	e->eee_enabled = p->eee_enabled;
 	e->eee_active = !!(reg & BIT(port));
 
+	if (dp->slave->phydev)
+		return phy_ethtool_get_eee(dp->slave->phydev, e);
 	return 0;
 }
 EXPORT_SYMBOL(b53_get_mac_eee);
 
 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
 {
+	struct dsa_port *dp = dsa_to_port(ds, port);
 	struct b53_device *dev = ds->priv;
 	struct ethtool_eee *p = &dev->ports[port].eee;
 
@@ -2205,6 +2209,8 @@  int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
 	p->eee_enabled = e->eee_enabled;
 	b53_eee_enable_set(ds, port, e->eee_enabled);
 
+	if (dp->slave->phydev)
+		return phy_ethtool_set_eee(dp->slave->phydev, e);
 	return 0;
 }
 EXPORT_SYMBOL(b53_set_mac_eee);