[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231128094538.228039-1-maxime.chevallier@bootlin.com>
Date: Tue, 28 Nov 2023 10:45:37 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: davem@...emloft.net
Cc: Maxime Chevallier <maxime.chevallier@...tlin.com>,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
linux-arm-kernel@...ts.infradead.org,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Simon Horman <horms@...nel.org>,
linux-stm32@...md-mailman.stormreply.com,
alexis.lothore@...tlin.com
Subject: [PATCH net] net: stmmac: dwmac-socfpga: Don't access SGMII adapter when not available
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.
Fixes: 5d1f3fe7d2d5 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver")
Signed-off-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index ba2ce776bd4d..ae120792e1b6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -243,7 +243,8 @@ static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
{
u16 val = enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE;
- writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+ if (dwmac->sgmii_adapter_base)
+ writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
}
static int socfpga_set_phy_mode_common(int phymode, u32 *val)
--
2.42.0
Powered by blists - more mailing lists