[RFC PATCH 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568
Coia Prant
coiaprant at gmail.com
Wed Jul 15 13:33:04 PDT 2026
> [ ... ]
> > @@ -1379,6 +1441,9 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
> > if (ret)
> > return ret;
> >
> > + if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_SGMII)
> > + goto set_mode;
> > +
>
> [Severity: High]
> Does this goto skip enabling the MAC clocks? By jumping directly to set_mode,
> we bypass the call to gmac_clk_enable() further down in this function.
>
> Can this cause a synchronous external abort when the MAC registers are accessed
> subsequently while their clock domain remains disabled?
You are correct. The original RFC patch had this issue: the SGMII path
bypassed `gmac_clk_enable()` via the `goto set_mode`, which could lead
to hardware faults when accessing MAC registers with the clock disabled.
This has been fixed in the updated version of the patch. The clock enable
is now moved before the SGMII check:
ret = gmac_clk_enable(bsp_priv, true);
if (ret)
return ret;
if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_SGMII)
goto set_mode;
So the clocks are always enabled before any register access, regardless of
the interface mode.
The error handling has also been cleaned up with a unified `clk_disable`
label, and the default (unhandled interface) case now properly returns an
error and disables the clocks.
Regarding stable backport: this issue does not exist in the 6.18
kernel that I am using for backport testing, as the code structure in
`rk_gmac_powerup()` is significantly different there. The fix only
affects the mainline version of the patch.
Thanks,
Coia
More information about the linux-phy
mailing list