Skip to contentSkip to conversation

sis190 gigabit fixes(bug 9735,11149) and new phy

PATCH In review Riccardo Ghetta 3 participants 10 messages Jun 2, 2009 – Jun 4, 2009

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

cover sis190 gigabit fixes(bug 9735,11149) and new phy

The first patch add a new phy found on my Asus F5Sr laptop. I suppose it's an Atheros chip, but really don't know.
The second patch should enable sis191 adapters to connect at Gb speeds (at least, it does on my laptop). Also bumps the version number. The third is just cosmetic, to make easier to identify newer phys.

Riccardo Ghetta (3):
sis190: add new phy found on asus F5 series laptops
sis190: fix gigabit negotiation
sis190: better message on unknown PHY

 drivers/net/sis190.c |   53 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 18 deletions(-)
#1 lore raw

PATCH 1/3 sis190: add new phy found on asus F5 series laptops

---
 drivers/net/sis190.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/sis190.c +1 -0
index 55ccd51..3d4542e 100644
@@ -317,6 +317,7 @@ static struct mii_chip_info {
         unsigned int type;
 	u32 feature;
 } mii_chip_table[] = {
+	{ "Atheros PHY ?",        { 0x004d, 0xd010 }, LAN, 0 },
 	{ "Atheros PHY AR8012",   { 0x004d, 0xd020 }, LAN, 0 },
 	{ "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 },
 	{ "Broadcom PHY AC131",   { 0x0143, 0xbc70 }, LAN, 0 },
Signature · 1 line
1.6.2.4
#2 lore raw

Re: [PATCH 1/3] sis190: add new phy found on asus F5 series laptops

Riccardo Ghetta <[email protected]> :

Quoted 10 lines
---
 drivers/net/sis190.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/sis190.c +0 -0
index 55ccd51..3d4542e 100644

drivers/net/sis190.c static struct mii_chip_info { · line 323

Quoted 7 lines
drivers/net/sis190.c +1 -0
@@ -317,6 +317,7 @@ static struct mii_chip_info {
         unsigned int type;
 	u32 feature;
 } mii_chip_table[] = {
+	{ "Atheros PHY ?",        { 0x004d, 0xd010 }, LAN, 0 },
 	{ "Atheros PHY AR8012",   { 0x004d, 0xd020 }, LAN, 0 },
 	{ "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 },
 	{ "Broadcom PHY AC131",   { 0x0143, 0xbc70 }, LAN, 0 },

Please be more specific with the identifier of your laptop. Afaiu some laptops in the F5 series include network components from Realtek. It could be confusing.

You can remove the question mark. If we can only tell that the phy comes from Atheros, so be it.

Signature · 1 line
Ueimor
author
#3 lore raw

Re: [PATCH 1/3] sis190: add new phy found on asus F5 series laptops

Quoted 6 lines · Francois Romieu

Please be more specific with the identifier of your laptop. Afaiu some laptops in the F5 series include network components from Realtek. It could be confusing.

You can remove the question mark. If we can only tell that the phy comes from Atheros, so be it.

Ok, I'll try to have a better description.
Thanks,
R

#5 lore raw

PATCH 2/3 sis190: fix gigabit negotiation

In reply to Riccardo Ghetta

Fixes an initialization error; the chip negotiates gigabit, but the driver mistakenly handled it as 100Mb.
Hopefully should fix bugs 9735 and 11149

---
 drivers/net/sis190.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)
drivers/net/sis190.c +25 -12
index 3d4542e..8322e28 100644
@@ -47,7 +47,7 @@
 #define PHY_ID_ANY		0x1f
 #define MII_REG_ANY		0x1f
 
-#define DRV_VERSION		"1.2"
+#define DRV_VERSION		"1.3"
 #define DRV_NAME		"sis190"
 #define SIS190_DRIVER_NAME	DRV_NAME " Gigabit Ethernet driver " DRV_VERSION
 #define PFX DRV_NAME ": "
@@ -943,9 +943,9 @@ static void sis190_phy_task(struct work_struct *work)
 			u32 ctl;
 			const char *msg;
 		} reg31[] = {
-			{ LPA_1000XFULL | LPA_SLCT, 0x07000c00 | 0x00001000,
+			{ LPA_1000FULL, 0x07000c00 | 0x00001000,
 				"1000 Mbps Full Duplex" },
-			{ LPA_1000XHALF | LPA_SLCT, 0x07000c00,
+			{ LPA_1000HALF, 0x07000c00,
 				"1000 Mbps Half Duplex" },
 			{ LPA_100FULL, 0x04000800 | 0x00001000,
 				"100 Mbps Full Duplex" },
@@ -956,22 +956,35 @@ static void sis190_phy_task(struct work_struct *work)
 			{ LPA_10HALF, 0x04000400,
 				"10 Mbps Half Duplex" },
 			{ 0, 0x04000400, "unknown" }
- 		}, *p;
-		u16 adv;
+		}, *p = NULL;
+		u16 adv, autoexp, gigadv, gigrec;
 
 		val = mdio_read(ioaddr, phy_id, 0x1f);
 		net_link(tp, KERN_INFO "%s: mii ext = %04x.\n", dev->name, val);
 
 		val = mdio_read(ioaddr, phy_id, MII_LPA);
 		adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE);
-		net_link(tp, KERN_INFO "%s: mii lpa = %04x adv = %04x.\n",
-			 dev->name, val, adv);
-
-		val &= adv;
+		autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION);
+		net_link(tp, KERN_INFO "%s: mii lpa=%04x adv=%04x exp=%04x.\n",
+			 dev->name, val, adv, autoexp);
+
+		if (val & ADVERTISE_NPAGE && autoexp & EXPANSION_NWAY) {
+			/* check for gigabit speed */
+			gigadv = mdio_read(ioaddr, phy_id, MII_CTRL1000);
+			gigrec = mdio_read(ioaddr, phy_id, MII_STAT1000);
+			val = (gigadv & (gigrec >> 2));
+			if (val & ADVERTISE_1000FULL)
+				p = reg31;
+			else if (val & ADVERTISE_1000HALF)
+				p = reg31+1;
+		}
+		if (!p) {
+			val &= adv;
 
-		for (p = reg31; p->val; p++) {
-			if ((val & p->val) == p->val)
-				break;
+			for (p = reg31; p->val; p++) {
+				if ((val & p->val) == p->val)
+					break;
+			}
 		}
 
 		p->ctl |= SIS_R32(StationControl) & ~0x0f001c00;
Signature · 1 line
1.6.2.4
#6 lore raw

Re: [PATCH 2/3] sis190: fix gigabit negotiation

Riccardo Ghetta <[email protected]> :

Quoted 2 lines

Fixes an initialization error; the chip negotiates gigabit, but the driver mistakenly handled it as 100Mb.

Did you draw some inspiration from SiS own driver ? If so it would deserve to be quoted.

Quoted 1 line

Hopefully should fix bugs 9735 and 11149

http://bugzilla.kernel.org/show_bug.cgi?id=9735
http://bugzilla.kernel.org/show_bug.cgi?id=11149

Quoted 10 lines
---
 drivers/net/sis190.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)
drivers/net/sis190.c +0 -0
index 3d4542e..8322e28 100644

[...]

Quoted 13 lines
drivers/net/sis190.c +2 -2
@@ -956,22 +956,35 @@ static void sis190_phy_task(struct work_struct *work)
 			{ LPA_10HALF, 0x04000400,
 				"10 Mbps Half Duplex" },
 			{ 0, 0x04000400, "unknown" }
- 		}, *p;
-		u16 adv;
+		}, *p = NULL;
+		u16 adv, autoexp, gigadv, gigrec;
 
 		val = mdio_read(ioaddr, phy_id, 0x1f);
 		net_link(tp, KERN_INFO "%s: mii ext = %04x.\n", dev->name, val);
 
 		val = mdio_read(ioaddr, phy_id, MII_LPA);

drivers/net/sis190.c static void sis190_phy_task(struct work_struct *work) · line 971

Quoted 10 lines
drivers/net/sis190.c +5 -4
 		adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE);
-		net_link(tp, KERN_INFO "%s: mii lpa = %04x adv = %04x.\n",
-			 dev->name, val, adv);
-
-		val &= adv;
+		autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION);
+		net_link(tp, KERN_INFO "%s: mii lpa=%04x adv=%04x exp=%04x.\n",
+			 dev->name, val, adv, autoexp);
+
+		if (val & ADVERTISE_NPAGE && autoexp & EXPANSION_NWAY) {

val has been read from the LPA register.

s/ADVERTISE_NPAGE/LPA_NPAGE/ ?

drivers/net/sis190.c static void sis190_phy_task(struct work_struct *work) · line 979

Quoted 8 lines
drivers/net/sis190.c +8 -0
+			/* check for gigabit speed */
+			gigadv = mdio_read(ioaddr, phy_id, MII_CTRL1000);
+			gigrec = mdio_read(ioaddr, phy_id, MII_STAT1000);
+			val = (gigadv & (gigrec >> 2));
+			if (val & ADVERTISE_1000FULL)
+				p = reg31;
+			else if (val & ADVERTISE_1000HALF)
+				p = reg31+1;
                                    ^^^^^^^ reg31 + 1

Otherwise ok.

Signature · 1 line
Ueimor
author
#7 lore raw

Re: [PATCH 2/3] sis190: fix gigabit negotiation

Quoted 7 lines · Francois Romieu

Riccardo Ghetta <[email protected]> :

Quoted 2 lines

Fixes an initialization error; the chip negotiates gigabit, but the driver mistakenly handled it as 100Mb.

Did you draw some inspiration from SiS own driver ? If so it would deserve to be quoted.

Yes, I looked at both sis and forcedeth drivers. I'll quote both.

Quoted 3 lines

val has been read from the LPA register.

s/ADVERTISE_NPAGE/LPA_NPAGE/ ?

Uhu, yes, sorry.

#8 lore raw

PATCH 3/3 sis190: better message on unknown PHY

In reply to Riccardo Ghetta
---
 drivers/net/sis190.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/net/sis190.c +9 -6
index 8322e28..a69f3d2 100644
@@ -348,7 +348,7 @@ static struct {
 	u32 msg_enable;
 } debug = { -1 };
 
-MODULE_DESCRIPTION("SiS sis190 Gigabit Ethernet driver");
+MODULE_DESCRIPTION("SiS sis190/191 Gigabit Ethernet driver");
 module_param(rx_copybreak, int, 0);
 MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
 module_param_named(debug, debug.msg_enable, int, 0);
@@ -1329,12 +1329,15 @@ static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp,
 			((mii_status & (BMSR_100FULL | BMSR_100HALF)) ?
 				LAN : HOME) : p->type;
 		tp->features |= p->feature;
-	} else
+		net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n",
+			pci_name(tp->pci_dev), p->name, phy_id);
+	} else {
 		phy->type = UNKNOWN;
-
-	net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n",
-		  pci_name(tp->pci_dev),
-		  (phy->type == UNKNOWN) ? "Unknown PHY" : p->name, phy_id);
+		net_probe(tp, KERN_INFO
+			"%s: unknown PHY 0x%x:0x%x transceiver at address %d\n",
+			pci_name(tp->pci_dev),
+			phy->id[0], (phy->id[1] & 0xfff0), phy_id);
+	}
 }
 
 static void sis190_mii_probe_88e1111_fixup(struct sis190_private *tp)
Signature · 1 line
1.6.2.4
#9 lore raw

Re: [PATCH 3/3] sis190: better message on unknown PHY

Riccardo Ghetta <[email protected]> :
[...]

Quoted 4 lines
drivers/net/sis190.c +0 -0
index 8322e28..a69f3d2 100644

[...]

Quoted 5 lines
drivers/net/sis190.c +0 -1
@@ -1329,12 +1329,15 @@ static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp,
 			((mii_status & (BMSR_100FULL | BMSR_100HALF)) ?
 				LAN : HOME) : p->type;
 		tp->features |= p->feature;
-	} else

drivers/net/sis190.c static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp, · line 1337

Quoted 10 lines
drivers/net/sis190.c +5 -4
+		net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n",
+			pci_name(tp->pci_dev), p->name, phy_id);
+	} else {
 		phy->type = UNKNOWN;
-
-	net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n",
-		  pci_name(tp->pci_dev),
-		  (phy->type == UNKNOWN) ? "Unknown PHY" : p->name, phy_id);
+		net_probe(tp, KERN_INFO
+			"%s: unknown PHY 0x%x:0x%x transceiver at address %d\n",
                                         ^^^^ ^^^^ 0x%04x:0x%04x ?

drivers/net/sis190.c static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp, · line 1341

Quoted 4 lines
drivers/net/sis190.c +3 -0
+			pci_name(tp->pci_dev),
+			phy->id[0], (phy->id[1] & 0xfff0), phy_id);
+	}
 }

Please make it the first in the series.

Signature · 1 line
Ueimor