[v4,1/3] net: stmmac: s32: use a syscon for S32_PHY_INTF_SEL_RGMII
Russell King (Oracle)
linux at armlinux.org.uk
Mon Jan 26 07:33:54 PST 2026
On Mon, Jan 26, 2026 at 03:24:30PM +0000, Simon Horman wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
>
> For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
> ---
> net: stmmac: s32: use a syscon for S32_PHY_INTF_SEL_RGMII
>
> This commit adds syscon/regmap support for accessing the GMAC_0_CTRL_STS
> register on s32 chipsets, while maintaining backwards compatibility with
> the existing direct MMIO approach for older device trees.
>
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c
> > index 5a485ee98fa7..2e6bb41f49e1 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c
>
> [ ... ]
>
> > @@ -40,7 +44,10 @@ struct s32_priv_data {
> >
> > static int s32_gmac_write_phy_intf_select(struct s32_priv_data *gmac)
> > {
> > - writel(S32_PHY_INTF_SEL_RGMII, gmac->ctrl_sts);
> > + if (gmac->ctrl_sts)
> > + writel(S32_PHY_INTF_SEL_RGMII, gmac->ctrl_sts);
> > + else
> > + regmap_write(gmac->sts_regmap, gmac->sts_offset, S32_PHY_INTF_SEL_RGMII);
>
> Should the regmap_write() return value be checked here? The function
> returns int and the caller s32_gmac_init() checks the return value
> expecting errors to be propagated. For comparison, dwmac-sun55i.c in
> sun55i_gmac200_set_syscon() does check regmap_write() return value:
>
> ret = regmap_write(regmap, SYSCON_REG, reg);
> if (ret < 0)
> return dev_err_probe(dev, ret, "Failed to write to syscon\n");
AI is wrong on this last line - s32_gmac_write_phy_intf_select() is
called from s32_gmac_init(), which is called from plat_dat->init.
plat_dat->init is called from two paths:
1. stmmac_pltfr_probe() -> stmmac_dvr_probe() -> plat_dat->init()
2. stmmac_resume() -> plat_dat->resume() -> stmmac_plat_resume() ->
stmmac_pltfr_init() -> plat_dat->init()
In the resume path, it is not appropriate to use dev_err_probe()
because we're not in the probe path.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
More information about the linux-arm-kernel
mailing list