[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230629034846.30600-4-quic_luoj@quicinc.com>
Date: Thu, 29 Jun 2023 11:48:46 +0800
From: Luo Jie <quic_luoj@...cinc.com>
To: <andrew@...n.ch>, <hkallweit1@...il.com>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<linux@...linux.org.uk>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<quic_sricharan@...cinc.com>, Luo Jie <quic_luoj@...cinc.com>
Subject: [PATCH 3/3] net: phy: at803x: add qca8081 fifo reset on the link down
The qca8081 fifo needs to be reset on link down and released
on the link up in case of any abnormal issue such as the
packet blocked on the PHY.
Signed-off-by: Luo Jie <quic_luoj@...cinc.com>
---
drivers/net/phy/at803x.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 29aab7eaaa90..5dc707eaf18c 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -276,6 +276,9 @@
#define QCA808X_PHY_MMD7_CHIP_TYPE 0x901d
#define QCA808X_PHY_CHIP_TYPE_1G BIT(0)
+#define QCA8081_PHY_SERDES_MMD1_FIFO_CTRL 0x9072
+#define QCA8081_PHY_FIFO_RSTN BIT(11)
+
MODULE_DESCRIPTION("Qualcomm Atheros AR803x and QCA808X PHY driver");
MODULE_AUTHOR("Matus Ujhelyi");
MODULE_LICENSE("GPL");
@@ -1808,6 +1811,16 @@ static int qca808x_config_init(struct phy_device *phydev)
QCA808X_ADC_THRESHOLD_MASK, QCA808X_ADC_THRESHOLD_100MV);
}
+static int qca808x_fifo_reset(struct phy_device *phydev)
+{
+ /* Reset serdes fifo on link down, Release serdes fifo on link up,
+ * the serdes address is phy address added by 1.
+ */
+ return mdiobus_c45_modify_changed(phydev->mdio.bus, phydev->mdio.addr + 1,
+ MDIO_MMD_PMAPMD, QCA8081_PHY_SERDES_MMD1_FIFO_CTRL,
+ QCA8081_PHY_FIFO_RSTN, phydev->link ? QCA8081_PHY_FIFO_RSTN : 0);
+}
+
static int qca808x_read_status(struct phy_device *phydev)
{
int ret;
@@ -1827,6 +1840,10 @@ static int qca808x_read_status(struct phy_device *phydev)
if (ret < 0)
return ret;
+ ret = qca808x_fifo_reset(phydev);
+ if (ret < 0)
+ return ret;
+
if (phydev->link) {
if (phydev->speed == SPEED_2500)
phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
--
2.17.1
Powered by blists - more mailing lists