From nobody Sun Feb 8 11:59:38 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 6DCD22D3A6C; Thu, 23 Oct 2025 16:23:18 +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=1761236600; cv=none; b=IjY4KQC2ddJG0uBYjHHsmDksJ9sKXIVlaTG3k/ZuOf7TNDX29pO6JLL+f3LPVSsKChyDYCbn22pkUebmW4tY5TialOBY/oKYxXyiiuZXZhph/sxQDCDqeEGnp3lh3lAWyMBkamaFfBKjfCiC1HXZ1i8xcD7Z3OF/CnAdOCWxJhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761236600; c=relaxed/simple; bh=gGGXJOm8rvImrLi6BxMNzALgm6MsoyQKr1sLUF92SL4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D8ji4fv7q+L15Vyr6SBAB8pvYLSSOSieU8mm3rW+nAmEB5uM2+yBmcP258wsqjp5Ul+JfyyXy0fCaqwDCOhMWAL4oS9tCj2Rnl801pVfU12RRKmyHXdh9e857I+WPWOkPHBRZ8MtxoSHN66sbEgYfQXYFdvrurnosX4HQ6f3yYI= 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=PNP2tBpR; 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="PNP2tBpR" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 67D181A1619; Thu, 23 Oct 2025 16:23:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3CCBA606DE; Thu, 23 Oct 2025 16:23:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 69AEF102F246C; Thu, 23 Oct 2025 18:23:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761236594; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OrH5JeCuK9Xj8osuGgprmu4Yv4MHT2kxnh5YrLEqkOo=; b=PNP2tBpRMM8CvakDDlnBWEg92wRMjrt3Fxb7lws3hFXdSGqsf0GmdmMP9jaQdgAvlFwPfg KDOJ/cdQC7+Klodg5tjLNBhn9UGE8Jt4MB5oo285NPVPuiKTywVsSi6H0lp7jivTOE0iP8 pgM2YSJUmY42HdHIv5jH/wL0auxrhhceM+5M288GgehYckb6Rg/zbai4iEuDOAXo95vKMW ffp7jbs9WcHn+8R9ho5ldAAa7GdjGNUh8DTEiZLPUCpaogrx68+RizMz53y/Z1SwgruA2/ 7Q9YQlZ+bco69qM4PF4+noexKq74DweK21YCSgj3eMDrm365UJAUwvmIlGhmMw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 23 Oct 2025 18:22:51 +0200 Subject: [PATCH net-next v3 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: <20251023-macb-eyeq5-v3-1-af509422c204@bootlin.com> References: <20251023-macb-eyeq5-v3-0-af509422c204@bootlin.com> In-Reply-To: <20251023-macb-eyeq5-v3-0-af509422c204@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 , Conor Dooley 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. Reviewed-by: Andrew Lunn Acked-by: Conor Dooley Signed-off-by: Th=C3=A9o Lebrun --- 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 11:59:38 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 08CDB2D24B7; Thu, 23 Oct 2025 16:23:18 +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=1761236601; cv=none; b=DB0CK95OBOt8M0PRd+vmJ6X8HE+utPQCnQ9PG2z2wcz9UWFYVg+T0ax2Bf/ih8pbxH6dV/t++iF3vJ4E6Y+uiw7luAWWqGQWtvtDhi7RbYLW3/eb1d/B0mB/yT3ks7fS9i65ooHVHuoPShTxQKqyBHBVCU+NMRKRQF3gFoUq2s4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761236601; c=relaxed/simple; bh=kw4pwejY//2AZ7tsFsh9thrSr6b9sczm9MMniR6xMcA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BF8/nLTG70f1f5dQJnqZCTmRvXwQrARHTcscRiAnFnL+uWBcCU30R8mt7BFOAIVl/wsRpl7BosqgHLc76t0kg00TWyeqEHknak26dUCbxy5z1Fz7Te4pWxNer2fozEdIe7xfHh6WD71RIyEqNWNiif2/TnFUlTm0nqQybEYouDw= 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=EswT/0EU; 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="EswT/0EU" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 670ADC0C431; Thu, 23 Oct 2025 16:22:57 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 46847606DE; Thu, 23 Oct 2025 16:23:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 10E7D102F2473; Thu, 23 Oct 2025 18:23:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761236596; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=d3Jk9Ob4iaLKf7sQIf4J4/RHLTUj7WHizfDugE7sKSM=; b=EswT/0EU03J0XUerpewEEBJJlJjdjRBTLOX2r5kV6FdRmyn/tDVIdvpxxvPrWM5DI4UdTl t6spd/elDzUTskbSU+yeqKmO9tfl76jaXCsQNp+7eVTMADPLUlbncjdmRFTooh60wHVsiA 01GGd7LkFnbAtNGtRDmY5DEY1ggU4PxLeBT9WTTaDCLPR+fsl9rrHaQQcDSnY2WdsTFiHx 0nLgjqyKD87NAhVGH8W3GXb/kfZ91cl0DCIFKO4aAXuvuBiiDa+C0Bb6xM95SSo3MnQjSj NtB+M02ifaB33Q6h7X5FtSipEkX8xpG4atRHGgPhwdRagpaZpwHh3RQ39uVtTg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 23 Oct 2025 18:22:52 +0200 Subject: [PATCH net-next v3 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: <20251023-macb-eyeq5-v3-2-af509422c204@bootlin.com> References: <20251023-macb-eyeq5-v3-0-af509422c204@bootlin.com> In-Reply-To: <20251023-macb-eyeq5-v3-0-af509422c204@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). Signed-off-by: Th=C3=A9o Lebrun Acked-by: Nicolas Ferre Reviewed-by: Andrew Lunn --- drivers/net/ethernet/cadence/macb.h | 3 +++ drivers/net/ethernet/cadence/macb_main.c | 23 ++++++++++++++++++++--- 2 files changed, 23 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..be3d0c2313a1 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,11 @@ 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 +4336,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 11:59:38 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 274D42FD7A5 for ; Thu, 23 Oct 2025 16:23:20 +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=1761236602; cv=none; b=VcZG8T36pl1ta9c4veormCqUYiXm7XWoyYKQz5zu/umpzFtweG/d1gfIM0e+zKi7w/D0Iv9VNgSq2SAF5jJWlDYNpDoTudBA6yBDRyFpPV9ePMYZVgWEnXR3QzxVNeXH07MyAtEofRi6nAcSovWsRsL82qlJThk/+YwfZsiatfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761236602; c=relaxed/simple; bh=VxuFG5ZOb+yiTUfj4Jo43jlD7WQcjBC2WiJgbz5FXPI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tevpF7LBZ9OtC7rn7LHbjDIpbSTa4MeXs71oBlsyTrzjzuecdunba5UfM200nYfRAaqM7BB1WpAzM+X+cD3EQ0t0h5Btcp/I6P1bGwedJYnxFYlu1B3qwLDzymCNof48MtSpsFY/KlpA5RWtJbIG7LWs9scQGInoPcc9v6MOlVk= 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=RVH7+xo3; 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="RVH7+xo3" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 99FC91A161E; Thu, 23 Oct 2025 16:23:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6E9C1606DE; Thu, 23 Oct 2025 16:23:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9DD5A102F2468; Thu, 23 Oct 2025 18:23:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761236598; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=oBXojVXIJFwozhhdkYSIxwYVsagkOAhdOoi1g9O4htk=; b=RVH7+xo3dhYwkMq7Nio+SEmYJbP8aCbk728R4zu71+rXa6D7Za0+xuNYWszrW65MZA2iYW b6UIWbgqz67BtRb8HllFF1XxbbHewP2ZE3HVhIwG4gQEto8FWWcTynEZeA9I9Angk0SZMz QMANvA4YpsZawXTnLox/uT51bPPZCrY1ahr2DqikjQZzytIwWMNMQxw3qgO6kbP40pb45K kWUkDwJK1DJv9PxC3/Q9a/9hLd1RM1y0aG+1p+6KGNXuAc7qFNtAGDMTqbdcVelJzWJoVe rdsp50GgrH8OsX0kdQDW8TqWxOk5i0gud5jtgMxp29JV563IKnN7zUsI3xrudw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 23 Oct 2025 18:22:53 +0200 Subject: [PATCH net-next v3 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: <20251023-macb-eyeq5-v3-3-af509422c204@bootlin.com> References: <20251023-macb-eyeq5-v3-0-af509422c204@bootlin.com> In-Reply-To: <20251023-macb-eyeq5-v3-0-af509422c204@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 Acked-by: Nicolas Ferre --- 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 be3d0c2313a1..8b688a6cb2f9 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4564,8 +4564,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 11:59:38 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 786F830ACFF; Thu, 23 Oct 2025 16:23:22 +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=1761236604; cv=none; b=qrbLSCGa6A3lro7y6pRZwLCNcohVfZpGzpKQ2Vhy6qv9zKfOywhu9mv7fuC/S6WWa/RzTmVqP7HZIjZo5oy1R6alx3r6zisJt2yl3e2j1tKJtrWbR86Tn9eA9Q3geyq3SnxcsrhvODiR9C0af6smh81bHh9GzzH1DXEWSKxs9wA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761236604; c=relaxed/simple; bh=Yarsu4uhSLB3FJ1cHK2srBqjp/s6m4XAw0u/FPKQHUM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s5qc6ZG60gR9QzfQNEid41xSQvh7CNxZ99pmY9zrZ4YxS69gFZNNN1RlpDuqHZg/EbNGswgVaUi1oS6sAxQQRybIdMB85ypGv9AO6WzNZmJJx+XISFV+z/R8iPsHUkbObmVf2p0S2tE508yl/uwJHEyDUMN3PMOMYvghoclPvbk= 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=xPYy8HOU; 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="xPYy8HOU" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 09F0DC0C430; Thu, 23 Oct 2025 16:23:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DDBF9606DE; Thu, 23 Oct 2025 16:23:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 90502102F246C; Thu, 23 Oct 2025 18:23:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761236599; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=8RNDmW36KMuKuYt5YOI1V2Yuesuf7NyM/xPRiEzXIF4=; b=xPYy8HOU2j4YU4kOJOwbopzzHc9BV9X/cU+MirOwbtkdLkqmoLtiLJ46b/KiULluaO67Dw DtFgGSwI9+rkaTTIwdrTstd24ydJV81yYvsUsFnGPEWnDgAW7hvsv+ASx0jfVjKdMEwyec K4/sW69csDNvkHb9gpBPwtUzNxr2UVw+iYCI7yZBdRXqdAhuFmluwA4s9vnOETef1QoO9A rhHh/8ITEdNrSShIikKjpeSlC7mRe6Duak4vfOzF881XSsrzwtO/p019HkmPPhaxkdprno KBx1ZinBKukBcZbK+ZfQDyZRmfiOCuUreL7s/YjLglB4BKXVD/NTwstxm8YLfw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 23 Oct 2025 18:22:54 +0200 Subject: [PATCH net-next v3 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: <20251023-macb-eyeq5-v3-4-af509422c204@bootlin.com> References: <20251023-macb-eyeq5-v3-0-af509422c204@bootlin.com> In-Reply-To: <20251023-macb-eyeq5-v3-0-af509422c204@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 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. Reviewed-by: Andrew Lunn Reviewed-by: Maxime Chevallier Signed-off-by: Th=C3=A9o Lebrun Acked-by: Nicolas Ferre --- 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 8b688a6cb2f9..44188e7eee56 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2965,7 +2965,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 @@ -2981,7 +2981,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); @@ -3013,7 +3013,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); @@ -5141,13 +5141,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"); @@ -5176,7 +5176,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 @@ -5184,7 +5184,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; } @@ -5594,7 +5594,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); @@ -5618,7 +5618,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 @@ -5645,7 +5645,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; @@ -5774,7 +5774,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 11:59:38 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 3A8582D9795 for ; Thu, 23 Oct 2025 16:23:24 +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=1761236606; cv=none; b=DxrFQfI+h6nGtzPjR847/ydWk1pxb498t+bE8owzCh6DDlb7ZzeWbPt/8bqo4U7qWXznzI14E1GH5wdfiv0okMDH39kuZNrMhT8waCrCJ+BodmkvOPxfPMzurJ/gmi/aPXXt/BpmpwwuChRVCQCCVV2QgidXRLAKYtRTUGgo7rw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761236606; c=relaxed/simple; bh=BoI04ne66BgdO6RQx8tLnItxQ9eDqwU1DrU84iIL4D8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WUKUX5uWXKmpkfwL3hBSEmIXLxQHqnO3tupba6YEz3ug4fecKpKPzsXwIaWlvN3EgcizJIcWbca3ZqILgy8ilzeD5eRer7uI0sMlOYd5AqTiwkjsTiVlmE8UzxITxzGhrCdIWp60cxEUENoSm2e85xqfPpOgrufUote8bc87qRo= 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=PnZNrSW6; 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="PnZNrSW6" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id A75224E412B0; Thu, 23 Oct 2025 16:23:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7E275606DE; Thu, 23 Oct 2025 16:23:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 50C5F102F2475; Thu, 23 Oct 2025 18:23:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761236601; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZJv3iwv2xhtLbUdm9xnAIqJx8pCFt3cC26JBlEGXT88=; b=PnZNrSW6hlNuyaCxQD0TaSMfii29T1liLZdhZfgXwf3EEcPRWeRETPPMAKz2//807EQBkv MvsTg+4Kk26ZQDIvB8HX6WKG0BXY27xHD+PW6UhgWjGyZsq9DH/y0+5q99zevUaR+fX7Vu aCtqBK9JwqzDO4/DumTh6iW/gm22JGlfmzoUdzEvS5coJq08hUun7uyBEcX73ySQntomSf SAiDWTi6VglIK8NICve4GYgNtSFaYAIVJSARB9jcpD6qoArcylR5hF5/OFh6KoeRM2C/Hk tHQpohCaStWu6N77Nr8XbVV44WhPPLRzy7YtkHPG+poT/1Buzx8x4yp8FBxCqw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 23 Oct 2025 18:22:55 +0200 Subject: [PATCH net-next v3 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: <20251023-macb-eyeq5-v3-5-af509422c204@bootlin.com> References: <20251023-macb-eyeq5-v3-0-af509422c204@bootlin.com> In-Reply-To: <20251023-macb-eyeq5-v3-0-af509422c204@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. The phy_set_mode_ext() call is made unconditionally. It cannot cause issues on platforms where !bp->phy or !bp->phy->ops->set_mode as, in those cases, the call is a no-op (returning zero). From reading upstream DTS, we can figure out that no platform has a bp->phy and a PHY driver that has a .set_mode() implementation: - cdns,zynqmp-gem: no DTS upstream. - microchip,mpfs-macb: microchip/mpfs.dtsi, &mac0..1, no PHY attached. - xlnx,versal-gem: xilinx/versal-net.dtsi, &gem0..1, no PHY attached. - xlnx,zynqmp-gem: xilinx/zynqmp.dtsi, &gem0..3, PHY attached to drivers/phy/xilinx/phy-zynqmp.c which has no .set_mode(). Reviewed-by: Maxime Chevallier Signed-off-by: Th=C3=A9o Lebrun Acked-by: Nicolas Ferre Reviewed-by: Andrew Lunn --- 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 44188e7eee56..b1ed98d9c438 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2965,6 +2965,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; @@ -5189,6 +5193,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, @@ -5343,6 +5369,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 | @@ -5374,6 +5411,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