openwrt/target/linux/layerscape/patches-5.4/701-net-0387-net-phy-vsc8514-enable-in-band-SGMII-auto-negotiatio.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

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)