diff options
author | David S. Miller <davem@davemloft.net> | 2016-11-28 12:06:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-28 12:06:55 -0500 |
commit | 68c1644f8a760f49955809dfe39fbd631befbab8 (patch) | |
tree | 304d277be41298cf1bbde70850239c83fed28980 | |
parent | d936377414fadbafb4d17148d222fe45ca5442d4 (diff) | |
parent | e3230494b57ece68750e3e32d3e53d6b00917058 (diff) |
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>
-rw-r--r-- | Documentation/devicetree/bindings/net/ethernet.txt | 24 | ||||
-rw-r--r-- | drivers/net/phy/realtek.c | 20 |
2 files changed, 32 insertions, 12 deletions
diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt index e1d76812419c..05150957ecfd 100644 --- a/Documentation/devicetree/bindings/net/ethernet.txt +++ b/Documentation/devicetree/bindings/net/ethernet.txt | |||
@@ -9,10 +9,26 @@ The following properties are common to the Ethernet controllers: | |||
9 | - max-speed: number, specifies maximum speed in Mbit/s supported by the device; | 9 | - max-speed: number, specifies maximum speed in Mbit/s supported by the device; |
10 | - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than | 10 | - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than |
11 | the maximum frame size (there's contradiction in ePAPR). | 11 | the maximum frame size (there's contradiction in ePAPR). |
12 | - phy-mode: string, operation mode of the PHY interface; supported values are | 12 | - phy-mode: string, operation mode of the PHY interface. This is now a de-facto |
13 | "mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id", | 13 | standard property; supported values are: |
14 | "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii", "trgmii"; this is now a | 14 | * "mii" |
15 | de-facto standard property; | 15 | * "gmii" |
16 | * "sgmii" | ||
17 | * "qsgmii" | ||
18 | * "tbi" | ||
19 | * "rev-mii" | ||
20 | * "rmii" | ||
21 | * "rgmii" (RX and TX delays are added by the MAC when required) | ||
22 | * "rgmii-id" (RGMII with internal RX and TX delays provided by the PHY, the | ||
23 | MAC should not add the RX or TX delays in this case) | ||
24 | * "rgmii-rxid" (RGMII with internal RX delay provided by the PHY, the MAC | ||
25 | should not add an RX delay in this case) | ||
26 | * "rgmii-txid" (RGMII with internal TX delay provided by the PHY, the MAC | ||
27 | should not add an TX delay in this case) | ||
28 | * "rtbi" | ||
29 | * "smii" | ||
30 | * "xgmii" | ||
31 | * "trgmii" | ||
16 | - phy-connection-type: the same as "phy-mode" property but described in ePAPR; | 32 | - phy-connection-type: the same as "phy-mode" property but described in ePAPR; |
17 | - phy-handle: phandle, specifies a reference to a node representing a PHY | 33 | - phy-handle: phandle, specifies a reference to a node representing a PHY |
18 | device; this property is described in ePAPR and so preferred; | 34 | device; this property is described in ePAPR and so preferred; |
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index aadd6e9f54ad..9cbe645e3d89 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c | |||
@@ -102,15 +102,19 @@ static int rtl8211f_config_init(struct phy_device *phydev) | |||
102 | if (ret < 0) | 102 | if (ret < 0) |
103 | return ret; | 103 | return ret; |
104 | 104 | ||
105 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { | 105 | phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); |
106 | /* enable TXDLY */ | 106 | reg = phy_read(phydev, 0x11); |
107 | phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); | 107 | |
108 | reg = phy_read(phydev, 0x11); | 108 | /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ |
109 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || | ||
110 | phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | ||
109 | reg |= RTL8211F_TX_DELAY; | 111 | reg |= RTL8211F_TX_DELAY; |
110 | phy_write(phydev, 0x11, reg); | 112 | else |
111 | /* restore to default page 0 */ | 113 | reg &= ~RTL8211F_TX_DELAY; |
112 | phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); | 114 | |
113 | } | 115 | phy_write(phydev, 0x11, reg); |
116 | /* restore to default page 0 */ | ||
117 | phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); | ||
114 | 118 | ||
115 | return 0; | 119 | return 0; |
116 | } | 120 | } |