* [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface
2025-10-22 7:38 [PATCH net-next v2 0/5] net: macb: EyeQ5 support Théo Lebrun
@ 2025-10-22 7:38 ` Théo Lebrun
2025-10-22 17:33 ` Conor Dooley
2025-10-22 19:23 ` Andrew Lunn
2025-10-22 7:38 ` [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment Théo Lebrun
` (3 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Théo Lebrun @ 2025-10-22 7:38 UTC (permalink / raw)
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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Maxime Chevallier, Tawfik Bayouk,
Thomas Petazzoni, Vladimir Kondratiev, Théo Lebrun
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éo Lebrun <theo.lebrun@bootlin.com>
---
Documentation/devicetree/bindings/net/cdns,macb.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documentation/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 interface
- 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
@@ -183,6 +184,15 @@ allOf:
reg:
maxItems: 1
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: mobileye,eyeq5-gem
+ then:
+ required:
+ - phys
+
unevaluatedProperties: false
examples:
--
2.51.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface
2025-10-22 7:38 ` [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface Théo Lebrun
@ 2025-10-22 17:33 ` Conor Dooley
2025-10-22 19:23 ` Andrew Lunn
1 sibling, 0 replies; 16+ messages in thread
From: Conor Dooley @ 2025-10-22 17:33 UTC (permalink / raw)
To: Théo Lebrun
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Russell King, netdev, devicetree,
linux-kernel, Benoît Monin, Grégory Clement,
Maxime Chevallier, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
[-- Attachment #1: Type: text/plain, Size: 438 bytes --]
On Wed, Oct 22, 2025 at 09:38:10AM +0200, Théo Lebrun wrote:
> 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éo Lebrun <theo.lebrun@bootlin.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface
2025-10-22 7:38 ` [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface Théo Lebrun
2025-10-22 17:33 ` Conor Dooley
@ 2025-10-22 19:23 ` Andrew Lunn
1 sibling, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2025-10-22 19:23 UTC (permalink / raw)
To: Théo Lebrun
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Russell King, netdev, devicetree,
linux-kernel, Benoît Monin, Grégory Clement,
Maxime Chevallier, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
On Wed, Oct 22, 2025 at 09:38:10AM +0200, Théo Lebrun wrote:
> 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éo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment
2025-10-22 7:38 [PATCH net-next v2 0/5] net: macb: EyeQ5 support Théo Lebrun
2025-10-22 7:38 ` [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface Théo Lebrun
@ 2025-10-22 7:38 ` Théo Lebrun
2025-10-22 19:27 ` Andrew Lunn
2025-10-22 7:38 ` [PATCH net-next v2 3/5] net: macb: add no LSO capability (MACB_CAPS_NO_LSO) Théo Lebrun
` (2 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Théo Lebrun @ 2025-10-22 7:38 UTC (permalink / raw)
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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Maxime Chevallier, Tawfik Bayouk,
Thomas Petazzoni, Vladimir Kondratiev, Théo Lebrun
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éo Lebrun <theo.lebrun@bootlin.com>
---
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/cadence/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)
/* LSO settings */
#define MACB_LSO_UFO_ENABLE 0x01
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/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);
- /* 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 = 0;
dma_wmb();
@@ -2773,7 +2784,9 @@ static void macb_init_hw(struct macb *bp)
macb_set_hwaddr(bp);
config = macb_mdc_clk_div(bp);
- config |= 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 |= MACB_BF(RBOF, NET_IP_ALIGN);
config |= MACB_BIT(DRFCS); /* Discard Rx FCS */
if (bp->caps & MACB_CAPS_JUMBO)
config |= MACB_BIT(JFRAME); /* Enable jumbo frames */
@@ -4321,6 +4334,8 @@ static void macb_configure_caps(struct macb *bp,
dcfg = gem_readl(bp, DCFG2);
if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0)
bp->caps |= MACB_CAPS_FIFO_MODE;
+ if (GEM_BFEXT(PBUF_RSC, gem_readl(bp, DCFG6)))
+ bp->caps |= MACB_CAPS_RSC;
if (gem_has_ptp(bp)) {
if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5)))
dev_err(&bp->pdev->dev,
--
2.51.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment
2025-10-22 7:38 ` [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment Théo Lebrun
@ 2025-10-22 19:27 ` Andrew Lunn
2025-10-23 14:19 ` Théo Lebrun
0 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2025-10-22 19:27 UTC (permalink / raw)
To: Théo Lebrun
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Russell King, netdev, devicetree,
linux-kernel, Benoît Monin, Grégory Clement,
Maxime Chevallier, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
On Wed, Oct 22, 2025 at 09:38:11AM +0200, Théo Lebrun wrote:
> 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")
Is this a real fix? You should not mix new development with
fixes. Either post this patch to net, or drop the Fixes: tag for
net-next.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment
2025-10-22 19:27 ` Andrew Lunn
@ 2025-10-23 14:19 ` Théo Lebrun
0 siblings, 0 replies; 16+ messages in thread
From: Théo Lebrun @ 2025-10-23 14:19 UTC (permalink / raw)
To: Andrew Lunn, Théo Lebrun
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Russell King, netdev, devicetree,
linux-kernel, Benoît Monin, Grégory Clement,
Maxime Chevallier, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
On Wed Oct 22, 2025 at 9:27 PM CEST, Andrew Lunn wrote:
> On Wed, Oct 22, 2025 at 09:38:11AM +0200, Théo Lebrun wrote:
>> 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")
>
> Is this a real fix? You should not mix new development with
> fixes. Either post this patch to net, or drop the Fixes: tag for
> net-next.
No, it isn't fixing any platform that currently uses the driver.
Dropped the "Fixes:" trailer for next revision.
Thanks Andrew,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v2 3/5] net: macb: add no LSO capability (MACB_CAPS_NO_LSO)
2025-10-22 7:38 [PATCH net-next v2 0/5] net: macb: EyeQ5 support Théo Lebrun
2025-10-22 7:38 ` [PATCH net-next v2 1/5] dt-bindings: net: cdns,macb: add Mobileye EyeQ5 ethernet interface Théo Lebrun
2025-10-22 7:38 ` [PATCH net-next v2 2/5] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment Théo Lebrun
@ 2025-10-22 7:38 ` Théo Lebrun
2025-10-22 7:38 ` [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy Théo Lebrun
2025-10-22 7:38 ` [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible Théo Lebrun
4 siblings, 0 replies; 16+ messages in thread
From: Théo Lebrun @ 2025-10-22 7:38 UTC (permalink / raw)
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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Maxime Chevallier, Tawfik Bayouk,
Thomas Petazzoni, Vladimir Kondratiev, Théo Lebrun,
Andrew Lunn
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 <andrew@lunn.ch>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
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/cadence/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)
/* LSO settings */
#define MACB_LSO_UFO_ENABLE 0x01
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/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 = NETIF_F_SG;
- /* 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 |= MACB_NETIF_LSO;
/* Checksum offload is only available on gem with packet buffer */
--
2.51.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy
2025-10-22 7:38 [PATCH net-next v2 0/5] net: macb: EyeQ5 support Théo Lebrun
` (2 preceding siblings ...)
2025-10-22 7:38 ` [PATCH net-next v2 3/5] net: macb: add no LSO capability (MACB_CAPS_NO_LSO) Théo Lebrun
@ 2025-10-22 7:38 ` Théo Lebrun
2025-10-22 8:05 ` Maxime Chevallier
2025-10-22 19:29 ` Andrew Lunn
2025-10-22 7:38 ` [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible Théo Lebrun
4 siblings, 2 replies; 16+ messages in thread
From: Théo Lebrun @ 2025-10-22 7:38 UTC (permalink / raw)
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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Maxime Chevallier, Tawfik Bayouk,
Thomas Petazzoni, Vladimir Kondratiev, Théo Lebrun
The bp->sgmii_phy field is initialised at probe by init_reset_optional()
if bp->phy_interface == 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éo Lebrun <theo.lebrun@bootlin.com>
---
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/cadence/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 {
struct macb_ptp_info *ptp_info; /* macb-ptp interface */
- struct phy *sgmii_phy; /* for ZynqMP SGMII mode */
+ struct phy *phy;
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/ethernet/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)
macb_init_hw(bp);
- err = phy_power_on(bp->sgmii_phy);
+ err = phy_power_on(bp->phy);
if (err)
goto reset_hw;
@@ -2979,7 +2979,7 @@ static int macb_open(struct net_device *dev)
return 0;
phy_off:
- phy_power_off(bp->sgmii_phy);
+ phy_power_off(bp->phy);
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);
- phy_power_off(bp->sgmii_phy);
+ phy_power_off(bp->phy);
spin_lock_irqsave(&bp->lock, flags);
macb_reset_hw(bp);
@@ -5139,13 +5139,13 @@ static int init_reset_optional(struct platform_device *pdev)
if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII) {
/* Ensure PHY device used in SGMII mode is ready */
- bp->sgmii_phy = devm_phy_optional_get(&pdev->dev, NULL);
+ bp->phy = devm_phy_optional_get(&pdev->dev, NULL);
- 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");
- ret = phy_init(bp->sgmii_phy);
+ ret = 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 = 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");
}
@@ -5182,7 +5182,7 @@ static int init_reset_optional(struct platform_device *pdev)
err_out_phy_exit:
if (ret)
- phy_exit(bp->sgmii_phy);
+ phy_exit(bp->phy);
return ret;
}
@@ -5592,7 +5592,7 @@ static int macb_probe(struct platform_device *pdev)
mdiobus_free(bp->mii_bus);
err_out_phy_exit:
- phy_exit(bp->sgmii_phy);
+ phy_exit(bp->phy);
err_out_free_netdev:
free_netdev(dev);
@@ -5616,7 +5616,7 @@ static void macb_remove(struct platform_device *pdev)
if (dev) {
bp = 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);
@@ -5643,7 +5643,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
u32 tmp;
if (!device_may_wakeup(&bp->dev->dev))
- phy_exit(bp->sgmii_phy);
+ phy_exit(bp->phy);
if (!netif_running(netdev))
return 0;
@@ -5772,7 +5772,7 @@ static int __maybe_unused macb_resume(struct device *dev)
int err;
if (!device_may_wakeup(&bp->dev->dev))
- phy_init(bp->sgmii_phy);
+ phy_init(bp->phy);
if (!netif_running(netdev))
return 0;
--
2.51.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy
2025-10-22 7:38 ` [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy Théo Lebrun
@ 2025-10-22 8:05 ` Maxime Chevallier
2025-10-22 19:29 ` Andrew Lunn
1 sibling, 0 replies; 16+ messages in thread
From: Maxime Chevallier @ 2025-10-22 8:05 UTC (permalink / raw)
To: Théo Lebrun, 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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
Hi,
On 22/10/2025 09:38, Théo Lebrun wrote:
> The bp->sgmii_phy field is initialised at probe by init_reset_optional()
> if bp->phy_interface == 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éo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Thanks Théo,
Maxime
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy
2025-10-22 7:38 ` [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy Théo Lebrun
2025-10-22 8:05 ` Maxime Chevallier
@ 2025-10-22 19:29 ` Andrew Lunn
1 sibling, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2025-10-22 19:29 UTC (permalink / raw)
To: Théo Lebrun
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Russell King, netdev, devicetree,
linux-kernel, Benoît Monin, Grégory Clement,
Maxime Chevallier, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
On Wed, Oct 22, 2025 at 09:38:13AM +0200, Théo Lebrun wrote:
> The bp->sgmii_phy field is initialised at probe by init_reset_optional()
> if bp->phy_interface == 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éo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible
2025-10-22 7:38 [PATCH net-next v2 0/5] net: macb: EyeQ5 support Théo Lebrun
` (3 preceding siblings ...)
2025-10-22 7:38 ` [PATCH net-next v2 4/5] net: macb: rename bp->sgmii_phy field to bp->phy Théo Lebrun
@ 2025-10-22 7:38 ` Théo Lebrun
2025-10-22 8:09 ` Maxime Chevallier
4 siblings, 1 reply; 16+ messages in thread
From: Théo Lebrun @ 2025-10-22 7:38 UTC (permalink / raw)
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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Maxime Chevallier, Tawfik Bayouk,
Thomas Petazzoni, Vladimir Kondratiev, Théo Lebrun
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éo Lebrun <theo.lebrun@bootlin.com>
---
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/ethernet/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)
macb_init_hw(bp);
+ err = phy_set_mode_ext(bp->phy, PHY_MODE_ETHERNET, bp->phy_interface);
+ if (err)
+ goto reset_hw;
+
err = phy_power_on(bp->phy);
if (err)
goto reset_hw;
@@ -5187,6 +5191,28 @@ static int init_reset_optional(struct platform_device *pdev)
return ret;
}
+static int eyeq5_init(struct platform_device *pdev)
+{
+ struct net_device *netdev = platform_get_drvdata(pdev);
+ struct macb *bp = netdev_priv(netdev);
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ bp->phy = 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 = phy_init(bp->phy);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to init PHY\n");
+
+ ret = macb_init(pdev);
+ if (ret)
+ phy_exit(bp->phy);
+ return ret;
+}
+
static const struct macb_usrio_config sama7g5_usrio = {
.mii = 0,
.rmii = 1,
@@ -5341,6 +5367,17 @@ static const struct macb_config versal_config = {
.usrio = &macb_default_usrio,
};
+static const struct macb_config eyeq5_config = {
+ .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO |
+ MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_QUEUE_DISABLE |
+ MACB_CAPS_NO_LSO,
+ .dma_burst_length = 16,
+ .clk_init = macb_clk_init,
+ .init = eyeq5_init,
+ .jumbo_max_len = 10240,
+ .usrio = &macb_default_usrio,
+};
+
static const struct macb_config raspberrypi_rp1_config = {
.caps = 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[] = {
{ .compatible = "microchip,mpfs-macb", .data = &mpfs_config },
{ .compatible = "microchip,sama7g5-gem", .data = &sama7g5_gem_config },
{ .compatible = "microchip,sama7g5-emac", .data = &sama7g5_emac_config },
+ { .compatible = "mobileye,eyeq5-gem", .data = &eyeq5_config },
{ .compatible = "raspberrypi,rp1-gem", .data = &raspberrypi_rp1_config },
{ .compatible = "xlnx,zynqmp-gem", .data = &zynqmp_config},
{ .compatible = "xlnx,zynq-gem", .data = &zynq_config },
--
2.51.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible
2025-10-22 7:38 ` [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible Théo Lebrun
@ 2025-10-22 8:09 ` Maxime Chevallier
2025-10-22 9:34 ` Théo Lebrun
2025-10-22 19:33 ` Andrew Lunn
0 siblings, 2 replies; 16+ messages in thread
From: Maxime Chevallier @ 2025-10-22 8:09 UTC (permalink / raw)
To: Théo Lebrun, 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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
Hi,
On 22/10/2025 09:38, Théo Lebrun wrote:
> 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éo Lebrun <theo.lebrun@bootlin.com>
This seems good to me. I was worried that introducing the unconditionnal
call to phy_set_mode_ext() could trigger spurious errors should the
generic PHY driver not support the requested interface, but AFAICT
there's only the zynqmp in-tree that use the 'phys' property with macb,
and the associated generic PHY driver (drivers/phy/phy-zynqmp.c) doesn't
implement a .set_mode, so that looks safe.
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Thanks !
Maxime
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible
2025-10-22 8:09 ` Maxime Chevallier
@ 2025-10-22 9:34 ` Théo Lebrun
2025-10-22 19:33 ` Andrew Lunn
1 sibling, 0 replies; 16+ messages in thread
From: Théo Lebrun @ 2025-10-22 9:34 UTC (permalink / raw)
To: Maxime Chevallier, Théo Lebrun, 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, devicetree, linux-kernel, Benoît Monin,
Grégory Clement, Tawfik Bayouk, Thomas Petazzoni,
Vladimir Kondratiev
On Wed Oct 22, 2025 at 10:09 AM CEST, Maxime Chevallier wrote:
> On 22/10/2025 09:38, Théo Lebrun wrote:
>> 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éo Lebrun <theo.lebrun@bootlin.com>
>
> This seems good to me. I was worried that introducing the unconditionnal
> call to phy_set_mode_ext() could trigger spurious errors should the
> generic PHY driver not support the requested interface, but AFAICT
> there's only the zynqmp in-tree that use the 'phys' property with macb,
> and the associated generic PHY driver (drivers/phy/phy-zynqmp.c) doesn't
> implement a .set_mode, so that looks safe.
>
> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Ah, good catch. I checked that both !phy || !phy->ops->set_mode lead to
return 0, but I hadn't checked if other PHY drivers could have a
.set_mode() implementation that failed on this new call.
Compatibles that might read a "phys" DT property:
- cdns,zynqmp-gem => no DT upstream
- microchip,mpfs-macb => no DT upstream
- xlnx,versal-gem => xilinx/versal-net.dtsi, &gem0..1, no PHY attached.
- xlnx,zynqmp-gem => xilinx/zynqmp.dtsi, &gem0..3, PHY attached in
xilinx/zynqmp-sck-kr-g-rev*.dtso. PHY provider is &psgtr,
"xlnx,zynqmp-psgtr-v1.1", drivers/phy/xilinx/phy-zynqmp.c
So as you pointed out, only xilinx/phy-zynqmp.c is used according to
upstream DTs. I also checked lkml, no patches adding a .set_mode().
We shouldn't be breaking upstream DTs with the current patch.
Thanks for the review Maxime,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible
2025-10-22 8:09 ` Maxime Chevallier
2025-10-22 9:34 ` Théo Lebrun
@ 2025-10-22 19:33 ` Andrew Lunn
2025-10-23 14:20 ` Théo Lebrun
1 sibling, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2025-10-22 19:33 UTC (permalink / raw)
To: Maxime Chevallier
Cc: Théo Lebrun, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Nicolas Ferre, Claudiu Beznea, Russell King, netdev,
devicetree, linux-kernel, Benoît Monin, Grégory Clement,
Tawfik Bayouk, Thomas Petazzoni, Vladimir Kondratiev
On Wed, Oct 22, 2025 at 10:09:49AM +0200, Maxime Chevallier wrote:
> Hi,
>
> On 22/10/2025 09:38, Théo Lebrun wrote:
> > 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éo Lebrun <theo.lebrun@bootlin.com>
>
> This seems good to me. I was worried that introducing the unconditionnal
> call to phy_set_mode_ext() could trigger spurious errors should the
> generic PHY driver not support the requested interface, but AFAICT
> there's only the zynqmp in-tree that use the 'phys' property with macb,
> and the associated generic PHY driver (drivers/phy/phy-zynqmp.c) doesn't
> implement a .set_mode, so that looks safe.
I was thinking along the same lines, is this actually safe? It would
be good to add something like this to the commit message to indicate
this change is safe, the needed code analysis has been performed.
Andrew
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v2 5/5] net: macb: Add "mobileye,eyeq5-gem" compatible
2025-10-22 19:33 ` Andrew Lunn
@ 2025-10-23 14:20 ` Théo Lebrun
0 siblings, 0 replies; 16+ messages in thread
From: Théo Lebrun @ 2025-10-23 14:20 UTC (permalink / raw)
To: Andrew Lunn, Maxime Chevallier
Cc: Théo Lebrun, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Nicolas Ferre, Claudiu Beznea, Russell King, netdev,
devicetree, linux-kernel, Benoît Monin, Grégory Clement,
Tawfik Bayouk, Thomas Petazzoni, Vladimir Kondratiev
On Wed Oct 22, 2025 at 9:33 PM CEST, Andrew Lunn wrote:
> On Wed, Oct 22, 2025 at 10:09:49AM +0200, Maxime Chevallier wrote:
>> Hi,
>>
>> On 22/10/2025 09:38, Théo Lebrun wrote:
>> > 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éo Lebrun <theo.lebrun@bootlin.com>
>>
>> This seems good to me. I was worried that introducing the unconditionnal
>> call to phy_set_mode_ext() could trigger spurious errors should the
>> generic PHY driver not support the requested interface, but AFAICT
>> there's only the zynqmp in-tree that use the 'phys' property with macb,
>> and the associated generic PHY driver (drivers/phy/phy-zynqmp.c) doesn't
>> implement a .set_mode, so that looks safe.
>
> I was thinking along the same lines, is this actually safe? It would
> be good to add something like this to the commit message to indicate
> this change is safe, the needed code analysis has been performed.
Sure, will integrate a summary similar to my reply to Maxime's message.
https://lore.kernel.org/lkml/DDOQYH87ZV1H.1QZH1R36WMIC6@bootlin.com/
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 16+ messages in thread