From nobody Sun Feb 8 07:58:51 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 828F72F5A35; Wed, 22 Oct 2025 07:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118720; cv=none; b=uP0QctJ3Dlwg9KGSFTKU3YHzANeaK+5Z1+OKAlgoAOHHEOm31Ojz46w7FUui5IVXYvAzVesCoc2Q+xFpmV92+OGj7n+zc2CYrSJuDhvKWCjSZ5L2KW4E6EA/xviBClCdX48lMRjgG4M8Agzx+EeYeh3K3tt+Jif7vQWJopAkEBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118720; c=relaxed/simple; bh=k4MMwotRueKQ73IFVBunfx4WBg3XwCGO4UhdsRh7hww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XJZg+X92lxHRzVkXv4b6wIwHqMJii1E9JtCA92Bu2mzqzzs8o4QgmYLoaELg4wzDdRSfbLg5aT47cIiPe+nfq3i/9Otk9KFombrFDHV3RjpP8NnPKWdD1Mu5SWKV41A75YU7TZvkJpkFc11VDyuw/nZ0O5WyRNxQRVZetVJ6BdY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=lHMUCVTE; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="lHMUCVTE" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 745EA1A15C9; Wed, 22 Oct 2025 07:38:36 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4B6AC606DC; Wed, 22 Oct 2025 07:38:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D2502102F2429; Wed, 22 Oct 2025 09:38:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761118715; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=L/XpHoQ2KPQc9riZ+r/LMfIVvh/XodPx0VGR9VmHzQ0=; b=lHMUCVTESZ6XAwXDRj3ZuKEmu+tEJG5Ab94czNKnvFzLiSGHTQTigA4J06IjxO7y0NIRHn f+WPfN/mfOUwJNPKdx+bLvR7Oz4VarTAByGBwJ4amNTsrpS/OGupXpmOGIoifjzTUHs9oF e8Wk1p33qqCerz8CFGCpGRvFQ1DW7bDjoHvpoNWLnqMGcukINRRMi/oH8SL5CL+3qakZQ+ vwy4trbmnkOGLL31Yn4SyxeIgXuixl9aZu+hlAUPPR5cf9MLBwh+yil40vW2FIP4Iy/JNJ K4kguJ7rXPzqy67LZA3JV4E+hoGjZT4DDQQN4U+QmSM/dKxu4ZgW4p5LjRTbWw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 22 Oct 2025 09:38:10 +0200 Subject: [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface 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 Message-Id: <20251022-macb-eyeq5-v2-1-7c140abb0581@bootlin.com> References: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> In-Reply-To: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nicolas Ferre , Claudiu Beznea , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= , =?utf-8?q?Gr=C3=A9gory_Clement?= , Maxime Chevallier , Tawfik Bayouk , Thomas Petazzoni , Vladimir Kondratiev , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Add "cdns,eyeq5-gem" as compatible for the integrated GEM block inside Mobileye EyeQ5 SoCs. It is different from other compatibles in two main ways: (1) it requires a generic PHY and (2) it is better to keep TCP Segmentation Offload (TSO) disabled. Signed-off-by: Th=C3=A9o Lebrun Acked-by: Conor Dooley Reviewed-by: Andrew Lunn --- Documentation/devicetree/bindings/net/cdns,macb.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documen= tation/devicetree/bindings/net/cdns,macb.yaml index 02f14a0b72f9..ea8337846ab2 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -57,6 +57,7 @@ properties: - cdns,np4-macb # NP4 SoC devices - microchip,sama7g5-emac # Microchip SAMA7G5 ethernet interfa= ce - microchip,sama7g5-gem # Microchip SAMA7G5 gigabit ethernet= interface + - mobileye,eyeq5-gem # Mobileye EyeQ5 SoCs - raspberrypi,rp1-gem # Raspberry Pi RP1 gigabit ethernet = interface - sifive,fu540-c000-gem # SiFive FU540-C000 SoC =20 @@ -183,6 +184,15 @@ allOf: reg: maxItems: 1 =20 + - if: + properties: + compatible: + contains: + const: mobileye,eyeq5-gem + then: + required: + - phys + unevaluatedProperties: false =20 examples: --=20 2.51.1 From nobody Sun Feb 8 07:58:51 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 C29412741C9; Wed, 22 Oct 2025 07:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118721; cv=none; b=TeOh8Int/AXh6ozYew2dIQM8LlX1ZaVJuyjzVQfHjXLpCCsuCKinZAgoRSJXjoTECWxL4SReOb/x4puo4/6szgSVxYrDS6zVi22cFvCC0kt+QpKcTS9s4e7awAWi0xlG0pb339sWNesoA43zEpLa6DWSVfIzQ9mAJHB4f8EZwtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118721; c=relaxed/simple; bh=zYuYWuESAc0a7O4YIC0N8v3JD6fLF+IzCJxXk3dnd7A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R7NUEX2Hai4D1RZRRs7jbPrqrDVGt3IKQeq0S+DDO6eEu6Wd+OhaWGt2Jt28to2RL2bTh3q2IuPWcW43tqGRCf5FTAAfRSOfzO2OXFfKo8eHTCElYS6RM1XRPWp8yDTrMzOmfl36a8fm6ICcHmsgd3MALHXyoACKCl9atCdA2lg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=iXfDa8TR; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iXfDa8TR" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 74472C0B8BF; Wed, 22 Oct 2025 07:38:18 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 33D18606DC; Wed, 22 Oct 2025 07:38:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A861C102F241B; Wed, 22 Oct 2025 09:38:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761118717; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ieLnXs0DsyK2ap/ThnYKSxhPpCllfrtZ/AjJCBCeDmM=; b=iXfDa8TRAPxJkaias+G8adfVU8hsfC89v28D+whpbSF9WmXBSheK25g2CvGL6sOqyVec3G lU3Mcdudtz2UYAcivdTlYeJuhhCsdCkM6qbHXsKKvOgrOyCYtDv11xSmzC/BoaHCpd3PQp kERX2QgSlnzTLEAMLKUItYep/D9c5zihgHtEzw+kPhyEHhyDN3L39ctaOkbIxIFvUamcN/ dfYVXBT+nyuij0T2WHwryk7U13C6/9TaTRXKvwMop4M1JgRk+p3ZbF3Mhnw4jlCH7KQ0Vp ul2WXEDCAy+pqwdqIewDqjFIV23WyhHWFiSEGuA4HMP9LtnWFptcunkfA/zyvg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 22 Oct 2025 09:38:11 +0200 Subject: [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment 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 Message-Id: <20251022-macb-eyeq5-v2-2-7c140abb0581@bootlin.com> References: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> In-Reply-To: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nicolas Ferre , Claudiu Beznea , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= , =?utf-8?q?Gr=C3=A9gory_Clement?= , Maxime Chevallier , Tawfik Bayouk , Thomas Petazzoni , Vladimir Kondratiev , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 If HW is RSC capable, it cannot add dummy bytes at the start of IP packets. Alignment (ie number of dummy bytes) is configured using the RBOF field inside the NCFGR register. On the software side, the skb_reserve(skb, NET_IP_ALIGN) call must only be done if those dummy bytes are added by the hardware; notice the skb_reserve() is done AFTER writing the address to the device. We cannot do the skb_reserve() call BEFORE writing the address because the address field ignores the low 2/3 bits. Conclusion: in some cases, we risk not being able to respect the NET_IP_ALIGN value (which is picked based on unaligned CPU access performance). Fixes: 4df95131ea80 ("net/macb: change RX path for GEM") Signed-off-by: Th=C3=A9o Lebrun --- drivers/net/ethernet/cadence/macb.h | 3 +++ drivers/net/ethernet/cadence/macb_main.c | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 5b7d4cdb204d..93e8dd092313 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -537,6 +537,8 @@ /* Bitfields in DCFG6. */ #define GEM_PBUF_LSO_OFFSET 27 #define GEM_PBUF_LSO_SIZE 1 +#define GEM_PBUF_RSC_OFFSET 26 +#define GEM_PBUF_RSC_SIZE 1 #define GEM_PBUF_CUTTHRU_OFFSET 25 #define GEM_PBUF_CUTTHRU_SIZE 1 #define GEM_DAW64_OFFSET 23 @@ -775,6 +777,7 @@ #define MACB_CAPS_MACB_IS_GEM BIT(20) #define MACB_CAPS_DMA_64B BIT(21) #define MACB_CAPS_DMA_PTP BIT(22) +#define MACB_CAPS_RSC BIT(23) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 39673f5c3337..0817a99bb369 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1300,8 +1300,19 @@ static void gem_rx_refill(struct macb_queue *queue) dma_wmb(); macb_set_addr(bp, desc, paddr); =20 - /* properly align Ethernet header */ - skb_reserve(skb, NET_IP_ALIGN); + /* Properly align Ethernet header. + * + * Hardware can add dummy bytes if asked using the RBOF + * field inside the NCFGR register. That feature isn't + * available if hardware is RSC capable. + * + * We cannot fallback to doing the 2-byte shift before + * DMA mapping because the address field does not allow + * setting the low 2/3 bits. + * It is 3 bits if HW_DMA_CAP_PTP, else 2 bits. + */ + if (!(bp->caps & MACB_CAPS_RSC)) + skb_reserve(skb, NET_IP_ALIGN); } else { desc->ctrl =3D 0; dma_wmb(); @@ -2773,7 +2784,9 @@ static void macb_init_hw(struct macb *bp) macb_set_hwaddr(bp); =20 config =3D macb_mdc_clk_div(bp); - config |=3D MACB_BF(RBOF, NET_IP_ALIGN); /* Make eth data aligned */ + /* Make eth data aligned. If RSC capable, that offset is ignored by HW. */ + if (!(bp->caps & MACB_CAPS_RSC)) + config |=3D MACB_BF(RBOF, NET_IP_ALIGN); config |=3D MACB_BIT(DRFCS); /* Discard Rx FCS */ if (bp->caps & MACB_CAPS_JUMBO) config |=3D MACB_BIT(JFRAME); /* Enable jumbo frames */ @@ -4321,6 +4334,8 @@ static void macb_configure_caps(struct macb *bp, dcfg =3D gem_readl(bp, DCFG2); if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) =3D=3D 0) bp->caps |=3D MACB_CAPS_FIFO_MODE; + if (GEM_BFEXT(PBUF_RSC, gem_readl(bp, DCFG6))) + bp->caps |=3D MACB_CAPS_RSC; if (gem_has_ptp(bp)) { if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5))) dev_err(&bp->pdev->dev, --=20 2.51.1 From nobody Sun Feb 8 07:58:51 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 002E22FB99C; Wed, 22 Oct 2025 07:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118723; cv=none; b=ilZPYtiN+akp0YrPJC3lipbxgcY/IzDEao3ZHYT4orBr3cJpbKCyzdRS8FF1T2TCnxqGfvczvmjSdNyiuUiJGOBiNRYdUv9JkOLpZVF0hVNgNjhmcEV//aqS2N9b/WZi9JXV58PsrgfIoYvzkxD253Np5t03y6T8BZexYuZIusQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118723; c=relaxed/simple; bh=ecl41pJPvihqp274/tCmJbHVxegBEYmfWIspInAauLk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HdOnqC4gZiyc5uctd/qb+rtjgCRhoqFwtQMMpc2BN4YONtwqZtZ9LrSQ9EtdbOcYfYkSGvD1qxFqpEeV2P6SGKcP+/KoEf/KUHSWJCQ79C8QLCKik2t1+gh5hESKghAszrSyqeIxG97R/5PlXEY0NKuSuilA1lhRcnC6mSb32e8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=zjE22bom; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="zjE22bom" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4DCDE4E41278; Wed, 22 Oct 2025 07:38:40 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 237F8606DC; Wed, 22 Oct 2025 07:38:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8E29A102F2426; Wed, 22 Oct 2025 09:38:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761118719; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=pmwrc2WN3p4aZD7/+0Kz3OTk3QOTsF3e2T792MwxUoo=; b=zjE22bomf/cgt74vyWrsJBOY3pYcEogC2pteHwAfotDVBgBJVvi/+sac4QEpShWMNOmxnA GaIJu6RHLTMOg+c7W99wPnZ2+XVBRqAU8LSLEd+kkmMIN35qZvcTPj/Osjn0QMVO1dPFb5 zACrRymyrcEJHa/n31HhUTMtoOch09loFkANjOeiV2k1Ar6P8Ksm7JWpfax0Lmd3VgFURY z9Xn8LlGFXegqBYUkIIp6NcTI4gltvkyRgMVfSkzqsNMqMeUC2qNOo5/mVR7+Ejhme13vm XxkYxAPc7XeGhoD1IQHoM/tqpxngnEWMAdwg61J4r4DSxoc2Fig/yzvY8QKrfQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 22 Oct 2025 09:38:12 +0200 Subject: [PATCH net-next v2 3/5] net: macb: add no LSO capability (MACB_CAPS_NO_LSO) 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 Message-Id: <20251022-macb-eyeq5-v2-3-7c140abb0581@bootlin.com> References: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> In-Reply-To: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nicolas Ferre , Claudiu Beznea , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= , =?utf-8?q?Gr=C3=A9gory_Clement?= , Maxime Chevallier , Tawfik Bayouk , Thomas Petazzoni , Vladimir Kondratiev , =?utf-8?q?Th=C3=A9o_Lebrun?= , Andrew Lunn X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 LSO is runtime-detected using the PBUF_LSO field inside register DCFG6. Allow disabling that feature if it is broken by using bp->caps coming from match data. Reviewed-by: Andrew Lunn Signed-off-by: Th=C3=A9o Lebrun --- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 93e8dd092313..05bfa9bd4782 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -778,6 +778,7 @@ #define MACB_CAPS_DMA_64B BIT(21) #define MACB_CAPS_DMA_PTP BIT(22) #define MACB_CAPS_RSC BIT(23) +#define MACB_CAPS_NO_LSO BIT(24) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 0817a99bb369..71a472c85a23 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4562,8 +4562,11 @@ static int macb_init(struct platform_device *pdev) /* Set features */ dev->hw_features =3D NETIF_F_SG; =20 - /* Check LSO capability */ - if (GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6))) + /* Check LSO capability; runtime detection can be overridden by a cap + * flag if the hardware is known to be buggy + */ + if (!(bp->caps & MACB_CAPS_NO_LSO) && + GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6))) dev->hw_features |=3D MACB_NETIF_LSO; =20 /* Checksum offload is only available on gem with packet buffer */ --=20 2.51.1 From nobody Sun Feb 8 07:58:51 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 73AB82FB0AB for ; Wed, 22 Oct 2025 07:38:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118725; cv=none; b=CVOY0RkprbucVIYZiRs81zj7ftjTAJLJYuUJSl8HCXZo6CWLDO/ESdBkWe2SjYXJ9znb2eMCRepz1+FwxfQs2uqvuG0etvYHivvz0M4zVX/MZyinSlr8gMv2NUYaF06MvJPMQsZIy7Em1OqLpTrRQDdWaEz1wzY75Kiw7JCmPas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118725; c=relaxed/simple; bh=ms+zag/7r86CQCaiWGC3Z7UhMgu68ikR+Dwj2ZuEZqM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aDq8HMGGVfhXfpnyS3As9rk0Bnvmi6qXDb7OkdURnYMxzO8bDyG8WI6Karr9eEjDLk0vt1aC0SOQmbQ19MDYkfXbBggH3bIdn547ZUKZfoZz5Sf380hKIKloYFWPeBcTnZVSh+DrG+aUh++/YMxed0G2Mr4Mw4Z42qOn8Xc9d0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=HBHYBaf2; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="HBHYBaf2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id F25A04E41268; Wed, 22 Oct 2025 07:38:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id C8660606DC; Wed, 22 Oct 2025 07:38:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6EA9E102F2429; Wed, 22 Oct 2025 09:38:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761118720; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=iWvier8kbhkxAYenRkU9MVIUo2xMenGSI7RehQ0Iej8=; b=HBHYBaf2G9IaB4TLV+C49g9WIjnm7bSDZQeQjaIDPNF8UgxRwtsaXhnxApNRGC4/wyJbI1 pWqow1HzZaDxrSgSQbAFI6dLG3iXR0NaozPXoxgq7oCM+xv+m4qbNx5aI4EIhOa7qKLjm0 fRvwIO0u83K2wCvbWFvrUUWf9W3tS9kjbuQ98Dj1HupMZTMTECpelpIC6s6G6iwHyBc7DO gLKpEYMlUgugQ65EIGOVJ8iT+arWi77R197ln/TmjLr6bDrUabBsxQiXFpU9sfkHJdsRjZ bkDsic4P9pj7y0iRliPSU8r1hKNOOPAuQy1U8y0wFa3wArFf5boMy1eXzqSwYA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 22 Oct 2025 09:38:13 +0200 Subject: [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy 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 Message-Id: <20251022-macb-eyeq5-v2-4-7c140abb0581@bootlin.com> References: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> In-Reply-To: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nicolas Ferre , Claudiu Beznea , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= , =?utf-8?q?Gr=C3=A9gory_Clement?= , Maxime Chevallier , Tawfik Bayouk , Thomas Petazzoni , Vladimir Kondratiev , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The bp->sgmii_phy field is initialised at probe by init_reset_optional() if bp->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII. It gets used by: - zynqmp_config: "cdns,zynqmp-gem" or "xlnx,zynqmp-gem" compatibles. - mpfs_config: "microchip,mpfs-macb" compatible. - versal_config: "xlnx,versal-gem" compatible. Make name more generic as EyeQ5 requires the PHY in SGMII & RGMII cases. Drop "for ZynqMP SGMII mode" comment that is already a lie, as it gets used on Microchip platforms as well. And soon it won't be SGMII-only. Signed-off-by: Th=C3=A9o Lebrun Reviewed-by: Andrew Lunn Reviewed-by: Maxime Chevallier --- drivers/net/ethernet/cadence/macb.h | 2 +- drivers/net/ethernet/cadence/macb_main.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 05bfa9bd4782..87414a2ddf6e 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1341,7 +1341,7 @@ struct macb { =20 struct macb_ptp_info *ptp_info; /* macb-ptp interface */ =20 - struct phy *sgmii_phy; /* for ZynqMP SGMII mode */ + struct phy *phy; =20 spinlock_t tsu_clk_lock; /* gem tsu clock locking */ unsigned int tsu_rate; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 71a472c85a23..914677f30f2c 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2963,7 +2963,7 @@ static int macb_open(struct net_device *dev) =20 macb_init_hw(bp); =20 - err =3D phy_power_on(bp->sgmii_phy); + err =3D phy_power_on(bp->phy); if (err) goto reset_hw; =20 @@ -2979,7 +2979,7 @@ static int macb_open(struct net_device *dev) return 0; =20 phy_off: - phy_power_off(bp->sgmii_phy); + phy_power_off(bp->phy); =20 reset_hw: macb_reset_hw(bp); @@ -3011,7 +3011,7 @@ static int macb_close(struct net_device *dev) phylink_stop(bp->phylink); phylink_disconnect_phy(bp->phylink); =20 - phy_power_off(bp->sgmii_phy); + phy_power_off(bp->phy); =20 spin_lock_irqsave(&bp->lock, flags); macb_reset_hw(bp); @@ -5139,13 +5139,13 @@ static int init_reset_optional(struct platform_devi= ce *pdev) =20 if (bp->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII) { /* Ensure PHY device used in SGMII mode is ready */ - bp->sgmii_phy =3D devm_phy_optional_get(&pdev->dev, NULL); + bp->phy =3D devm_phy_optional_get(&pdev->dev, NULL); =20 - if (IS_ERR(bp->sgmii_phy)) - return dev_err_probe(&pdev->dev, PTR_ERR(bp->sgmii_phy), + if (IS_ERR(bp->phy)) + return dev_err_probe(&pdev->dev, PTR_ERR(bp->phy), "failed to get SGMII PHY\n"); =20 - ret =3D phy_init(bp->sgmii_phy); + ret =3D phy_init(bp->phy); if (ret) return dev_err_probe(&pdev->dev, ret, "failed to init SGMII PHY\n"); @@ -5174,7 +5174,7 @@ static int init_reset_optional(struct platform_device= *pdev) /* Fully reset controller at hardware level if mapped in device tree */ ret =3D device_reset_optional(&pdev->dev); if (ret) { - phy_exit(bp->sgmii_phy); + phy_exit(bp->phy); return dev_err_probe(&pdev->dev, ret, "failed to reset controller"); } =20 @@ -5182,7 +5182,7 @@ static int init_reset_optional(struct platform_device= *pdev) =20 err_out_phy_exit: if (ret) - phy_exit(bp->sgmii_phy); + phy_exit(bp->phy); =20 return ret; } @@ -5592,7 +5592,7 @@ static int macb_probe(struct platform_device *pdev) mdiobus_free(bp->mii_bus); =20 err_out_phy_exit: - phy_exit(bp->sgmii_phy); + phy_exit(bp->phy); =20 err_out_free_netdev: free_netdev(dev); @@ -5616,7 +5616,7 @@ static void macb_remove(struct platform_device *pdev) if (dev) { bp =3D netdev_priv(dev); unregister_netdev(dev); - phy_exit(bp->sgmii_phy); + phy_exit(bp->phy); mdiobus_unregister(bp->mii_bus); mdiobus_free(bp->mii_bus); =20 @@ -5643,7 +5643,7 @@ static int __maybe_unused macb_suspend(struct device = *dev) u32 tmp; =20 if (!device_may_wakeup(&bp->dev->dev)) - phy_exit(bp->sgmii_phy); + phy_exit(bp->phy); =20 if (!netif_running(netdev)) return 0; @@ -5772,7 +5772,7 @@ static int __maybe_unused macb_resume(struct device *= dev) int err; =20 if (!device_may_wakeup(&bp->dev->dev)) - phy_init(bp->sgmii_phy); + phy_init(bp->phy); =20 if (!netif_running(netdev)) return 0; --=20 2.51.1 From nobody Sun Feb 8 07:58:51 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 6ECC22FD1BC for ; Wed, 22 Oct 2025 07:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118727; cv=none; b=sNkUFCE/Yfhpjn0yIrG0ufKboVQiX934lLRS1exw71vsUOOourUyDQmPYJ+0q3E+Z8al8esQBqPiyav99ZXVYhajshqIWleXv5bPDQpS0vUxuaH3yLaHk4hVKxprBqWBFDHx7EvKLzb/rgArVFqgFRM8E+PK8Agd9qA1HA4iDDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761118727; c=relaxed/simple; bh=1ZeIIsp8tJcHFQgz2Xfvqz7CZIB2p2BXgkSO/2IVTog=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ixkTR3sa7Dj5sWPZpVPu11O+zFuE3GHhfLrtNBj4Hw+ZS7tqBqpdy2MpPkSnO71gOgxV+rY5YYVv01yTYFdOwmtSjwI3MrQvm7jmUSRrCS23SPQg1nXunIl+tz/W2XqWa9chPljqBcUQ6jZsqbLQfvf68nGtQP/7Nd5zxX9H4/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=M5W3DVxt; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="M5W3DVxt" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C830C4E41276; Wed, 22 Oct 2025 07:38:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9F65D606DC; Wed, 22 Oct 2025 07:38:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2841E102F242A; Wed, 22 Oct 2025 09:38:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761118722; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZZVaF5BoYgXRmfee23HnDH9NWUBGz7WnOPiHHT4qsbo=; b=M5W3DVxtTPW4ls9GZh6bRhB2ZbmMT71AAQO4/IdCCAKp6t+hq2RgM2GkQ1vYqFQSX7uxH5 Rg8WZoepgg1vQAWIaXMoeHeFkkRjcIk+EVUnlNyVhsY+4lUnnSsdBjLo17vXU6Rf4jJzZl t/oiIBtTEPx16xIo6pQwudCoYgEDeyz9ymdriOcXXQjx9MDqBWswcRH5/4ufnAMujXuI3S YLtdF5wSGf4GK6M5DbuzWc6CdwKESykkLre3ktSGgBhLpC/ktYr49aCVHHJt8lbPTWYZJX DOoygNMoAPyNBC4FTFryRBOcJBCBxD0XOuHrFPtgk+IEmymMupbxyqMT3n/IBQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 22 Oct 2025 09:38:14 +0200 Subject: [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible 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 Message-Id: <20251022-macb-eyeq5-v2-5-7c140abb0581@bootlin.com> References: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> In-Reply-To: <20251022-macb-eyeq5-v2-0-7c140abb0581@bootlin.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nicolas Ferre , Claudiu Beznea , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= , =?utf-8?q?Gr=C3=A9gory_Clement?= , Maxime Chevallier , Tawfik Bayouk , Thomas Petazzoni , Vladimir Kondratiev , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Add support for the two GEM instances inside Mobileye EyeQ5 SoCs, using compatible "mobileye,eyeq5-gem". With it, add a custom init sequence that must grab a generic PHY and initialise it. We use bp->phy in both RGMII and SGMII cases. Tell our mode by adding a phy_set_mode_ext() during macb_open(), before phy_power_on(). We are the first users of bp->phy that use it in non-SGMII cases. Signed-off-by: Th=C3=A9o Lebrun Reviewed-by: Maxime Chevallier --- drivers/net/ethernet/cadence/macb_main.c | 38 ++++++++++++++++++++++++++++= ++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 914677f30f2c..c45c6a7f42e6 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2963,6 +2963,10 @@ static int macb_open(struct net_device *dev) =20 macb_init_hw(bp); =20 + err =3D phy_set_mode_ext(bp->phy, PHY_MODE_ETHERNET, bp->phy_interface); + if (err) + goto reset_hw; + err =3D phy_power_on(bp->phy); if (err) goto reset_hw; @@ -5187,6 +5191,28 @@ static int init_reset_optional(struct platform_devic= e *pdev) return ret; } =20 +static int eyeq5_init(struct platform_device *pdev) +{ + struct net_device *netdev =3D platform_get_drvdata(pdev); + struct macb *bp =3D netdev_priv(netdev); + struct device *dev =3D &pdev->dev; + int ret; + + bp->phy =3D devm_phy_get(dev, NULL); + if (IS_ERR(bp->phy)) + return dev_err_probe(dev, PTR_ERR(bp->phy), + "failed to get PHY\n"); + + ret =3D phy_init(bp->phy); + if (ret) + return dev_err_probe(dev, ret, "failed to init PHY\n"); + + ret =3D macb_init(pdev); + if (ret) + phy_exit(bp->phy); + return ret; +} + static const struct macb_usrio_config sama7g5_usrio =3D { .mii =3D 0, .rmii =3D 1, @@ -5341,6 +5367,17 @@ static const struct macb_config versal_config =3D { .usrio =3D &macb_default_usrio, }; =20 +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, + .dma_burst_length =3D 16, + .clk_init =3D macb_clk_init, + .init =3D eyeq5_init, + .jumbo_max_len =3D 10240, + .usrio =3D &macb_default_usrio, +}; + static const struct macb_config raspberrypi_rp1_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG | MACB_CAPS_JUMBO | @@ -5372,6 +5409,7 @@ static const struct of_device_id macb_dt_ids[] =3D { { .compatible =3D "microchip,mpfs-macb", .data =3D &mpfs_config }, { .compatible =3D "microchip,sama7g5-gem", .data =3D &sama7g5_gem_config = }, { .compatible =3D "microchip,sama7g5-emac", .data =3D &sama7g5_emac_confi= g }, + { .compatible =3D "mobileye,eyeq5-gem", .data =3D &eyeq5_config }, { .compatible =3D "raspberrypi,rp1-gem", .data =3D &raspberrypi_rp1_confi= g }, { .compatible =3D "xlnx,zynqmp-gem", .data =3D &zynqmp_config}, { .compatible =3D "xlnx,zynq-gem", .data =3D &zynq_config }, --=20 2.51.1