diff mbox

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

Message ID 1385538516-32104-1-git-send-email-dchang@suse.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David Chang Nov. 27, 2013, 7:48 a.m. UTC
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.

Signed-off-by: David Chang <dchang@suse.com>
---
 drivers/net/ethernet/realtek/r8169.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Francois Romieu Nov. 28, 2013, 12:02 a.m. UTC | #1
David Chang <dchang@suse.com> :
[...]
> 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 ?
Hayes Wang Nov. 28, 2013, 3:37 a.m. UTC | #2
Francois Romieu [mailto:romieu@fr.zoreil.com] 
> Sent: Thursday, November 28, 2013 8:02 AM
> To: Hayeswang
> Cc: netdev@vger.kernel.org; David S. Miller; jlee@suse.com; 
> David Chang
> Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
> it if enabled forthe 8168g
[...]
> 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hayes Wang Nov. 28, 2013, 3:37 a.m. UTC | #3
David Chang [mailto:dchang@suse.com] 
> Sent: Wednesday, November 27, 2013 3:49 PM
> To: netdev@vger.kernel.org
> Cc: David S. Miller; Francois Romieu; Hayeswang; jlee@suse.com
> Subject: [PATCH net] r8169: check ALDPS bit and disable it if 
> enabled for the 8168g
> 
[...]
> +	/* 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Chang Nov. 28, 2013, 4:29 a.m. UTC | #4
On Thu, Nov 28, 2013 at 11:37:18AM +0800, hayeswang wrote:
>  David Chang [mailto:dchang@suse.com] 
> > Sent: Wednesday, November 27, 2013 3:49 PM
> > To: netdev@vger.kernel.org
> > Cc: David S. Miller; Francois Romieu; Hayeswang; jlee@suse.com
> > Subject: [PATCH net] r8169: check ALDPS bit and disable it if 
> > enabled for the 8168g
> > 
> [...]
> > +	/* 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

> Best Regards,
> Hayes
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hayes Wang Nov. 28, 2013, 5:28 a.m. UTC | #5
David Chang [mailto:dchang@suse.com] 
> Sent: Thursday, November 28, 2013 12:29 PM
> To: Hayeswang
> Cc: netdev@vger.kernel.org; 'David S. Miller'; 'Francois 
> Romieu'; jlee@suse.com; nic_swsd
> Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
> it if enabled forthe 8168g
[...]
> > 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Chang Nov. 28, 2013, 6:22 a.m. UTC | #6
On Thu, Nov 28, 2013 at 01:28:08PM +0800, hayeswang wrote:
>  David Chang [mailto:dchang@suse.com] 
> > Sent: Thursday, November 28, 2013 12:29 PM
> > To: Hayeswang
> > Cc: netdev@vger.kernel.org; 'David S. Miller'; 'Francois 
> > Romieu'; jlee@suse.com; nic_swsd
> > Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
> > it if enabled forthe 8168g
> [...]
> > > 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.
>  
OK! I'd wait until the final result, thanks!

Regards,
David
> Best Regards,
> Hayes
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hayes Wang Nov. 28, 2013, 7:58 a.m. UTC | #7
David Chang [mailto:dchang@suse.com] 
> Sent: Thursday, November 28, 2013 2:23 PM
> To: Hayeswang
> Cc: netdev@vger.kernel.org; 'David S. Miller'; 'Francois 
> Romieu'; jlee@suse.com; nic_swsd
> Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
> it if enabledforthe 8168g
> 
> On Thu, Nov 28, 2013 at 01:28:08PM +0800, hayeswang wrote:
> >  David Chang [mailto:dchang@suse.com] 
> > > Sent: Thursday, November 28, 2013 12:29 PM
> > > To: Hayeswang
> > > Cc: netdev@vger.kernel.org; 'David S. Miller'; 'Francois 
> > > Romieu'; jlee@suse.com; nic_swsd
> > > Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
> > > it if enabled forthe 8168g
> > [...]
> > > > 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.
> >  
> OK! I'd wait until the final result, thanks!

The delay is unnecessary. Thanks.

Acked-by: Hayes Wang <hayeswang@realtek.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Nov. 29, 2013, 9:17 p.m. UTC | #8
From: hayeswang <hayeswang@realtek.com>
Date: Thu, 28 Nov 2013 15:58:53 +0800

>  David Chang [mailto:dchang@suse.com] 
>> Sent: Thursday, November 28, 2013 2:23 PM
>> To: Hayeswang
>> Cc: netdev@vger.kernel.org; 'David S. Miller'; 'Francois 
>> Romieu'; jlee@suse.com; nic_swsd
>> Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
>> it if enabledforthe 8168g
>> 
>> On Thu, Nov 28, 2013 at 01:28:08PM +0800, hayeswang wrote:
>> >  David Chang [mailto:dchang@suse.com] 
>> > > Sent: Thursday, November 28, 2013 12:29 PM
>> > > To: Hayeswang
>> > > Cc: netdev@vger.kernel.org; 'David S. Miller'; 'Francois 
>> > > Romieu'; jlee@suse.com; nic_swsd
>> > > Subject: Re: [PATCH net] r8169: check ALDPS bit and disable 
>> > > it if enabled forthe 8168g
>> > [...]
>> > > > 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.
>> >  
>> OK! I'd wait until the final result, thanks!
> 
> The delay is unnecessary. Thanks.
> 
> Acked-by: Hayes Wang <hayeswang@realtek.com>

Applied and queued up for -stable, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 7993875..c737f0e 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -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);
 }