PINE64
GbE: Optionally force master mode for RTL PHY - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Linux on Pine A64(+) (https://forum.pine64.org/forumdisplay.php?fid=6)
+--- Thread: GbE: Optionally force master mode for RTL PHY (/showthread.php?tid=1852)



GbE: Optionally force master mode for RTL PHY - xalius - 07-25-2016

A while back I stumbled over this patch for u-boot https://patchwork.ozlabs.org/patch/602067/ forcing the RTL80211C/E PHY into master mode to overcome some issues when the PHY is in slave mode.

Maybe this could be a source for the random GbE problems we see here sometimes?

I was just looking at Olimex blog and read the specs for their A64 board, and one of the features reads:


Code:
...
* Ethernet Gigabit interface works just in master mode
...

I tried adding the register read-modify-write to the 3.10.x BSP driver but failed, maybe someone with better skills can have a look at it? The patch boils down to:


Code:
/* RTL8211x 1000BASE-T Control Register */
#define MIIM_RTL8211x_CTRL1000T_MSCE (1 << 12);
#define MIIM_RTL8211X_CTRL1000T_MASTER (1 << 11);

...

    unsigned int reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_CTRL1000);
    /* force manual master/slave configuration */
    reg |= MIIM_RTL8211x_CTRL1000T_MSCE;
    /* force master mode */
    reg |= MIIM_RTL8211X_CTRL1000T_MASTER;
    phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, reg);

...


One read-modify-write operation....


RE: GbE: Optionally force master mode for RTL PHY - tllim - 07-25-2016

(07-25-2016, 06:04 AM)xalius Wrote: A while back I stumbled over this patch for u-boot https://patchwork.ozlabs.org/patch/602067/ forcing the RTL80211C/E PHY into master mode to overcome some issues when the PHY is in slave mode.

Maybe this could be a source for the random GbE problems we see here sometimes?

I was just looking at Olimex blog and read the specs for their A64 board, and one of the features reads:


Code:
...
* Ethernet Gigabit interface works just in master mode
...

I tried adding the register read-modify-write to the 3.10.x BSP driver but failed, maybe someone with better skills can have a look at it? The patch boils down to:


Code:
/* RTL8211x 1000BASE-T Control Register */
#define MIIM_RTL8211x_CTRL1000T_MSCE (1 << 12);
#define MIIM_RTL8211X_CTRL1000T_MASTER (1 << 11);

...

    unsigned int reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_CTRL1000);
    /* force manual master/slave configuration */
    reg |= MIIM_RTL8211x_CTRL1000T_MSCE;
    /* force master mode */
    reg |= MIIM_RTL8211X_CTRL1000T_MASTER;
    phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, reg);

...


One read-modify-write operation....

This is a good finding, I will ask our Android engineer to check out.