Skip to contentSkip to conversation

r8169: check ALDPS bit and disable it if enabled for the 8168g

PATCH In review David Chang 4 participants 9 messages Nov 27, 2013 – Nov 29, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 r8169: check ALDPS bit and disable it if enabled for the 8168g

Windows driver will enable ALDPS function, but linux driver and firmware do not have any configuration related to ALDPS function for 8168g. So restart system to linux and remove the NIC cable, LAN enter ALDPS, then LAN RX will be disabled.

This issue can be easily reproduced on dual boot windows and linux system with RTL_GIGA_MAC_VER_40 chip.

Realtek said, ALDPS function can be disabled by configuring to PHY, switch to page 0x0A43, reg0x10 bit2=0.

---
 drivers/net/ethernet/realtek/r8169.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/realtek/r8169.c +5 -0
index 7993875..c737f0e 100644
@@ -3465,6 +3465,11 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp)
 	rtl_writephy(tp, 0x14, 0x9065);
 	rtl_writephy(tp, 0x14, 0x1065);
 
+	/* Check ALDPS bit, disable it if enabled */
+	rtl_writephy(tp, 0x1f, 0x0a43);
+	if (rtl_readphy(tp, 0x10) & 0x0004)
+		rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0004);
+
 	rtl_writephy(tp, 0x1f, 0x0000);
 }
 
Signature · 1 line
1.8.1.4
#1 lore raw

David Chang <[email protected]> :
[...]

Quoted 7 lines

Windows driver will enable ALDPS function, but linux driver and firmware do not have any configuration related to ALDPS function for 8168g. So restart system to linux and remove the NIC cable, LAN enter ALDPS, then LAN RX will be disabled.

This issue can be easily reproduced on dual boot windows and linux system with RTL_GIGA_MAC_VER_40 chip.

Hayes, could it be that a different chipset also needs the same kind of fix ?

Signature · 1 line
Ueimor
#2 lore raw

RE: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

Francois Romieu [mailto:[email protected]]

Quoted 6 lines

Sent: Thursday, November 28, 2013 8:02 AM
To: Hayeswang
Cc: [email protected]; David S. Miller; [email protected]; David Chang
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

[...]

Quoted 2 lines

Hayes, could it be that a different chipset also needs the same kind of fix ?

I have to check it with our hw engineers. However, I think the possible answer is yes.

Best Regards,
Hayes

#3 lore raw
In reply to David Chang

David Chang [mailto:[email protected]]

Quoted 6 lines

Sent: Wednesday, November 27, 2013 3:49 PM
To: [email protected]
Cc: David S. Miller; Francois Romieu; Hayeswang; [email protected]
Subject: [PATCH net] r8169: check ALDPS bit and disable it if enabled for the 8168g

[...]

drivers/net/ethernet/realtek/r8169.c static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp) · line 3472

Quoted 5 lines
drivers/net/ethernet/realtek/r8169.c +5 -0
+	/* Check ALDPS bit, disable it if enabled */
+	rtl_writephy(tp, 0x1f, 0x0a43);
+	if (rtl_readphy(tp, 0x10) & 0x0004)
+		rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0004);
+

You have to delay at least 10 ms after disable it. This makes sure the hw completes the action.

Best Regards,
Hayes

#4 lore raw
Quoted 8 lines · hayeswang

David Chang [mailto:[email protected]]

Quoted 6 lines

Sent: Wednesday, November 27, 2013 3:49 PM
To: [email protected]
Cc: David S. Miller; Francois Romieu; Hayeswang; [email protected]
Subject: [PATCH net] r8169: check ALDPS bit and disable it if enabled for the 8168g

[...]

Quoted 9 lines

drivers/net/ethernet/realtek/r8169.c static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp) · line 3472

Quoted 5 lines
drivers/net/ethernet/realtek/r8169.c +5 -0
+	/* Check ALDPS bit, disable it if enabled */
+	rtl_writephy(tp, 0x1f, 0x0a43);
+	if (rtl_readphy(tp, 0x10) & 0x0004)
+		rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0004);
+

You have to delay at least 10 ms after disable it. This makes sure the hw completes the action.

Thanks for your comment.
I'd add a delay time and send the v2 version.

Regards,
David

Quoted 4 lines

Best Regards,
Hayes

#5 lore raw

RE: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

David Chang [mailto:[email protected]]

Quoted 6 lines

Sent: Thursday, November 28, 2013 12:29 PM
To: Hayeswang
Cc: [email protected]; 'David S. Miller'; 'Francois Romieu'; [email protected]; nic_swsd
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

[...]

Quoted 6 lines
Quoted 3 lines

You have to delay at least 10 ms after disable it. This makes sure the hw completes the action.

Thanks for your comment.
I'd add a delay time and send the v2 version.

Excuse me. Our engineers have different opinions about the delay. I would comfirm it first.

Best Regards,
Hayes

#6 lore raw

Re: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

Quoted 12 lines · hayeswang

David Chang [mailto:[email protected]]

Quoted 6 lines

Sent: Thursday, November 28, 2013 12:29 PM
To: Hayeswang
Cc: [email protected]; 'David S. Miller'; 'Francois Romieu'; [email protected]; nic_swsd
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

[...]

Quoted 4 lines
Quoted 3 lines

You have to delay at least 10 ms after disable it. This makes sure the hw completes the action.

Quoted 6 lines
Quoted 2 lines

Thanks for your comment.
I'd add a delay time and send the v2 version.

Excuse me. Our engineers have different opinions about the delay. I would comfirm it first.

OK! I'd wait until the final result, thanks!

Regards,
David

Quoted 4 lines

Best Regards,
Hayes

Acked-by
#7 lore raw

RE: [PATCH net] r8169: check ALDPS bit and disable it if enabledforthe 8168g

David Chang [mailto:[email protected]]

Quoted 20 lines

Sent: Thursday, November 28, 2013 2:23 PM
To: Hayeswang
Cc: [email protected]; 'David S. Miller'; 'Francois Romieu'; [email protected]; nic_swsd
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabledforthe 8168g

Quoted 12 lines · hayeswang

David Chang [mailto:[email protected]]

Quoted 6 lines

Sent: Thursday, November 28, 2013 12:29 PM
To: Hayeswang
Cc: [email protected]; 'David S. Miller'; 'Francois Romieu'; [email protected]; nic_swsd
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

[...]

Quoted 4 lines
Quoted 3 lines

You have to delay at least 10 ms after disable it. This makes sure the hw completes the action.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Thanks for your comment.
I'd add a delay time and send the v2 version.

Excuse me. Our engineers have different opinions about the delay. I would comfirm it first.

OK! I'd wait until the final result, thanks!

The delay is unnecessary. Thanks.

maintainer
#8 lore raw

Re: [PATCH net] r8169: check ALDPS bit and disable it if enabledforthe 8168g

From: hayeswang <[email protected]>
Date: Thu, 28 Nov 2013 15:58:53 +0800

Quoted 24 lines

David Chang [mailto:[email protected]]

Quoted 23 lines

Sent: Thursday, November 28, 2013 2:23 PM
To: Hayeswang
Cc: [email protected]; 'David S. Miller'; 'Francois Romieu'; [email protected]; nic_swsd
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabledforthe 8168g

Quoted 15 lines · hayeswang

David Chang [mailto:[email protected]]

Quoted 6 lines

Sent: Thursday, November 28, 2013 12:29 PM
To: Hayeswang
Cc: [email protected]; 'David S. Miller'; 'Francois Romieu'; [email protected]; nic_swsd
Subject: Re: [PATCH net] r8169: check ALDPS bit and disable it if enabled forthe 8168g

[...]

Quoted 6 lines
Quoted 3 lines

You have to delay at least 10 ms after disable it. This makes sure the hw completes the action.

Thanks for your comment.
I'd add a delay time and send the v2 version.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Excuse me. Our engineers have different opinions about the delay. I would comfirm it first.

OK! I'd wait until the final result, thanks!

The delay is unnecessary. Thanks.

Applied and queued up for -stable, thanks everyone.