netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Dawe <rich@phekda.gotadsl.co.uk>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Richard Dawe <rich@phekda.gotadsl.co.uk>, netdev@oss.sgi.com
Subject: Re: Acer Aspire 1524WLMi and RealTek 8169 - very slow
Date: Sat, 22 Jan 2005 15:22:57 +0000	[thread overview]
Message-ID: <41F26FD1.2060407@phekda.gotadsl.co.uk> (raw)
In-Reply-To: <41F250D1.8000207@phekda.gotadsl.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

Hello.

I've done some more investigation and I'm happy to report that I managed 
to get some decent network performance out of my laptop - 7.1Mbps.

My laptop seems to have an embedded PHY rather than the separate PHY 
that they normally come with.

The MAC config data is 0x13000000, which masked off with 0x7c800000 
gives 0x10000000, which is RTL_GIGA_MAC_VER_X. The PHY data is 0xc912, 
which masked off with 0x000f gives 0x0002, which is RTL_GIGA_PHY_VER_G.

So I looked at the latest RealTek driver for Linux (version 220) and 
that has some separate initialisation code for RTL_GIGA_MAC_VER_X 
(MCFG_METHOD_4, they call it). I ported that over to r8169.c in 
2.6.11-rc1 and it appears to work.

Attached is the patch against 2.6.11-rc1. I'm not sure if it caters to 
your tastes. Maybe you'll want to rename RTL_GIGA_MAC_VER_X. 
RTL_GIGA_PHY_VER_H is an invented version, to indicate end-of-list, like 
RTL_GIGA_PHY_VER_G was before.

I'm going to give this a good hammering now by rsync'ing about 20GB of 
data. Hopefully it'll hold up.

Bye, Rich =]

-- 
Richard Dawe [ http://homepages.nildram.co.uk/~phekda/richdawe/ ]

"You can't evaluate a man by logic alone."
   -- McCoy, "I, Mudd", Star Trek

[-- Attachment #2: r8169-embedded-phy-20050122.diff --]
[-- Type: text/plain, Size: 2971 bytes --]

--- r8169.c	2005-01-12 04:00:58.000000000 +0000
+++ r8169new.c	2005-01-22 15:01:05.000000000 +0000
@@ -148,6 +148,7 @@ enum phy_version {
 	RTL_GIGA_PHY_VER_E = 0x05, /* PHY Reg 0x03 bit0-3 == 0x0000 */
 	RTL_GIGA_PHY_VER_F = 0x06, /* PHY Reg 0x03 bit0-3 == 0x0001 */
 	RTL_GIGA_PHY_VER_G = 0x07, /* PHY Reg 0x03 bit0-3 == 0x0002 */
+	RTL_GIGA_PHY_VER_H = 0x08, /* PHY Reg 0x03 bit0-3 == 0x0003 */
 };
 
 
@@ -161,7 +162,8 @@ const static struct {
 } rtl_chip_info[] = {
 	_R("RTL8169",		RTL_GIGA_MAC_VER_B, 0xff7e1880),
 	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_D, 0xff7e1880),
-	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_E, 0xff7e1880)
+	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_E, 0xff7e1880),
+	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_X, 0xff7e1880),
 };
 #undef _R
 
@@ -1001,7 +1003,7 @@ static void rtl8169_hw_phy_config(struct
 
 	if (tp->mac_version <= RTL_GIGA_MAC_VER_B)
 		return;
-	if (tp->phy_version >= RTL_GIGA_PHY_VER_F) 
+	if (tp->phy_version >= RTL_GIGA_PHY_VER_H) 
 		return;
 
 	dprintk("MAC version != 0 && PHY version == 0 or 1\n");
@@ -1009,11 +1011,25 @@ static void rtl8169_hw_phy_config(struct
 
 	/* Shazam ! */
 
-	// phy config for RTL8169s mac_version C chip
-	mdio_write(ioaddr, 31, 0x0001);			//w 31 2 0 1
-	mdio_write(ioaddr, 21, 0x1000);			//w 21 15 0 1000
-	mdio_write(ioaddr, 24, 0x65c7);			//w 24 15 0 65c7
-	rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 0);	//w 4 11 11 0
+	if (tp->mac_version == RTL_GIGA_MAC_VER_X)
+	{
+	  mdio_write(ioaddr, 0x1f, 0x0001);
+	  mdio_write(ioaddr, 0x09, 0x273a);
+	  mdio_write(ioaddr, 0x0e, 0x7bfb);
+	  mdio_write(ioaddr, 0x1b, 0x841e);
+
+	  mdio_write(ioaddr, 0x1f, 0x0002);
+	  mdio_write(ioaddr, 0x01, 0x90d0);
+	  mdio_write(ioaddr, 0x1f, 0x0000);
+	}
+	else
+	{
+	  // phy config for RTL8169s mac_version C chip
+	  mdio_write(ioaddr, 31, 0x0001);		//w 31 2 0 1
+	  mdio_write(ioaddr, 21, 0x1000);		//w 21 15 0 1000
+	  mdio_write(ioaddr, 24, 0x65c7);		//w 24 15 0 65c7
+	  rtl8169_write_gmii_reg_bit(ioaddr, 4, 11, 0);	//w 4 11 11 0
+	}
 
 	for (i = 0; i < ARRAY_SIZE(phy_magic); i++, p++) {
 		int val, pos = 4;
@@ -1037,7 +1053,7 @@ static void rtl8169_phy_timer(unsigned l
 	unsigned long timeout = RTL8169_PHY_TIMEOUT;
 
 	assert(tp->mac_version > RTL_GIGA_MAC_VER_B);
-	assert(tp->phy_version < RTL_GIGA_PHY_VER_G);
+	assert(tp->phy_version < RTL_GIGA_PHY_VER_H);
 
 	if (!(tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full))
 		return;
@@ -1072,7 +1088,7 @@ static inline void rtl8169_delete_timer(
 	struct timer_list *timer = &tp->timer;
 
 	if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) ||
-	    (tp->phy_version >= RTL_GIGA_PHY_VER_G))
+	    (tp->phy_version >= RTL_GIGA_PHY_VER_H))
 		return;
 
 	del_timer_sync(timer);
@@ -1084,7 +1100,7 @@ static inline void rtl8169_request_timer
 	struct timer_list *timer = &tp->timer;
 
 	if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) ||
-	    (tp->phy_version >= RTL_GIGA_PHY_VER_G))
+	    (tp->phy_version >= RTL_GIGA_PHY_VER_H))
 		return;
 
 	init_timer(timer);

  reply	other threads:[~2005-01-22 15:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-21 13:16 Acer Aspire 1524WLMi and RealTek 8169 - very slow Richard Dawe
2004-11-21 13:24 ` Richard Dawe
2004-11-21 19:47 ` Richard Dawe
2004-11-21 20:58   ` Francois Romieu
2004-11-22 20:42     ` Richard Dawe
2004-11-22 21:30       ` Francois Romieu
2004-11-22 22:07         ` Richard Dawe
2004-11-24 19:36         ` Richard Dawe
2004-11-30 19:52           ` Jon Mason
2004-12-29 10:17         ` Richard Dawe
2004-12-29 23:52           ` Francois Romieu
2005-01-02 13:51             ` Richard Dawe
2005-01-02 15:23               ` Richard Dawe
2005-01-22 13:10             ` Richard Dawe
2005-01-22 15:22               ` Richard Dawe [this message]
2005-01-22 23:01                 ` Francois Romieu
2005-01-23 19:08                   ` Richard Dawe
2005-01-25 21:47                     ` Francois Romieu
2005-02-05 13:26                       ` Richard Dawe
2005-02-05 20:41                         ` Francois Romieu
2005-02-06 10:54                           ` Richard Dawe
2005-02-08 23:00                           ` Richard Dawe
2005-02-12  0:07                             ` Francois Romieu
2004-11-21 23:28 ` [patch] ethtool (was Re: Acer Aspire 1524WLMi and RealTek 8169 - very slow) Francois Romieu
2005-01-27 20:27   ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2005-01-26 22:00 Acer Aspire 1524WLMi and RealTek 8169 - very slow Brandeburg, Jesse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41F26FD1.2060407@phekda.gotadsl.co.uk \
    --to=rich@phekda.gotadsl.co.uk \
    --cc=netdev@oss.sgi.com \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).