1
0
Fork 0

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>
5.4-rM2-2.2.x-imx-squashed
Florin Chiculita 2018-12-16 22:35:44 +02:00 committed by Dong Aisheng
parent 46bb3930ed
commit 8989469663
1 changed files with 23 additions and 7 deletions

View File

@ -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, mykmod_work_handler);
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 *phydev)
{
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;