All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] r8169: fix RTL8111EVL EEE and green settings
@ 2017-11-19  0:33 Heiner Kallweit
  2017-11-19  0:36 ` [PATCH 2/2] r8169: use same RTL8111EVL green settings as in vendor driver Heiner Kallweit
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2017-11-19  0:33 UTC (permalink / raw)
  To: nic_swsd, Chun-Hao Lin, David Miller; +Cc: netdev

Name of functions rtl_w0w1_eri and rtl_w0w1_phy is somewhat misleading
regarding order of arguments. One could assume that w0w1 means
argument with bits to be reset comes before argument with bits to set.
However this is not the case.
So fix the order of arguments in several statements.

In addition fix EEE advertisement. The current code resets the bits
for 100BaseT and 1000BaseT EEE advertisement what is not what we want.

I have a little of a hard time to find a proper "Fixes" line as the
issue seems to have been there forever (at least it existed already
when the driver was moved to the current place in 2011).

The patch was tested on a Zotac Mini-PC with a RTL8111E-VL chip.
Before the patch EEE was disabled, now it's properly advertised and
works fine.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index dcb8c3938..19f3074a0 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3789,26 +3789,26 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
 	rtl_writephy(tp, 0x1f, 0x0000);
 
 	/* EEE setting */
-	rtl_w0w1_eri(tp, 0x1b0, ERIAR_MASK_1111, 0x0000, 0x0003, ERIAR_EXGMAC);
+	rtl_w0w1_eri(tp, 0x1b0, ERIAR_MASK_1111, 0x0003, 0x0000, ERIAR_EXGMAC);
 	rtl_writephy(tp, 0x1f, 0x0005);
 	rtl_writephy(tp, 0x05, 0x8b85);
-	rtl_w0w1_phy(tp, 0x06, 0x0000, 0x2000);
+	rtl_w0w1_phy(tp, 0x06, 0x2000, 0x0000);
 	rtl_writephy(tp, 0x1f, 0x0004);
 	rtl_writephy(tp, 0x1f, 0x0007);
 	rtl_writephy(tp, 0x1e, 0x0020);
-	rtl_w0w1_phy(tp, 0x15, 0x0000, 0x0100);
+	rtl_w0w1_phy(tp, 0x15, 0x0100, 0x0000);
 	rtl_writephy(tp, 0x1f, 0x0002);
 	rtl_writephy(tp, 0x1f, 0x0000);
 	rtl_writephy(tp, 0x0d, 0x0007);
 	rtl_writephy(tp, 0x0e, 0x003c);
 	rtl_writephy(tp, 0x0d, 0x4007);
-	rtl_writephy(tp, 0x0e, 0x0000);
+	rtl_writephy(tp, 0x0e, 0x0006);
 	rtl_writephy(tp, 0x0d, 0x0000);
 
 	/* Green feature */
 	rtl_writephy(tp, 0x1f, 0x0003);
-	rtl_w0w1_phy(tp, 0x19, 0x0000, 0x0001);
-	rtl_w0w1_phy(tp, 0x10, 0x0000, 0x0400);
+	rtl_w0w1_phy(tp, 0x19, 0x0001, 0x0000);
+	rtl_w0w1_phy(tp, 0x10, 0x0400, 0x0000);
 	rtl_writephy(tp, 0x1f, 0x0000);
 
 	/* Broken BIOS workaround: feed GigaMAC registers with MAC address. */
-- 
2.15.0

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

* [PATCH 2/2] r8169: use same RTL8111EVL green settings as in vendor driver
  2017-11-19  0:33 [PATCH 1/2] r8169: fix RTL8111EVL EEE and green settings Heiner Kallweit
@ 2017-11-19  0:36 ` Heiner Kallweit
  2017-11-19  6:44   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2017-11-19  0:36 UTC (permalink / raw)
  To: nic_swsd, Chun-Hao Lin, David Miller; +Cc: netdev

Adjust the code to use the same green settings as in the latest
vendor driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 19f3074a0..912549c88 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3810,6 +3810,11 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
 	rtl_w0w1_phy(tp, 0x19, 0x0001, 0x0000);
 	rtl_w0w1_phy(tp, 0x10, 0x0400, 0x0000);
 	rtl_writephy(tp, 0x1f, 0x0000);
+	rtl_writephy(tp, 0x1f, 0x0005);
+	rtl_w0w1_phy(tp, 0x01, 0x0100, 0x0000);
+	rtl_writephy(tp, 0x1f, 0x0000);
+	/* soft-reset phy */
+	rtl_writephy(tp, 0x00, 0x9200);
 
 	/* Broken BIOS workaround: feed GigaMAC registers with MAC address. */
 	rtl_rar_exgmac_set(tp, tp->dev->dev_addr);
-- 
2.15.0

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

* Re: [PATCH 2/2] r8169: use same RTL8111EVL green settings as in vendor driver
  2017-11-19  0:36 ` [PATCH 2/2] r8169: use same RTL8111EVL green settings as in vendor driver Heiner Kallweit
@ 2017-11-19  6:44   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-11-19  6:44 UTC (permalink / raw)
  To: hkallweit1; +Cc: nic_swsd, hau, netdev

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 19 Nov 2017 01:36:02 +0100

> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 19f3074a0..912549c88 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -3810,6 +3810,11 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
>  	rtl_w0w1_phy(tp, 0x19, 0x0001, 0x0000);
>  	rtl_w0w1_phy(tp, 0x10, 0x0400, 0x0000);
>  	rtl_writephy(tp, 0x1f, 0x0000);
> +	rtl_writephy(tp, 0x1f, 0x0005);
> +	rtl_w0w1_phy(tp, 0x01, 0x0100, 0x0000);
> +	rtl_writephy(tp, 0x1f, 0x0000);
> +	/* soft-reset phy */
> +	rtl_writephy(tp, 0x00, 0x9200);

Please do not use magic constants when writing to the MII_BMCR in page
zero of the PHY.  These register offsets and register bit fields have
defines in <linux/mii.h", so please use them.

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

end of thread, other threads:[~2017-11-19  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-19  0:33 [PATCH 1/2] r8169: fix RTL8111EVL EEE and green settings Heiner Kallweit
2017-11-19  0:36 ` [PATCH 2/2] r8169: use same RTL8111EVL green settings as in vendor driver Heiner Kallweit
2017-11-19  6:44   ` David Miller

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.