Openwrt/target/linux/layerscape/patches-5.4/701-net-0329-net-phy-Inphi-IN112525_s03-retimer-updates.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

75 lines
2.1 KiB
Diff

From a1b049babfd0ae224179dc82ec69cb9bbf585699 Mon Sep 17 00:00:00 2001
From: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Date: Sun, 16 Dec 2018 22:35:44 +0200
Subject: [PATCH] net/phy: Inphi IN112525_s03 retimer updates
The retimer doesn't get probed in linux due to the fact that it's a
non-standard clause-45 device. Hardcoding the phyid in device-tree
and adding custom routines for registry read/write operations
solves the issue.
Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
---
drivers/net/phy/inphi.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
--- a/drivers/net/phy/inphi.c
+++ b/drivers/net/phy/inphi.c
@@ -82,11 +82,7 @@
#define PHYMISC_REG22 0x01C0
#define RX_VCO_CODE_OFFSET 5
-
-#define mdio_wr(a, b) phy_write_mmd(inphi_phydev, MDIO_MMD_VEND1, (a), (b))
-#define mdio_rd(a) phy_read_mmd(inphi_phydev, MDIO_MMD_VEND1, (a))
-
-#define VCO_CODE 390
+#define VCO_CODE 390
int vco_codes[ALL_LANES] = {
VCO_CODE,
@@ -102,6 +98,23 @@ static DECLARE_DELAYED_WORK(mykmod_work,
static unsigned long onesec;
struct phy_device *inphi_phydev;
+static int mdio_wr(u32 regnum, u16 val)
+{
+ regnum = MII_ADDR_C45 | (MDIO_MMD_VEND1 << 16) | (regnum & 0xffff);
+
+ return mdiobus_write(inphi_phydev->mdio.bus, inphi_phydev->mdio.addr,
+ regnum, val);
+}
+
+static int mdio_rd(u32 regnum)
+{
+ regnum = MII_ADDR_C45 | (MDIO_MMD_VEND1 << 16) | (regnum & 0xffff);
+
+ return mdiobus_read(inphi_phydev->mdio.bus, inphi_phydev->mdio.addr,
+ regnum);
+}
+
+
int bit_test(int value, int bit_field)
{
int result;
@@ -518,14 +531,17 @@ int inphi_probe(struct phy_device *phyde
{
int phy_id = 0, id_lsb = 0, id_msb = 0;
+ /* setup the inphi_phydev ptr for mdio_rd/mdio_wr APIs */
+ inphi_phydev = phydev;
+
/* Read device id from phy registers */
- id_lsb = phy_read_mmd(phydev, MDIO_MMD_VEND1, INPHI_S03_DEVICE_ID_MSB);
+ id_lsb = mdio_rd(INPHI_S03_DEVICE_ID_MSB);
if (id_lsb < 0)
return -ENXIO;
phy_id = id_lsb << 16;
- id_msb = phy_read_mmd(phydev, MDIO_MMD_VEND1, INPHI_S03_DEVICE_ID_LSB);
+ id_msb = mdio_rd(INPHI_S03_DEVICE_ID_LSB);
if (id_msb < 0)
return -ENXIO;