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