mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
|
From ebfedac745f6d747df2214e11a89ba44742b3def Mon Sep 17 00:00:00 2001
|
||
|
From: Alex Marginean <alexandru.marginean@nxp.com>
|
||
|
Date: Fri, 27 Dec 2019 21:44:46 +0200
|
||
|
Subject: [PATCH] net: phy: vsc8514: enable in-band SGMII auto-negotiation
|
||
|
setting
|
||
|
|
||
|
The default in-band AN 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.
|
||
|
|
||
|
We would like to make this explicitly configurable rather than hardcoded
|
||
|
as "on" as we are doing right now, but we'd rather hardcode it in LSDK
|
||
|
and wait until a solution lands upstream, than invent a solution for
|
||
|
this here.
|
||
|
|
||
|
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
|
||
|
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||
|
---
|
||
|
drivers/net/phy/mscc.c | 10 ++++++++++
|
||
|
1 file changed, 10 insertions(+)
|
||
|
|
||
|
--- 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
|
||
|
@@ -2131,6 +2133,14 @@ static int vsc8514_config_init(struct ph
|
||
|
|
||
|
mutex_unlock(&phydev->mdio.bus->mdio_lock);
|
||
|
|
||
|
+ ret = phy_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_EXTENDED_3);
|
||
|
+ if (ret)
|
||
|
+ return ret;
|
||
|
+
|
||
|
+ ret = phy_set_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)
|