All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards
@ 2016-03-24  6:46 Michael Haas
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 1/4] net: phy: Optionally force master mode for RTL PHY Michael Haas
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Michael Haas @ 2016-03-24  6:46 UTC (permalink / raw)
  To: u-boot


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(-)

-- 
2.7.2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 1/4] net: phy: Optionally force master mode for RTL PHY
  2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
@ 2016-03-24  6:46 ` Michael Haas
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 2/4] net: phy: Force master mode for A20-Olimex-SOM-EVB Michael Haas
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Michael Haas @ 2016-03-24  6:46 UTC (permalink / raw)
  To: u-boot

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
Signed-off-by: Michael Haas <haas@computerlinguist.org>
---

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(-)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 259a87f..359ec50 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -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);
 
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 2/4] net: phy: Force master mode for A20-Olimex-SOM-EVB
  2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 1/4] net: phy: Optionally force master mode for RTL PHY Michael Haas
@ 2016-03-24  6:46 ` Michael Haas
  2016-03-25 21:11   ` Joe Hershberger
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2 Michael Haas
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Michael Haas @ 2016-03-24  6:46 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Michael Haas <haas@computerlinguist.org>
---

Changes in v3: None
Changes in v2: None

 configs/A20-Olimex-SOM-EVB_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/A20-Olimex-SOM-EVB_defconfig b/configs/A20-Olimex-SOM-EVB_defconfig
index 66d8f98..68de5f2 100644
--- a/configs/A20-Olimex-SOM-EVB_defconfig
+++ b/configs/A20-Olimex-SOM-EVB_defconfig
@@ -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
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2
  2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 1/4] net: phy: Optionally force master mode for RTL PHY Michael Haas
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 2/4] net: phy: Force master mode for A20-Olimex-SOM-EVB Michael Haas
@ 2016-03-24  6:46 ` Michael Haas
  2016-03-25 21:12   ` Joe Hershberger
  2016-03-25 23:46   ` Iain Paton
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 4/4] net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig Michael Haas
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 11+ messages in thread
From: Michael Haas @ 2016-03-24  6:46 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Michael Haas <haas@computerlinguist.org>
---

Changes in v3: None
Changes in v2: None

 configs/A20-OLinuXino-Lime2_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/A20-OLinuXino-Lime2_defconfig b/configs/A20-OLinuXino-Lime2_defconfig
index 95c67d6..3bd4fa7 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -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
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 4/4] net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig
  2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
                   ` (2 preceding siblings ...)
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2 Michael Haas
@ 2016-03-24  6:46 ` Michael Haas
  2016-03-24 10:58 ` [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Hans de Goede
  2016-03-24 12:44 ` Chen-Yu Tsai
  5 siblings, 0 replies; 11+ messages in thread
From: Michael Haas @ 2016-03-24  6:46 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Michael Haas <haas@computerlinguist.org>
---

Changes in v3: None
Changes in v2: None

 drivers/net/Kconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 2a229b8..b102bc6 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -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
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards
  2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
                   ` (3 preceding siblings ...)
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 4/4] net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig Michael Haas
@ 2016-03-24 10:58 ` Hans de Goede
  2016-03-24 12:44 ` Chen-Yu Tsai
  5 siblings, 0 replies; 11+ messages in thread
From: Hans de Goede @ 2016-03-24 10:58 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On 24-03-16 07:46, Michael Haas wrote:
>
> 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.

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



>
> 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(-)
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards
  2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
                   ` (4 preceding siblings ...)
  2016-03-24 10:58 ` [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Hans de Goede
@ 2016-03-24 12:44 ` Chen-Yu Tsai
  5 siblings, 0 replies; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-03-24 12:44 UTC (permalink / raw)
  To: u-boot

Hi,

On Thu, Mar 24, 2016 at 2:46 PM, Michael Haas <haas@computerlinguist.org> wrote:
>
> 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

These 2 should probably read:

    sunxi: A20-Olxxxxxxxxx: Force master mode for RTL8211CL

ChenYu

>   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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 2/4] net: phy: Force master mode for A20-Olimex-SOM-EVB
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 2/4] net: phy: Force master mode for A20-Olimex-SOM-EVB Michael Haas
@ 2016-03-25 21:11   ` Joe Hershberger
  0 siblings, 0 replies; 11+ messages in thread
From: Joe Hershberger @ 2016-03-25 21:11 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 24, 2016 at 1:46 AM, Michael Haas <haas@computerlinguist.org> wrote:
> 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.
>
> Signed-off-by: Michael Haas <haas@computerlinguist.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2 Michael Haas
@ 2016-03-25 21:12   ` Joe Hershberger
  2016-03-25 23:46   ` Iain Paton
  1 sibling, 0 replies; 11+ messages in thread
From: Joe Hershberger @ 2016-03-25 21:12 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 24, 2016 at 1:46 AM, Michael Haas <haas@computerlinguist.org> wrote:
> Force master mode on the A20-OLinuXino-Lime2. This change is required
> to get a reliable link at gigabit speeds.
>
> Signed-off-by: Michael Haas <haas@computerlinguist.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2
  2016-03-24  6:46 ` [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2 Michael Haas
  2016-03-25 21:12   ` Joe Hershberger
@ 2016-03-25 23:46   ` Iain Paton
  2016-03-26  5:38     ` Michael Haas
  1 sibling, 1 reply; 11+ messages in thread
From: Iain Paton @ 2016-03-25 23:46 UTC (permalink / raw)
  To: u-boot

On 24/03/16 06:46, Michael Haas wrote:
> Force master mode on the A20-OLinuXino-Lime2. This change is required
> to get a reliable link at gigabit speeds.
> 
> Signed-off-by: Michael Haas <haas@computerlinguist.org>

Acked-by: Iain Paton <ipaton0@gmail.com>

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2
  2016-03-25 23:46   ` Iain Paton
@ 2016-03-26  5:38     ` Michael Haas
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Haas @ 2016-03-26  5:38 UTC (permalink / raw)
  To: u-boot

On 03/26/2016 12:46 AM, Iain Paton wrote:
> On 24/03/16 06:46, Michael Haas wrote:
>> Force master mode on the A20-OLinuXino-Lime2. This change is required
>> to get a reliable link at gigabit speeds.
>>
>> Signed-off-by: Michael Haas <haas@computerlinguist.org>
> Acked-by: Iain Paton <ipaton0@gmail.com>
>
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-03-26  5:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-24  6:46 [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Michael Haas
2016-03-24  6:46 ` [U-Boot] [PATCH v3 1/4] net: phy: Optionally force master mode for RTL PHY Michael Haas
2016-03-24  6:46 ` [U-Boot] [PATCH v3 2/4] net: phy: Force master mode for A20-Olimex-SOM-EVB Michael Haas
2016-03-25 21:11   ` Joe Hershberger
2016-03-24  6:46 ` [U-Boot] [PATCH v3 3/4] net: phy: Force master mode A20-OLinuXino-Lime2 Michael Haas
2016-03-25 21:12   ` Joe Hershberger
2016-03-25 23:46   ` Iain Paton
2016-03-26  5:38     ` Michael Haas
2016-03-24  6:46 ` [U-Boot] [PATCH v3 4/4] net: phy: Add RTL8211X_PHY_FORCE_MASTER to Kconfig Michael Haas
2016-03-24 10:58 ` [U-Boot] [PATCH v3 0/4] net: phy: Force master mode for RTL8211C on some boards Hans de Goede
2016-03-24 12:44 ` Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.