Commit 7b55b415 authored by Madalin Bucur's avatar Madalin Bucur Committed by Khalid Elmously

net/fsl: treat fsl,erratum-a011043

BugLink: https://bugs.launchpad.net/bugs/1864774

[ Upstream commit 1d3ca681 ]

When fsl,erratum-a011043 is set, adjust for erratum A011043:
MDIO reads to internal PCS registers may result in having
the MDIO_CFG[MDIO_RD_ER] bit set, even when there is no
error and read data (MDIO_DATA[MDIO_DATA]) is correct.
Software may get false read error when reading internal
PCS registers through MDIO. As a workaround, all internal
MDIO accesses should ignore the MDIO_CFG[MDIO_RD_ER] bit.
Signed-off-by: default avatarMadalin Bucur <madalin.bucur@oss.nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent f2351eb6
...@@ -49,6 +49,7 @@ struct tgec_mdio_controller { ...@@ -49,6 +49,7 @@ struct tgec_mdio_controller {
struct mdio_fsl_priv { struct mdio_fsl_priv {
struct tgec_mdio_controller __iomem *mdio_base; struct tgec_mdio_controller __iomem *mdio_base;
bool is_little_endian; bool is_little_endian;
bool has_a011043;
}; };
static u32 xgmac_read32(void __iomem *regs, static u32 xgmac_read32(void __iomem *regs,
...@@ -226,7 +227,8 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) ...@@ -226,7 +227,8 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
return ret; return ret;
/* Return all Fs if nothing was there */ /* Return all Fs if nothing was there */
if (xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) { if ((xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
!priv->has_a011043) {
dev_err(&bus->dev, dev_err(&bus->dev,
"Error while reading PHY%d reg at %d.%hhu\n", "Error while reading PHY%d reg at %d.%hhu\n",
phy_id, dev_addr, regnum); phy_id, dev_addr, regnum);
...@@ -277,6 +279,9 @@ static int xgmac_mdio_probe(struct platform_device *pdev) ...@@ -277,6 +279,9 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
else else
priv->is_little_endian = false; priv->is_little_endian = false;
priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
"fsl,erratum-a011043");
ret = of_mdiobus_register(bus, np); ret = of_mdiobus_register(bus, np);
if (ret) { if (ret) {
dev_err(&pdev->dev, "cannot register MDIO bus\n"); dev_err(&pdev->dev, "cannot register MDIO bus\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment