Skip to contentSkip to conversation

net: phy: Force master mode for RTL8211C on some boards

PATCH Superseded Michael Haas 5 participants 11 messages Mar 24, 2016 – Mar 26, 2016

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 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 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 (4):
net: phy: Optionally force master mode for RTL PHY
net: phy: Force master mode for A20-Olimex-SOM-EVB
net: phy: Force master mode A20-OLinuXino-Lime2
net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig

 configs/A20-OLinuXino-Lime2_defconfig |  1 +
 configs/A20-Olimex-SOM-EVB_defconfig  |  1 +
 drivers/net/Kconfig                   | 17 +++++++++++++++++
 drivers/net/phy/realtek.c             | 13 ++++++++++++-
 4 files changed, 31 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.2
#1 lore raw

PATCH v3 1/4 net: phy: Optionally force master mode for RTL PHY

This patch introduces CONFIG_RTL8211X_PHY_FORCE_MASTER. If this define is set, RTL8211x PHYs 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 as the RTL8211C shares its UID with the RTL8211B. Thus, this fixes requires the introduction of an #ifdef.

CC fradav at gmail.com
CC merker at debian.org
CC hdegoede at redhat.com
CC ijc at hellion.org.uk
CC joe.hershberger at ni.com

---

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/phy/realtek.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/phy/realtek.c +12 -1
index 259a87f..359ec50 100644
@@ -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
#2 lore raw

PATCH v3 2/4 net: phy: Force master mode for A20-Olimex-SOM-EVB

In reply to Michael Haas

Force 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 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
index 66d8f98..68de5f2 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)"
 CONFIG_CMD_GPIO=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_RTL8211X_PHY_FORCE_MASTER=y
Signature · 1 line
2.7.2
#4 lore raw

PATCH v3 3/4 net: phy: Force master mode A20-OLinuXino-Lime2

In reply to Michael Haas

Force master mode on the A20-OLinuXino-Lime2. This change is required to get a reliable link at gigabit speeds.

---

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
index 95c67d6..3bd4fa7 100644
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)"
 CONFIG_CMD_GPIO=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_RTL8211X_PHY_FORCE_MASTER=y
Signature · 1 line
2.7.2
#6 lore raw

PATCH v3 3/4 net: phy: Force master mode A20-OLinuXino-Lime2

In reply to Michael Haas
Quoted 4 lines · Michael Haas

Force master mode on the A20-OLinuXino-Lime2. This change is required to get a reliable link at gigabit speeds.

Glad to see someone finally got to the bottom of this. On the boards I have I only see the problem intermittantly, perhaps 2% of boots so virtually impossible to know if anything fixed it.

Is something needed in the kernel as well, or is it sufficient to do it in u-boot?

Iain

#7 lore raw

PATCH v3 3/4 net: phy: Force master mode A20-OLinuXino-Lime2

Quoted 7 lines · Iain Paton
Quoted 4 lines · Michael Haas

Force master mode on the A20-OLinuXino-Lime2. This change is required to get a reliable link at gigabit speeds.

Quoted 8 lines

Glad to see someone finally got to the bottom of this. On the boards I have I only see the problem intermittantly, perhaps 2% of boots so virtually impossible to know if anything fixed it.

Is something needed in the kernel as well, or is it sufficient to do it in u-boot?

Iain

I have not verified this extensively. In my experience, fixing u-boot is enough to get a stable link in the kernel.

Michael

#8 lore raw

PATCH v3 4/4 net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig

In reply to Michael Haas

This change mainly serves as a way to document the define.

---

Changes in v3: None
Changes in v2: None

 drivers/net/Kconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/net/Kconfig +17 -0
index 2a229b8..b102bc6 100644
@@ -13,6 +13,23 @@ 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.
+	  This is helpful for unstable gigabit links, e.g. on the
+	  RTL8211C(L).
+
+	  If two devices force master mode, they will not be able to establish
+	  a direct link between themselves. In this case, either:
+	   - live with an unstable link and disable this option
+	   - reduce link speed to 100MBit/s
+	   - use a switch
+
+	  Does not apply to RTL8211F.
+	  If unsure, say N.
+
 menuconfig NETDEVICES
 	bool "Network device support"
 	depends on NET
Signature · 1 line
2.7.2
#9 lore raw

v3 cover net: phy: Force master mode for RTL8211C on some boards

In reply to Michael Haas

Hi Michael,

Quoted 4 lines · Michael Haas

This patch is required to get reliable 1000BASE-T operation on some boards using the RTL8211C(L) PHY.

Quoted 8 lines

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.

Thanks for this patch series. I believe you should squash patch 4 into patch 1, as that is where it belongs IMHO.

Also note that patch 2/3 will not do anything unless patch 4 is also applied setting CONFIG_FOO in a defconfig does not do anything unless CONFIG_FOO is defined in Kconfig.

Regards,

Hans

Quoted 25 lines

Michael

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 (4):
net: phy: Optionally force master mode for RTL PHY
net: phy: Force master mode for A20-Olimex-SOM-EVB
net: phy: Force master mode A20-OLinuXino-Lime2
net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig

  configs/A20-OLinuXino-Lime2_defconfig |  1 +
  configs/A20-Olimex-SOM-EVB_defconfig  |  1 +
  drivers/net/Kconfig                   | 17 +++++++++++++++++
  drivers/net/phy/realtek.c             | 13 ++++++++++++-
  4 files changed, 31 insertions(+), 1 deletion(-)
#10 lore raw

v3 cover net: phy: Force master mode for RTL8211C on some boards

In reply to Michael Haas

Hi,

Quoted 25 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_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 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 -> &

Quoted 6 lines

Michael Haas (4):
net: phy: Optionally force master mode for RTL PHY

net: phy: Force master mode for A20-Olimex-SOM-EVB
net: phy: Force master mode A20-OLinuXino-Lime2

These 2 should probably read:

sunxi: A20-Olxxxxxxxxx: Force master mode for RTL8211CL

ChenYu

Quoted 15 lines

net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig

 configs/A20-OLinuXino-Lime2_defconfig |  1 +
 configs/A20-Olimex-SOM-EVB_defconfig  |  1 +
 drivers/net/Kconfig                   | 17 +++++++++++++++++
 drivers/net/phy/realtek.c             | 13 ++++++++++++-
 4 files changed, 31 insertions(+), 1 deletion(-)

--
2.7.2

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot