[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56aed16d-4e03-4da9-9c53-5bb8359f313b@microchip.com>
Date: Thu, 30 Oct 2025 15:37:07 +0100
From: Nicolas Ferre <nicolas.ferre@...rochip.com>
To: Théo Lebrun <theo.lebrun@...tlin.com>, Andrew Lunn
<andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Claudiu Beznea
<claudiu.beznea@...on.dev>, Russell King <linux@...linux.org.uk>
CC: <netdev@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Benoît Monin
<benoit.monin@...tlin.com>, Grégory Clement
<gregory.clement@...tlin.com>, Maxime Chevallier
<maxime.chevallier@...tlin.com>, Tawfik Bayouk <tawfik.bayouk@...ileye.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>, Vladimir Kondratiev
<vladimir.kondratiev@...ileye.com>
Subject: Re: [PATCH net-next v3 5/5] net: macb: Add "mobileye,eyeq5-gem"
compatible
On 23/10/2025 at 18:22, 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.
>
> 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 <maxime.chevallier@...tlin.com>
> Signed-off-by: Théo Lebrun <theo.lebrun@...tlin.com>
Looks good to me, thanks:
Acked-by: Nicolas Ferre <nicolas.ferre@...rochip.com>
Best regards,
Nicolas
> ---
> 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 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)
>
> 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;
> @@ -5189,6 +5193,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,
> @@ -5343,6 +5369,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 |
> @@ -5374,6 +5411,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
>
Powered by blists - more mailing lists