[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191227213626.4404-7-olteanv@gmail.com>
Date: Fri, 27 Dec 2019 23:36:21 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: davem@...emloft.net, jakub.kicinski@...ronome.com,
linux@...linux.org.uk, andrew@...n.ch, f.fainelli@...il.com,
vivien.didelot@...il.com
Cc: alexandru.marginean@....com, claudiu.manoil@....com,
xiaoliang.yang_1@....com, yangbo.lu@....com,
netdev@...r.kernel.org, alexandre.belloni@...tlin.com,
horatiu.vultur@...rochip.com, UNGLinuxDriver@...rochip.com,
Vladimir Oltean <vladimir.oltean@....com>
Subject: [PATCH v3 net-next 06/11] net: phy: vsc8514: configure explicit in-band SGMII auto-negotiation settings
From: Alex Marginean <alexandru.marginean@....com>
The IN_BAND_AN_DEFAULT setting for the VSC8514 PHY is not very reliable:
its out-of-reset state is with SerDes AN disabled, but certain boot
firmware (such as U-Boot) enables it during the boot process.
So its final state as seen by Linux depends on whether the U-Boot PHY
driver has run or not.
If SGMII auto-negotiation is enabled but not acknowledged by the MAC,
the PHY does not pass traffic.
But otherwise, it is able to pass traffic both with AN disabled, and
with AN enabled. So make it explicitly configurable.
Signed-off-by: Alex Marginean <alexandru.marginean@....com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
Changes in v3:
- Patch is new.
drivers/net/phy/mscc.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 50214c081164..b9a22474a715 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -176,6 +176,8 @@ enum rgmii_rx_clock_delay {
#define SECURE_ON_PASSWD_LEN_4 0x4000
/* Extended Page 3 Registers */
+#define MSCC_PHY_SERDES_CON 16
+#define MSCC_PHY_SERDES_ANEG BIT(7)
#define MSCC_PHY_SERDES_TX_VALID_CNT 21
#define MSCC_PHY_SERDES_TX_CRC_ERR_CNT 22
#define MSCC_PHY_SERDES_RX_VALID_CNT 28
@@ -2157,6 +2159,19 @@ static int vsc8514_config_init(struct phy_device *phydev)
mutex_unlock(&phydev->mdio.bus->mdio_lock);
+ ret = phy_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_EXTENDED_3);
+ if (ret)
+ return ret;
+
+ if (phydev->in_band_autoneg == IN_BAND_AN_ENABLED)
+ ret = phy_set_bits(phydev, MSCC_PHY_SERDES_CON,
+ MSCC_PHY_SERDES_ANEG);
+ else if (phydev->in_band_autoneg == IN_BAND_AN_DISABLED)
+ ret = phy_clear_bits(phydev, MSCC_PHY_SERDES_CON,
+ MSCC_PHY_SERDES_ANEG);
+ if (ret)
+ return ret;
+
ret = phy_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_STANDARD);
if (ret)
--
2.17.1
Powered by blists - more mailing lists