netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks
@ 2025-02-08  9:27 Qingfang Deng
  2025-02-08  9:29 ` Russell King (Oracle)
  0 siblings, 1 reply; 5+ messages in thread
From: Qingfang Deng @ 2025-02-08  9:27 UTC (permalink / raw)
  To: Felix Fietkau, Sean Wang, Lorenzo Bianconi, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno, Russell King,
	netdev, linux-kernel, linux-arm-kernel, linux-mediatek

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(+)

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 = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks
  2025-02-08  9:27 [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks Qingfang Deng
@ 2025-02-08  9:29 ` Russell King (Oracle)
  2025-02-08  9:48   ` Qingfang Deng
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2025-02-08  9:29 UTC (permalink / raw)
  To: Qingfang Deng
  Cc: Felix Fietkau, Sean Wang, Lorenzo Bianconi, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

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?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks
  2025-02-08  9:29 ` Russell King (Oracle)
@ 2025-02-08  9:48   ` Qingfang Deng
  2025-02-08  9:55     ` Russell King (Oracle)
  0 siblings, 1 reply; 5+ messages in thread
From: Qingfang Deng @ 2025-02-08  9:48 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Felix Fietkau, Sean Wang, Lorenzo Bianconi, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

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!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks
  2025-02-08  9:48   ` Qingfang Deng
@ 2025-02-08  9:55     ` Russell King (Oracle)
  2025-02-08 10:14       ` Qingfang Deng
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2025-02-08  9:55 UTC (permalink / raw)
  To: Qingfang Deng
  Cc: Felix Fietkau, Sean Wang, Lorenzo Bianconi, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

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?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks
  2025-02-08  9:55     ` Russell King (Oracle)
@ 2025-02-08 10:14       ` Qingfang Deng
  0 siblings, 0 replies; 5+ messages in thread
From: Qingfang Deng @ 2025-02-08 10:14 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Felix Fietkau, Sean Wang, Lorenzo Bianconi, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

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!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-08 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-08  9:27 [PATCH net-next] net: ethernet: mediatek: add ethtool EEE callbacks Qingfang Deng
2025-02-08  9:29 ` Russell King (Oracle)
2025-02-08  9:48   ` Qingfang Deng
2025-02-08  9:55     ` Russell King (Oracle)
2025-02-08 10:14       ` Qingfang Deng

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).