Re: [PATCH net] net: stmmac: dwmac-socfpga: Don't access SGMII adapter when not available

From: Andrew Lunn
Date: Tue Nov 28 2023 - 11:37:44 EST


On Tue, Nov 28, 2023 at 10:45:37AM +0100, Maxime Chevallier wrote:
> The SGMII adapter isn't present on all dwmac-socfpga implementations.
> Make sure we don't try to configure it if we don't have this adapter.

If it does not exist, why even try to call socfpga_sgmii_config()?

It seems like this test needs moving up the call stack. socfpga_gen5_set_phy_mode():

if (phymode == PHY_INTERFACE_MODE_SGMII)
if (dwmac->sgmii_adapter_base)
socfpga_sgmii_config(dwmac, true);
else
return -EINVAL;

Same in socfpga_gen10_set_phy_mode()?

Andrew