net: ethernet: stmmac: fix write to sgmii_adapter_base
commit 5fd1fe4807f91ea0cca043114d929faa11bd4190 upstream.
I made a mistake with the commit a6aaa0032424 ("net: ethernet: stmmac:
fix altr_tse_pcs function when using a fixed-link"). I should have
tested against both scenario of having a SGMII interface and one
without.
Without the SGMII PCS TSE adpater, the sgmii_adapter_base address is
NULL, thus a write to this address will fail.
Cc: stable@vger.kernel.org
Fixes: a6aaa0032424 ("net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link")
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220420152345.27415-1-dinguyen@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
236dd62230
commit
11d16498d7
@@ -65,6 +65,7 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
|
|||||||
struct phy_device *phy_dev = ndev->phydev;
|
struct phy_device *phy_dev = ndev->phydev;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
if (sgmii_adapter_base)
|
||||||
writew(SGMII_ADAPTER_DISABLE,
|
writew(SGMII_ADAPTER_DISABLE,
|
||||||
sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
|
sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
|
||||||
|
|
||||||
@@ -88,10 +89,11 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
|
|||||||
writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
|
writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (phy_dev && sgmii_adapter_base) {
|
||||||
writew(SGMII_ADAPTER_ENABLE,
|
writew(SGMII_ADAPTER_ENABLE,
|
||||||
sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
|
sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
|
||||||
if (phy_dev)
|
|
||||||
tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed);
|
tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)
|
static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)
|
||||||
|
|||||||
Reference in New Issue
Block a user