From nobody Tue Apr 7 18:46:39 2026 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9E8442EEB0; Fri, 27 Feb 2026 15:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204929; cv=none; b=e4+t+0US8/Qo44wxcbUjWVdTdzBFYOK2xELedXIy520efQbHVd5K+tk+9ZsJrkSbHGEUzPNzLky1qEfjoS6LSuUI4ct09k3gWw9HwCLcdrvF29Xv0ClgcHE1Xbek9YOfaAE4IALFJ84FxErm8bBfTykQic9S7FjiU9TvaeUlJdA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204929; c=relaxed/simple; bh=f2kfGH116KzX79wZr+txjpVvF2HZyCV+Oj53yvAZHxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cetfvnCr7L3w/ybxnMbiXacSk7KTcvNBqCPd/DVYiyzwq4D2/iRUjXb4ZGGU40AwYWA711h1pTC8kLOvIWtCmvTHLtUi61Upm0vtzMB2kI/fuxI1dvuFg8k1MUIBOrIf4P2Ql4pnyOMcrdJzIArzVcRG5JsA6XBLhScTf0vM2Ic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=sa8TUGGk; arc=none smtp.client-ip=194.13.80.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="sa8TUGGk" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DAFC7A4FB6; Fri, 27 Feb 2026 16:08:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1772204923; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MI/AUX7s9MIyRYPCeAlGjNBvlJqOiHqYeew4KPUYIWE=; b=sa8TUGGkDWZM1Q6kUBTwKY7h3GtGstYySJ8pW8MCJ48wScleMBsFabSH9i1XWQmlNjyugp KkvVi7tOnklqoo7M7kYrbmi93Z+fb2vC1zzW606h3/9e+DJaM6B4v1Zm1BjnvGuYFt660W dCIsXvOsVwLc4+jWUo+Bw8y1CoA3WiFOMLNoLyUfFblqjCLPp2YDIlw2j99sJBdjS6Uu1X Nk5dJOwx8NhDbQKUkuDcwEO8ttfdHzVpCy/su/D73OLkpf6B2ABXxJqTrwHbieZHeiUSPo 2YvAhH+zf8Y3Hk3sAadY84LCZ69KyY4HZ2DvoPdHJYx+DHTp4MJTPOjdGxqx6w== From: Nicolai Buchwitz To: netdev@vger.kernel.org Cc: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, claudiu.beznea@tuxon.dev, nicolas.ferre@microchip.com, linux-kernel@vger.kernel.org, theo.lebrun@bootlin.com, phil@raspberrypi.com, Nicolai Buchwitz Subject: [PATCH net-next v5 1/5] net: cadence: macb: add EEE LPI statistics counters Date: Fri, 27 Feb 2026 16:06:06 +0100 Message-ID: <20260227150610.242215-2-nb@tipi-net.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260227150610.242215-1-nb@tipi-net.de> References: <20260227150610.242215-1-nb@tipi-net.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 The GEM MAC provides four read-only, clear-on-read LPI statistics registers at offsets 0x270-0x27c: GEM_RXLPI (0x270): RX LPI transition count (16-bit) GEM_RXLPITIME (0x274): cumulative RX LPI time (24-bit) GEM_TXLPI (0x278): TX LPI transition count (16-bit) GEM_TXLPITIME (0x27c): cumulative TX LPI time (24-bit) Add register offset definitions, extend struct gem_stats with corresponding u64 software accumulators, and register the four counters in gem_statistics[] so they appear in ethtool -S output. Because the hardware counters clear on read, the existing macb_update_stats() path accumulates them into the u64 fields on every stats poll, preventing loss between userspace reads. These registers are present on SAMA5D2, SAME70, PIC32CZ, and RP1 variants of the Cadence GEM IP and have been confirmed on RP1 via devmem reads. Reviewed-by: Th=C3=A9o Lebrun Signed-off-by: Nicolai Buchwitz Reviewed-by: Claudiu Beznea --- drivers/net/ethernet/cadence/macb.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 87414a2ddf6e..19aa98d01c8c 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -170,6 +170,10 @@ #define GEM_PCSANNPTX 0x021c /* PCS AN Next Page TX */ #define GEM_PCSANNPLP 0x0220 /* PCS AN Next Page LP */ #define GEM_PCSANEXTSTS 0x023c /* PCS AN Extended Status */ +#define GEM_RXLPI 0x0270 /* RX LPI Transitions */ +#define GEM_RXLPITIME 0x0274 /* RX LPI Time */ +#define GEM_TXLPI 0x0278 /* TX LPI Transitions */ +#define GEM_TXLPITIME 0x027c /* TX LPI Time */ #define GEM_DCFG1 0x0280 /* Design Config 1 */ #define GEM_DCFG2 0x0284 /* Design Config 2 */ #define GEM_DCFG3 0x0288 /* Design Config 3 */ @@ -1043,6 +1047,10 @@ struct gem_stats { u64 rx_ip_header_checksum_errors; u64 rx_tcp_checksum_errors; u64 rx_udp_checksum_errors; + u64 rx_lpi_transitions; + u64 rx_lpi_time; + u64 tx_lpi_transitions; + u64 tx_lpi_time; }; =20 /* Describes the name and offset of an individual statistic register, as @@ -1142,6 +1150,10 @@ static const struct gem_statistic gem_statistics[] = =3D { GEM_BIT(NDS_RXERR)), GEM_STAT_TITLE_BITS(RXUDPCCNT, "rx_udp_checksum_errors", GEM_BIT(NDS_RXERR)), + GEM_STAT_TITLE(RXLPI, "rx_lpi_transitions"), + GEM_STAT_TITLE(RXLPITIME, "rx_lpi_time"), + GEM_STAT_TITLE(TXLPI, "tx_lpi_transitions"), + GEM_STAT_TITLE(TXLPITIME, "tx_lpi_time"), }; =20 #define GEM_STATS_LEN ARRAY_SIZE(gem_statistics) --=20 2.51.0 From nobody Tue Apr 7 18:46:39 2026 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60FCD42EEBF; Fri, 27 Feb 2026 15:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204929; cv=none; b=pmsp1q9YgNYaJeQvml21cxBwS+FI0CC4aXlSDMY4I971mrkj8oes6ZgxNZ+UtNrcA78DRAsGVVuwKJu1Grgn5Quy+EU4WmZloV/HbVHuDj1tdQiyCnrtfWZaxHjfTjOW1PsfzEJU2yULzuVTaM8EWDfpP/796Z67kYFgJ7/SVAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204929; c=relaxed/simple; bh=deKl210dEPTH61NE3uPje7uAdxuwszbBLhacecZfR2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Xzb8pftl+SF2cGOWd8XM7iWrr0o7ab8AP4A4YZHAJD32dllhNmAePi4SOC8tWYzMBOZ/l2KIFa3018i6AEStyoBh9oIrjRpSBrfk2I6GMRbU5b3RZ6DMTRGKtqYlhm3L0UT9Ops3kcnbwIfT6NM3ID4W7xDKEH7cYsbf2KGfyN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=i6Jlrp90; arc=none smtp.client-ip=194.13.80.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="i6Jlrp90" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B361BA5004; Fri, 27 Feb 2026 16:08:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1772204924; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=8GC3kyRUMLQo0KzjbX6agpaPEYobEOwV6XjlkKdmHeE=; b=i6Jlrp90ugTYEzrEOuBnlICkLsEyot9xoladiMB+i+9XnLq7QHbvJnuuAJvYLfv26j86I7 Rn6vSo0XwrywloxUWF6oTtFgfAN2nvh9X4Zcfpp28C+Jgfy+/D/kuYO3ZLkn4z5fJoECC7 8WOVMvfPquFWxlHYIk174US3z82LhWRGk6SqvZ2KKMgB+xNZWU6NPf/owfF/AWdtI5sfLZ 3qQ+UFiVKeG8p4CrGHOtco2vm35+bIec+wgzuIWph+trc258TwkzDnGIV9fmUUUW/2sSgg Y6Npola12sEO3TDpN1ww2fxu+LvmHxh3t/j5Kx0i3tTO1dNGPld0TYUqc08S7g== From: Nicolai Buchwitz To: netdev@vger.kernel.org Cc: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, claudiu.beznea@tuxon.dev, nicolas.ferre@microchip.com, linux-kernel@vger.kernel.org, theo.lebrun@bootlin.com, phil@raspberrypi.com, Nicolai Buchwitz Subject: [PATCH net-next v5 2/5] net: cadence: macb: implement EEE TX LPI support Date: Fri, 27 Feb 2026 16:06:07 +0100 Message-ID: <20260227150610.242215-3-nb@tipi-net.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260227150610.242215-1-nb@tipi-net.de> References: <20260227150610.242215-1-nb@tipi-net.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 The GEM MAC has hardware LPI registers (NCR bit 19: TXLPIEN) but no built-in idle timer, so asserting TXLPIEN blocks all TX immediately with no automatic wake. A software idle timer is required, as noted in Microchip documentation (section 40.6.19): "It is best to use firmware to control LPI." Implement phylink managed EEE using the mac_enable_tx_lpi and mac_disable_tx_lpi callbacks: - macb_tx_lpi_set(): atomically sets or clears TXLPIEN under the existing bp->lock spinlock; returns bool indicating whether the register actually changed, avoiding redundant writes. - macb_tx_lpi_work_fn(): delayed_work handler that enters LPI if all TX queues are idle and EEE is still active. - macb_tx_lpi_schedule(): arms the work timer using the LPI timer value provided by phylink (default 250 ms). Called from macb_tx_complete() after each TX drain so the idle countdown restarts whenever the ring goes quiet. - macb_tx_lpi_wake(): called from macb_start_xmit() before TSTART. Clears TXLPIEN and applies a 50 us udelay for PHY wake (IEEE 802.3az Tw_sys_tx is 16.5 us for 1000BASE-T / 30 us for 100BASE-TX; GEM has no hardware enforcement). Only delays when TXLPIEN was actually set, avoiding overhead on the common path. The delay is placed after tx_head is advanced so the work_fn's queue-idle check sees a non-empty ring and cannot race back into LPI before the frame is transmitted. - mac_enable_tx_lpi: stores the timer and sets eee_active, then defers the first LPI entry by 1 second per IEEE 802.3az section 22.7a. - mac_disable_tx_lpi: clears eee_active, cancels the work, and deasserts TXLPIEN. Populate phylink_config lpi_interfaces (MII, GMII, RGMII variants) and lpi_capabilities (MAC_100FD | MAC_1000FD) so phylink can negotiate EEE with the PHY and call the callbacks appropriately. Set lpi_timer_default to 250000 us and eee_enabled_default to true. Reviewed-by: Th=C3=A9o Lebrun Signed-off-by: Nicolai Buchwitz Reviewed-by: Claudiu Beznea --- drivers/net/ethernet/cadence/macb.h | 8 ++ drivers/net/ethernet/cadence/macb_main.c | 112 +++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 19aa98d01c8c..c69828b27dae 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -309,6 +309,8 @@ #define MACB_IRXFCS_SIZE 1 =20 /* GEM specific NCR bitfields. */ +#define GEM_TXLPIEN_OFFSET 19 +#define GEM_TXLPIEN_SIZE 1 #define GEM_ENABLE_HS_MAC_OFFSET 31 #define GEM_ENABLE_HS_MAC_SIZE 1 =20 @@ -783,6 +785,7 @@ #define MACB_CAPS_DMA_PTP BIT(22) #define MACB_CAPS_RSC BIT(23) #define MACB_CAPS_NO_LSO BIT(24) +#define MACB_CAPS_EEE BIT(25) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 @@ -1369,6 +1372,11 @@ struct macb { =20 struct work_struct hresp_err_bh_work; =20 + /* EEE / LPI state */ + bool eee_active; + struct delayed_work tx_lpi_work; + u32 tx_lpi_timer; + int rx_bd_rd_prefetch; int tx_bd_rd_prefetch; =20 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 02eab26fd98b..c23485f049d3 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -621,6 +622,94 @@ static const struct phylink_pcs_ops macb_phylink_pcs_o= ps =3D { .pcs_config =3D macb_pcs_config, }; =20 +static bool macb_tx_lpi_set(struct macb *bp, bool enable) +{ + unsigned long flags; + u32 old, ncr; + + spin_lock_irqsave(&bp->lock, flags); + ncr =3D macb_readl(bp, NCR); + old =3D ncr; + if (enable) + ncr |=3D GEM_BIT(TXLPIEN); + else + ncr &=3D ~GEM_BIT(TXLPIEN); + if (old !=3D ncr) + macb_writel(bp, NCR, ncr); + spin_unlock_irqrestore(&bp->lock, flags); + + return old !=3D ncr; +} + +static bool macb_tx_all_queues_idle(struct macb *bp) +{ + unsigned int q; + + for (q =3D 0; q < bp->num_queues; q++) { + struct macb_queue *queue =3D &bp->queues[q]; + + if (queue->tx_head !=3D queue->tx_tail) + return false; + } + return true; +} + +static void macb_tx_lpi_work_fn(struct work_struct *work) +{ + struct macb *bp =3D container_of(work, struct macb, tx_lpi_work.work); + + if (bp->eee_active && macb_tx_all_queues_idle(bp)) + macb_tx_lpi_set(bp, true); +} + +static void macb_tx_lpi_schedule(struct macb *bp) +{ + if (bp->eee_active) + mod_delayed_work(system_wq, &bp->tx_lpi_work, + usecs_to_jiffies(bp->tx_lpi_timer)); +} + +/* Wake from LPI before transmitting. The MAC must deassert TXLPIEN + * and wait for the PHY to exit LPI before any frame can be sent. + * IEEE 802.3az Tw_sys is ~17us for 1000BASE-T, ~30us for 100BASE-TX; + * we use a conservative 50us. + */ +static void macb_tx_lpi_wake(struct macb *bp) +{ + if (!macb_tx_lpi_set(bp, false)) + return; + + cancel_delayed_work(&bp->tx_lpi_work); + udelay(50); +} + +static void macb_mac_disable_tx_lpi(struct phylink_config *config) +{ + struct net_device *ndev =3D to_net_dev(config->dev); + struct macb *bp =3D netdev_priv(ndev); + + bp->eee_active =3D false; + cancel_delayed_work_sync(&bp->tx_lpi_work); + macb_tx_lpi_set(bp, false); +} + +static int macb_mac_enable_tx_lpi(struct phylink_config *config, u32 timer, + bool tx_clk_stop) +{ + struct net_device *ndev =3D to_net_dev(config->dev); + struct macb *bp =3D netdev_priv(ndev); + + bp->tx_lpi_timer =3D timer; + bp->eee_active =3D true; + + /* Defer initial LPI entry by 1 second after link-up per + * IEEE 802.3az section 22.7a. + */ + mod_delayed_work(system_wq, &bp->tx_lpi_work, msecs_to_jiffies(1000)); + + return 0; +} + static void macb_mac_config(struct phylink_config *config, unsigned int mo= de, const struct phylink_link_state *state) { @@ -769,6 +858,8 @@ static const struct phylink_mac_ops macb_phylink_ops = =3D { .mac_config =3D macb_mac_config, .mac_link_down =3D macb_mac_link_down, .mac_link_up =3D macb_mac_link_up, + .mac_disable_tx_lpi =3D macb_mac_disable_tx_lpi, + .mac_enable_tx_lpi =3D macb_mac_enable_tx_lpi, }; =20 static bool macb_phy_handle_exists(struct device_node *dn) @@ -864,6 +955,18 @@ static int macb_mii_probe(struct net_device *dev) } } =20 + /* Configure EEE LPI if supported */ + if (bp->caps & MACB_CAPS_EEE) { + __set_bit(PHY_INTERFACE_MODE_MII, + bp->phylink_config.lpi_interfaces); + __set_bit(PHY_INTERFACE_MODE_GMII, + bp->phylink_config.lpi_interfaces); + phy_interface_set_rgmii(bp->phylink_config.lpi_interfaces); + bp->phylink_config.lpi_capabilities =3D MAC_100FD | MAC_1000FD; + bp->phylink_config.lpi_timer_default =3D 250000; + bp->phylink_config.eee_enabled_default =3D true; + } + bp->phylink =3D phylink_create(&bp->phylink_config, bp->pdev->dev.fwnode, bp->phy_interface, &macb_phylink_ops); if (IS_ERR(bp->phylink)) { @@ -1260,6 +1363,9 @@ static int macb_tx_complete(struct macb_queue *queue,= int budget) netif_wake_subqueue(bp->dev, queue_index); spin_unlock_irqrestore(&queue->tx_ptr_lock, flags); =20 + if (packets) + macb_tx_lpi_schedule(bp); + return packets; } =20 @@ -2365,6 +2471,8 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *sk= b, struct net_device *dev) netdev_tx_sent_queue(netdev_get_tx_queue(bp->dev, queue_index), skb->len); =20 + macb_tx_lpi_wake(bp); + spin_lock(&bp->lock); macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); spin_unlock(&bp->lock); @@ -3026,6 +3134,8 @@ static int macb_close(struct net_device *dev) netdev_tx_reset_queue(netdev_get_tx_queue(dev, q)); } =20 + cancel_delayed_work_sync(&bp->tx_lpi_work); + phylink_stop(bp->phylink); phylink_disconnect_phy(bp->phylink); =20 @@ -5633,6 +5743,7 @@ static int macb_probe(struct platform_device *pdev) } =20 INIT_WORK(&bp->hresp_err_bh_work, macb_hresp_error_task); + INIT_DELAYED_WORK(&bp->tx_lpi_work, macb_tx_lpi_work_fn); =20 netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n", macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID), @@ -5676,6 +5787,7 @@ static void macb_remove(struct platform_device *pdev) mdiobus_free(bp->mii_bus); =20 device_set_wakeup_enable(&bp->pdev->dev, 0); + cancel_delayed_work_sync(&bp->tx_lpi_work); cancel_work_sync(&bp->hresp_err_bh_work); pm_runtime_disable(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); --=20 2.51.0 From nobody Tue Apr 7 18:46:39 2026 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90B1942EEC1; Fri, 27 Feb 2026 15:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204930; cv=none; b=gKtzzmBxTCe8FaKGxKGDsLbTW0ACcqgI1ctkcvLG83aqiWLLt7eHviIUJSZjHYZ/Ya/gYMutHUyanaIKqNEnEqdhU90ItsStTAhA6MhyhBqqIHomP2utDkKk6t34PEFjz0U6nZ80ko0icJJ1Jp6fU+G/WQUT28VsSQbLMdFcEgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204930; c=relaxed/simple; bh=QkwfhhWgXcsXTJC24lyZEtiFjpVR0EkyXcmT9TMSAI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m+KeN4mSq+ovlU65uozP6GFnyuCRsHsuTOtBhvwZ395URzSV8wUM5rkMOULwAvTn6K4PJVSXtOQBkJSaxbf1QK37d1AlvJTAMSulU4Mg0/NCeHdu2Qa7EJimyFb15lYXoAY+w0jhM8qFqfq5mo6MXwov4IzZnJ3Wz+GDXNfAMlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=52PbBd3N; arc=none smtp.client-ip=194.13.80.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="52PbBd3N" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9BA53A5005; Fri, 27 Feb 2026 16:08:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1772204925; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=lSCPFfeGozLmMJQnP50afD8kI4SZlBMY+0sjS3RHZFk=; b=52PbBd3NIZ0bvU3ci+T9Jsjr5VdLRkqGfFb8y2R6L6ZOCCdYzoJEuKohIoluTcnW0P1hcY 8bNHbO/icYArOP9krOpRsmy1AGW2cTJx1Kzd26jNrvAOqn/CXNYjtzJkbKADbS8C1jYplP 4QjsEFKjJQZ/l5z2bK00xTq2/9Nmpe7/37W4y1TdmODzEP1Gpgv6bqSmNqy8ADJMAjnNAE fQq5jEQcMqMFLqtXQ/Tu0JyY8BHvxBK+0yCzfMeihFvVqbFyrpU3Qx1+kFSG+AnjwYUzkm yBwv/YsyZ94HXk3PFwqeuvEOb3wT+BHHrZDsFsvu+naROOe8Ir6g/txuNhnQWQ== From: Nicolai Buchwitz To: netdev@vger.kernel.org Cc: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, claudiu.beznea@tuxon.dev, nicolas.ferre@microchip.com, linux-kernel@vger.kernel.org, theo.lebrun@bootlin.com, phil@raspberrypi.com, Nicolai Buchwitz Subject: [PATCH net-next v5 3/5] net: cadence: macb: add ethtool EEE support Date: Fri, 27 Feb 2026 16:06:08 +0100 Message-ID: <20260227150610.242215-4-nb@tipi-net.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260227150610.242215-1-nb@tipi-net.de> References: <20260227150610.242215-1-nb@tipi-net.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Implement get_eee and set_eee ethtool ops for GEM as simple passthroughs to phylink_ethtool_get_eee() and phylink_ethtool_set_eee(). No MACB_CAPS_EEE guard is needed: phylink returns -EOPNOTSUPP from both ops when mac_supports_eee is false, which is the case when lpi_capabilities and lpi_interfaces are not populated. Those fields are only set when MACB_CAPS_EEE is present (previous patch), so phylink already handles the unsupported case correctly. Reviewed-by: Th=C3=A9o Lebrun Signed-off-by: Nicolai Buchwitz Reviewed-by: Claudiu Beznea --- drivers/net/ethernet/cadence/macb_main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index c23485f049d3..3e724417d444 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4050,6 +4050,20 @@ static const struct ethtool_ops macb_ethtool_ops =3D= { .set_ringparam =3D macb_set_ringparam, }; =20 +static int macb_get_eee(struct net_device *dev, struct ethtool_keee *eee) +{ + struct macb *bp =3D netdev_priv(dev); + + return phylink_ethtool_get_eee(bp->phylink, eee); +} + +static int macb_set_eee(struct net_device *dev, struct ethtool_keee *eee) +{ + struct macb *bp =3D netdev_priv(dev); + + return phylink_ethtool_set_eee(bp->phylink, eee); +} + static const struct ethtool_ops gem_ethtool_ops =3D { .get_regs_len =3D macb_get_regs_len, .get_regs =3D macb_get_regs, @@ -4072,6 +4086,8 @@ static const struct ethtool_ops gem_ethtool_ops =3D { .set_rxnfc =3D gem_set_rxnfc, .get_rx_ring_count =3D gem_get_rx_ring_count, .nway_reset =3D phy_ethtool_nway_reset, + .get_eee =3D macb_get_eee, + .set_eee =3D macb_set_eee, }; =20 static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) --=20 2.51.0 From nobody Tue Apr 7 18:46:39 2026 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7FC342EEC3; Fri, 27 Feb 2026 15:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204929; cv=none; b=Qx139c0MyH7qCH/gxNGcyyolIuMYn/omajrRAqB6ozu/kRjLH/0ZWsOn5Ixm90PEBeiKih6LqeUetAUKFNjjTwZeONSJ4bnOVBgomVYVRKsnycT1c+zV3XuYxxXW0YxrWAX6IeXv7SBjAEHEOe5XrXo/aVzYUopxLQzK2dPmgLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204929; c=relaxed/simple; bh=ZPK0Z3oJzLp5z+yIV5jrJ30aG+zF/bTYYWFChZzHvlA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G2qjHjknYNFgPFi7bLQJqUmttXWBs9C4hv6BWeCBCqIc7L/mTUr1+C6ZBf/3BCZVnourOvtYyxwQAS69jrJKD6PH9CQzo79S7p3u8hSDYjaHO/n7eMVq7ghM0E7OQj6zaZoMwaJp/himi2I9XpZcsuhm0/+mKjtUhErnf3Q9zEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=QH80glPb; arc=none smtp.client-ip=194.13.80.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="QH80glPb" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 55F5BA5007; Fri, 27 Feb 2026 16:08:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1772204925; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=XUWlS3K11Yw45ldTqgq8qbaqscSO6wYBy4epMkSa2kU=; b=QH80glPb/jUHmBW6icYjEpABRJYcW6se1Af4WhGbMPCB3O06v9tOrBcCJUv5byq/ZBApr2 HDpue/lI0/XO9JcgkLGt+uiN47/j4zyfOVckj4Sa/gf3XsUT4+3vxbraOCNL9wKc4/1z0j K/uGhtNBPcF6ZEjin0GsuQGbx1hIyqIvcjKZCKBF1zPqTmBHcGjNnkEYw/xWhfxvFyCU7W MSA8gLcjVUXOhrp7n3zYNWVBs791tmWEKnsppVVOXXZ69cfpXBPz4WfW+IfDYmIKaJUL7j w4a/GLMjBjvB6ueqKE3jxzsS9ZfUrJGhLPcLicEtrI6MPxbq264guCTFFaqqPA== From: Nicolai Buchwitz To: netdev@vger.kernel.org Cc: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, claudiu.beznea@tuxon.dev, nicolas.ferre@microchip.com, linux-kernel@vger.kernel.org, theo.lebrun@bootlin.com, phil@raspberrypi.com, Nicolai Buchwitz Subject: [PATCH net-next v5 4/5] net: cadence: macb: enable EEE for Raspberry Pi RP1 Date: Fri, 27 Feb 2026 16:06:09 +0100 Message-ID: <20260227150610.242215-5-nb@tipi-net.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260227150610.242215-1-nb@tipi-net.de> References: <20260227150610.242215-1-nb@tipi-net.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Set MACB_CAPS_EEE for the Raspberry Pi 5 RP1 southbridge (Cadence GEM_GXL rev 0x00070109 paired with BCM54213PE PHY). EEE has been verified on RP1 hardware: the LPI counter registers at 0x270-0x27c return valid data, the TXLPIEN bit in NCR (bit 19) controls LPI transmission correctly, and ethtool --show-eee reports the negotiated state after link-up. Other GEM variants that share the same LPI register layout (SAMA5D2, SAME70, PIC32CZ) can be enabled by adding MACB_CAPS_EEE to their respective config entries once tested. Reviewed-by: Th=C3=A9o Lebrun Signed-off-by: Nicolai Buchwitz Reviewed-by: Claudiu Beznea --- drivers/net/ethernet/cadence/macb_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 3e724417d444..0196a13c0688 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5529,7 +5529,8 @@ static const struct macb_config eyeq5_config =3D { static const struct macb_config raspberrypi_rp1_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_GEM_HAS_PTP | + MACB_CAPS_EEE, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, --=20 2.51.0 From nobody Tue Apr 7 18:46:39 2026 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16E2643C046; Fri, 27 Feb 2026 15:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204932; cv=none; b=dB7/C6aG/RBuR5fTD9SOvMPR7BRiV8mVPQlg/sBaNCwb7UxZ/v9LL7N5mynTTYp3sk0xMwIKO1AGf876cNqETslVooG2Yx/HQD1w6MurLVaYSA3JeUEkIWaVfIhjHZe8xLG5i90tk47buMPajgchB9A6B+FDl3V+Hh5FlZvPTSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772204932; c=relaxed/simple; bh=mYoK1FihVJvEr0NMlfRRBuE7/55cVkFDth49zLmyEKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iACgzTFw2hbSB2mlTKnPTGw5+3ej9HoFP2C+mOw4wVupQ7Xe62emy+jTPYjmS6mxWx9ySqaYJfhwIQm8hNWOLgJcBgqFiYWFHEM+s/KHDcoMEKojPwvVmUYCub90/Jmgoi8rEfeR+vb0Hmww486K86i0/9/qOoxTErXm+jdM40M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=E3eIrlyr; arc=none smtp.client-ip=194.13.80.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="E3eIrlyr" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 00EFCA5009; Fri, 27 Feb 2026 16:08:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1772204926; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=c5YmtHEwmcbZmGCVvz6y3GMkg0blJKUkEfPrdXSW/30=; b=E3eIrlyrmu6UOSb0bcHzxlrUE61b0rdu1dNwgAA7tDneUOw6D8jXgm+UL5lmgoLLODAZoy e2wyLbxIkkfgqCXW6u1YVIyXUM2ha3TBxdCD575yTRfZv/2YrZPT8Cl6PRyKCHUXZPoCsh 7S0ETUNJh30K9TjyhRluRWoQgkzS29eq+FwVpUfZ5vw7zq9C0FMj9Ux6YThHypOw0nS7XH idIgdEyu+gbymX9/XT7z2nx3XVEW+TXHR8F1kwa6zj3TrQK4JnruMiRrHBIDgHtz+uiUdb KKNrpJT1kwnsVtbwHB7R6KIVGct+i6MeLDAziq7i794dGujT+IkU5tKvBcYffQ== From: Nicolai Buchwitz To: netdev@vger.kernel.org Cc: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, claudiu.beznea@tuxon.dev, nicolas.ferre@microchip.com, linux-kernel@vger.kernel.org, theo.lebrun@bootlin.com, phil@raspberrypi.com, Nicolai Buchwitz Subject: [PATCH net-next v5 5/5] net: cadence: macb: enable EEE for Mobileye EyeQ5 Date: Fri, 27 Feb 2026 16:06:10 +0100 Message-ID: <20260227150610.242215-6-nb@tipi-net.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260227150610.242215-1-nb@tipi-net.de> References: <20260227150610.242215-1-nb@tipi-net.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Set MACB_CAPS_EEE for the Mobileye EyeQ5 GEM instance. EEE has been verified on EyeQ5 hardware using a loopback setup with ethtool --show-eee confirming EEE active on both ends at 100baseT/Full and 1000baseT/Full. Tested-by: Th=C3=A9o Lebrun Signed-off-by: Nicolai Buchwitz Reviewed-by: Claudiu Beznea --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 0196a13c0688..58a265ee9f9e 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5518,7 +5518,7 @@ static const struct macb_config versal_config =3D { static const struct macb_config eyeq5_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_QUEUE_DISABLE | - MACB_CAPS_NO_LSO, + MACB_CAPS_NO_LSO | MACB_CAPS_EEE, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D eyeq5_init, --=20 2.51.0