net: phy: Force master mode for RTL8211C on some boards
Subsystems (2)
v5 cover net: phy: Force master mode for RTL8211C on some boards
This patch is required to get reliable 1000BASE-T operation on some boards using the RTL8211C(L) PHY.
Following discussions on v2 of this patch, I have removed the incorrect check for the RTL8211C(L). Affected boards now have to define CONFIG_RTL8211X_PHY_FORCE_MASTER to benefit from the fix.
Note that this patch requires Karsten Merkers '[PATCH] net: phy: Realtek RTL8211B/C PHY ID fix' as well as Hans de Goede's recent u-boot-sunxi pull request, specifically 1eae8f66ff749409eb96e2f3f3387c56232d0b8a and fc8991c61c393ce6a9d3dfc97cb56dbbd9e8cbba.
Michael
Changes in v5:
- Improve formatting of Kconfig help text. No content change. Change suggested by Karsten Merker.
- Fix order of defconfig entry (suggested by Karsten Marker)
Series-changes: 4
- Changed commit summary according to Chen-Yu Tsai's suggestion, modified to fit the 70 character limit
- Fix order of defconfig entry (suggested by Karsten Marker)
Changes in v4:
- Squashed previously separate commit introducing KCONFIG variable into commit containing main code change (Hans de Goede's suggestion)
- Changed KCONFIG description according to Karsten Merker's suggestions plus some clarification of my own
- Changed commit message according to Karsten Merker's suggestions
- Changed commit summary according to Chen-Yu Tsai's suggestion, modified to fit the 70 character limit
Changes in v3:
- Remove incorrect detection of RTL8211CL and use #ifdef instead (thanks to Karsten Merker)
- Introduced constants for register bits
Changes in v2:
- Removed accidental inclusion of Karsten's patch in my first submission of this series.
- Fix a typo in the code: 6 -> &
Michael Haas (3):
net: phy: Optionally force master mode for RTL PHY
sunxi: A20-Olimex-SOM-EVB: Force 8211CL to master
sunxi: A20-OLinuXino-Lime2: Force 8211CL to master
configs/A20-OLinuXino-Lime2_defconfig | 1 + configs/A20-Olimex-SOM-EVB_defconfig | 1 + drivers/net/Kconfig | 21 +++++++++++++++++++++ drivers/net/phy/realtek.c | 13 ++++++++++++- 4 files changed, 35 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.2
PATCH v5 1/3 net: phy: Optionally force master mode for RTL PHY
This patch introduces CONFIG_RTL8211X_PHY_FORCE_MASTER. If this define is set, RTL8211x PHYs (except for the RTL8211F) will have their 1000BASE-T master/slave autonegotiation disabled and forced to master mode.
This is helpful for PHYs like the RTL8211C which produce unstable links in slave mode. Such problems have been found on the A20-Olimex-SOM-EVB and A20-OLinuXino-Lime2.
There is no proper way to identify affected PHYs in software as the RTL8211C shares its UID with the RTL8211B. Thus, this fix requires the introduction of an #ifdef.
---
Changes in v5:
- Improve formatting of Kconfig help text. No content change. Change suggested by Karsten Merker.
Changes in v4:
- Squashed previously separate commit introducing KCONFIG variable into commit containing main code change (Hans de Goede's suggestion)
- Changed KCONFIG description according to Karsten Merker's suggestions plus some clarification of my own
- Changed commit message according to Karsten Merker's suggestions
Changes in v3:
- Remove incorrect detection of RTL8211CL and use #ifdef instead (thanks to Karsten Merker)
- Introduced constants for register bits
Changes in v2:
- Removed accidental inclusion of Karsten's patch in my first submission of this series.
- Fix a typo in the code: 6 -> &
drivers/net/Kconfig | 21 +++++++++++++++++++++ drivers/net/phy/realtek.c | 13 ++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-)
drivers/net/Kconfig +21 -0
@@ -13,6 +13,27 @@ config PHYLIB help Enable Ethernet PHY (physical media interface) support. +config RTL8211X_PHY_FORCE_MASTER + bool "Ethernet PHY RTL8211x: force 1000BASE-T master mode" + depends on PHYLIB + help + Force master mode for 1000BASE-T on RTl8211x PHYs (except for RTL8211F). + This can work around link stability and data corruption issues on gigabit + links which can occur in slave mode on certain PHYs, e.g. on the + RTL8211C(L). + + Please note that two directly connected devices (i.e. via crossover cable) + will not be able to establish a link between each other if they both force + master mode. Multiple devices forcing master mode when connected by a + network switch do not pose a problem as the switch configures its affected + ports into slave mode. + + This option only affects gigabit links. If you must establish a direct + connection between two devices which both force master mode, try forcing + the link speed to 100MBit/s. + + If unsure, say N. + menuconfig NETDEVICES bool "Network device support" depends on NET
drivers/net/phy/realtek.c +12 -1
@@ -12,6 +12,10 @@#define PHY_AUTONEGOTIATE_TIMEOUT 5000 +/* RTL8211x 1000BASE-T Control Register */ +#define MIIM_RTL8211x_CTRL1000T_MSCE (1 << 12); +#define MIIM_RTL8211X_CTRL1000T_MASTER (1 << 11); +/* RTL8211x PHY Status Register */ #define MIIM_RTL8211x_PHY_STATUS 0x11#define MIIM_RTL8211x_PHYSTAT_SPEED 0xc000
@@ -53,7 +57,14 @@ static int rtl8211x_config(struct phy_device *phydev)*/ phy_write (phydev,MDIO_DEVAD_NONE , MIIM_RTL8211x_PHY_INER, MIIM_RTL8211x_PHY_INTR_DIS); - +#ifdef CONFIG_RTL8211X_PHY_FORCE_MASTER +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); +#endif /* read interrupt status just to clear it */ phy_read (phydev,MDIO_DEVAD_NONE , MIIM_RTL8211x_PHY_INER);
Signature · 1 line
2.7.2
PATCH v5 1/3 net: phy: Optionally force master mode for RTL PHY
Quoted 13 lines · Michael Haas
This patch introduces
CONFIG_RTL8211X_PHY_FORCE_MASTER. If this define is set, RTL8211x PHYs (except for the RTL8211F) will have their 1000BASE-T master/slave autonegotiation disabled and forced to master mode.This is helpful for PHYs like the RTL8211C which produce unstable links in slave mode. Such problems have been found on the A20-Olimex-SOM-EVB and A20-OLinuXino-Lime2.
There is no proper way to identify affected PHYs in software as the RTL8211C shares its UID with the RTL8211B. Thus, this fix requires the introduction of an #ifdef.
Quoted 8 lines
CC fradav at gmail.comCC merker at debian.orgCC hdegoede at redhat.comCC ijc at hellion.org.ukCC joe.hershberger at ni.comSigned-off-by Michael Haas <[email protected]>Tested-by Karsten Merker <[email protected]>
PATCH v5 1/3 net: phy: Optionally force master mode for RTL PHY
Hi,
Quoted 21 lines · Joe Hershberger
Quoted 19 lines · Michael Haas
This patch introduces
CONFIG_RTL8211X_PHY_FORCE_MASTER. If this define is set, RTL8211x PHYs (except for the RTL8211F) will have their 1000BASE-T master/slave autonegotiation disabled and forced to master mode.This is helpful for PHYs like the RTL8211C which produce unstable links in slave mode. Such problems have been found on the A20-Olimex-SOM-EVB and A20-OLinuXino-Lime2.
There is no proper way to identify affected PHYs in software as the RTL8211C shares its UID with the RTL8211B. Thus, this fix requires the introduction of an #ifdef.
CC fradav at gmail.comCC merker at debian.orgCC hdegoede at redhat.comCC ijc at hellion.org.ukCC joe.hershberger at ni.com
Quoted 4 lines
Quoted 2 lines
Signed-off-by Michael Haas <[email protected]>Tested-by Karsten Merker <[email protected]>Acked-by Joe Hershberger <[email protected]>
Series looks good to me:
Joe, how do you want to proceed with upstreaming this, shall I take all 3 patches upstream through u-boot-sunxi ?
Regards,
Hans
PATCH v5 1/3 net: phy: Optionally force master mode for RTL PHY
Hi Hans,
Quoted 34 lines · Hans de Goede
Hi,
Quoted 23 lines · Joe Hershberger
Quoted 20 lines · Michael Haas
This patch introduces
CONFIG_RTL8211X_PHY_FORCE_MASTER. If this define is set, RTL8211x PHYs (except for the RTL8211F) will have their 1000BASE-T master/slave autonegotiation disabled and forced to master mode.This is helpful for PHYs like the RTL8211C which produce unstable links in slave mode. Such problems have been found on the A20-Olimex-SOM-EVB and A20-OLinuXino-Lime2.
There is no proper way to identify affected PHYs in software as the RTL8211C shares its UID with the RTL8211B. Thus, this fix requires the introduction of an #ifdef.
CC fradav at gmail.comCC merker at debian.orgCC hdegoede at redhat.comCC ijc at hellion.org.ukCC joe.hershberger at ni.comQuoted 5 lines
Quoted 2 lines
Signed-off-by Michael Haas <[email protected]>Tested-by Karsten Merker <[email protected]>Acked-by Joe Hershberger <[email protected]>
Quoted 6 lines
Series looks good to me:
Acked-by Hans de Goede <[email protected]>Joe, how do you want to proceed with upstreaming this, shall I take all 3 patches upstream through u-boot-sunxi ?
Sounds good to me.
-Joe
PATCH v5 2/3 sunxi: A20-Olimex-SOM-EVB: Force 8211CL to master
In reply to Michael HaasForce master mode for 1000BASE-T operation on the
A20-Olimex-SOM-EVB.
Karsten Merker reports that this change is necessary to get a reliable link at gigabit speeds.
---
Changes in v5:
- Fix order of defconfig entry (suggested by Karsten Marker)
Series-changes: 4
- Changed commit summary according to Chen-Yu Tsai's suggestion, modified to fit the 70 character limit
Changes in v4: None
Changes in v3: None
Changes in v2: None
configs/A20-Olimex-SOM-EVB_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/A20-Olimex-SOM-EVB_defconfig +1 -0
@@ -17,5 +17,6 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y +CONFIG_RTL8211X_PHY_FORCE_MASTER=y CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y
Signature · 1 line
2.7.2
PATCH v5 3/3 sunxi: A20-OLinuXino-Lime2: Force 8211CL to master
In reply to Michael HaasForce master mode on the A20-OLinuXino-Lime2. This change is required to get a reliable link at gigabit speeds.
---
Changes in v5:
- Fix order of defconfig entry (suggested by Karsten Marker)
Changes in v4:
- Changed commit summary according to Chen-Yu Tsai's suggestion, modified to fit the 70 character limit
Changes in v3: None
Changes in v2: None
configs/A20-OLinuXino-Lime2_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/A20-OLinuXino-Lime2_defconfig +1 -0
@@ -14,5 +14,6 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y +CONFIG_RTL8211X_PHY_FORCE_MASTER=y CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y
Signature · 1 line
2.7.2
v5 cover net: phy: Force master mode for RTL8211C on some boards
In reply to Michael HaasHi,
Quoted 7 lines · Michael Haas
This patch is required to get reliable 1000BASE-T operation on some boards using the RTL8211C(L) PHY.
Following discussions on v2 of this patch, I have removed the incorrect check for the RTL8211C(L). Affected boards now have to define
CONFIG_RTL8211X_PHY_FORCE_MASTERto benefit from the fix.
Quoted 6 lines
Note that this patch requires Karsten Merkers '[PATCH] net: phy: Realtek RTL8211B/C PHY ID fix' as well as Hans de Goede's recent u-boot-sunxi pull request, specifically
1eae8f66ff749409eb96e2f3f3387c56232d0b8aandfc8991c61c393ce6a9d3dfc97cb56dbbd9e8cbba.Michael
Thanks, I've applied this series to my tree, and it will be part of the next u-boot-sunxi pull-req.
Regards,
Hans
Quoted 40 lines
Changes in v5:
- Improve formatting ofKconfighelp text. No content change. Change suggested by Karsten Merker.
- Fix order of defconfig entry (suggested by Karsten Marker)
Series-changes: 4
- Changed commit summary according to Chen-Yu Tsai's suggestion, modified to fit the 70 character limit
- Fix order of defconfig entry (suggested by Karsten Marker)Changes in v4:
- Squashed previously separate commit introducing KCONFIG variable into commit containing main code change (Hans de Goede's suggestion)
- Changed KCONFIG description according to Karsten Merker's suggestions plus some clarification of my own
- Changed commit message according to Karsten Merker's suggestions
- Changed commit summary according to Chen-Yu Tsai's suggestion, modified to fit the 70 character limitChanges in v3:
- Remove incorrect detection of RTL8211CL and use #ifdef instead (thanks to Karsten Merker)
- Introduced constants for register bitsChanges in v2:
- Removed accidental inclusion of Karsten's patch in my first submission of this series.
- Fix a typo in the code: 6 -> &Michael Haas (3):
net: phy: Optionally force master mode for RTL PHY
sunxi: A20-Olimex-SOM-EVB: Force 8211CL to master
sunxi: A20-OLinuXino-Lime2: Force 8211CL to masterconfigs/A20-OLinuXino-Lime2_defconfig | 1 + configs/A20-Olimex-SOM-EVB_defconfig | 1 + drivers/net/Kconfig | 21 +++++++++++++++++++++ drivers/net/phy/realtek.c | 13 ++++++++++++- 4 files changed, 35 insertions(+), 1 deletion(-)