Merge branch 'fix-RTL8211F-TX-delay-handling'
Martin Blumenstingl says: ==================== net: phy: realtek: fix RTL8211F TX-delay handling The RTL8211F PHY driver currently enables the TX-delay only when the phy-mode is PHY_INTERFACE_MODE_RGMII. This is incorrect, because there are three RGMII variations of the phy-mode which explicitly request the PHY to enable the RX and/or TX delay, while PHY_INTERFACE_MODE_RGMII specifies that the PHY should disable the RX and/or TX delays. Additionally to the RTL8211F PHY driver change this contains a small update to the phy-mode documentation to clarify the purpose of the RGMII phy-modes. While this may not be perfect yet it's at least a start. Please feel free to drop this patch from this series and send an improved version yourself. These patches are the results of recent discussions, see [0] [0] http://lists.infradead.org/pipermail/linux-amlogic/2016-November/001688.html ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
68c1644f8a
|
@ -9,10 +9,26 @@ The following properties are common to the Ethernet controllers:
|
|||
- max-speed: number, specifies maximum speed in Mbit/s supported by the device;
|
||||
- max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than
|
||||
the maximum frame size (there's contradiction in ePAPR).
|
||||
- phy-mode: string, operation mode of the PHY interface; supported values are
|
||||
"mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",
|
||||
"rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii", "trgmii"; this is now a
|
||||
de-facto standard property;
|
||||
- phy-mode: string, operation mode of the PHY interface. This is now a de-facto
|
||||
standard property; supported values are:
|
||||
* "mii"
|
||||
* "gmii"
|
||||
* "sgmii"
|
||||
* "qsgmii"
|
||||
* "tbi"
|
||||
* "rev-mii"
|
||||
* "rmii"
|
||||
* "rgmii" (RX and TX delays are added by the MAC when required)
|
||||
* "rgmii-id" (RGMII with internal RX and TX delays provided by the PHY, the
|
||||
MAC should not add the RX or TX delays in this case)
|
||||
* "rgmii-rxid" (RGMII with internal RX delay provided by the PHY, the MAC
|
||||
should not add an RX delay in this case)
|
||||
* "rgmii-txid" (RGMII with internal TX delay provided by the PHY, the MAC
|
||||
should not add an TX delay in this case)
|
||||
* "rtbi"
|
||||
* "smii"
|
||||
* "xgmii"
|
||||
* "trgmii"
|
||||
- phy-connection-type: the same as "phy-mode" property but described in ePAPR;
|
||||
- phy-handle: phandle, specifies a reference to a node representing a PHY
|
||||
device; this property is described in ePAPR and so preferred;
|
||||
|
|
|
@ -102,15 +102,19 @@ static int rtl8211f_config_init(struct phy_device *phydev)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
|
||||
/* enable TXDLY */
|
||||
phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08);
|
||||
reg = phy_read(phydev, 0x11);
|
||||
phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08);
|
||||
reg = phy_read(phydev, 0x11);
|
||||
|
||||
/* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */
|
||||
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
|
||||
phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
|
||||
reg |= RTL8211F_TX_DELAY;
|
||||
phy_write(phydev, 0x11, reg);
|
||||
/* restore to default page 0 */
|
||||
phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0);
|
||||
}
|
||||
else
|
||||
reg &= ~RTL8211F_TX_DELAY;
|
||||
|
||||
phy_write(phydev, 0x11, reg);
|
||||
/* restore to default page 0 */
|
||||
phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue