diff mbox series

[net-next] net: ethernet: mediatek: add ethtool EEE callbacks

Message ID 20250208092732.3136629-1-dqfext@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ethernet: mediatek: add ethtool EEE callbacks | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-11--00-00 (tests: 889)

Commit Message

Qingfang Deng Feb. 8, 2025, 9:27 a.m. UTC
Allow users to adjust the EEE settings of an attached PHY.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Russell King (Oracle) Feb. 8, 2025, 9:29 a.m. UTC | #1
On Sat, Feb 08, 2025 at 05:27:32PM +0800, Qingfang Deng wrote:
> Allow users to adjust the EEE settings of an attached PHY.

Why do you need to do this? Does the MAC support EEE?
Qingfang Deng Feb. 8, 2025, 9:48 a.m. UTC | #2
On Sat, Feb 8, 2025 at 5:29 PM Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
>
> On Sat, Feb 08, 2025 at 05:27:32PM +0800, Qingfang Deng wrote:
> > Allow users to adjust the EEE settings of an attached PHY.
>
> Why do you need to do this? Does the MAC support EEE?

Yes, the MAC supports EEE.

>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Russell King (Oracle) Feb. 8, 2025, 9:55 a.m. UTC | #3
On Sat, Feb 08, 2025 at 05:48:46PM +0800, Qingfang Deng wrote:
> On Sat, Feb 8, 2025 at 5:29 PM Russell King (Oracle)
> <linux@armlinux.org.uk> wrote:
> >
> > On Sat, Feb 08, 2025 at 05:27:32PM +0800, Qingfang Deng wrote:
> > > Allow users to adjust the EEE settings of an attached PHY.
> >
> > Why do you need to do this? Does the MAC support EEE?
> 
> Yes, the MAC supports EEE.

Doesn't it need a bit more code to configure the MAC?
Qingfang Deng Feb. 8, 2025, 10:14 a.m. UTC | #4
On Sat, Feb 8, 2025 at 5:55 PM Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
> Doesn't it need a bit more code to configure the MAC?

I think you're right. The MT7622 reference manual does not mention the
EEE configuration register so I assumed it would be automatically
enabled.
I just checked the mtk_eth_soc.h and found two unused defs
"MAC_MSR_EEE1G" and "MAC_MSR_EEE100M". I will use those to enable EEE.

>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 53485142938c..014de2c2624b 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4474,6 +4474,20 @@  static int mtk_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
 	return phylink_ethtool_set_pauseparam(mac->phylink, pause);
 }
 
+static int mtk_get_eee(struct net_device *dev, struct ethtool_keee *edata)
+{
+	struct mtk_mac *mac = netdev_priv(dev);
+
+	return phylink_ethtool_get_eee(mac->phylink, edata);
+}
+
+static int mtk_set_eee(struct net_device *dev, struct ethtool_keee *edata)
+{
+	struct mtk_mac *mac = netdev_priv(dev);
+
+	return phylink_ethtool_set_eee(mac->phylink, edata);
+}
+
 static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb,
 			    struct net_device *sb_dev)
 {
@@ -4506,6 +4520,8 @@  static const struct ethtool_ops mtk_ethtool_ops = {
 	.set_pauseparam		= mtk_set_pauseparam,
 	.get_rxnfc		= mtk_get_rxnfc,
 	.set_rxnfc		= mtk_set_rxnfc,
+	.get_eee		= mtk_get_eee,
+	.set_eee		= mtk_set_eee,
 };
 
 static const struct net_device_ops mtk_netdev_ops = {