mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
75 lines
2.1 KiB
Diff
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;
|
||
|
|