Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Mar 2009 09:58:57 +0900
From:      Pyun YongHyeon <pyunyh@gmail.com>
To:        David Ehrmann <ehrmann@gmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: vge0 not autonegotiating to 1000baseTX full duplex in 7.1
Message-ID:  <20090309005857.GE5039@michelle.cdnetworks.co.kr>
In-Reply-To: <49B45E92.1080607@gmail.com>
References:  <49B355FA.2090906@gmail.com> <20090308081550.GC1531@michelle.cdnetworks.co.kr> <49B45E92.1080607@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Mar 08, 2009 at 05:10:58PM -0700, David Ehrmann wrote:
> Pyun YongHyeon wrote:
> >On Sat, Mar 07, 2009 at 09:22:02PM -0800, David Ehrmann wrote:
> >  
> >>It's been reported before, but I haven't seen anything new.  vge devices 
> >>    
> >
> >Because I don't have access to the hardware it looks like hard to
> >fix.
> >
> >  
> >>won't autonegotiate to gigabit speeds, and if I set the media to 
> >>1000baseTX, ifconfig reports "no carrier."  This was with two different 
> >>interfaces on the other end, one a switch, the other another computer 
> >>(but not a vge one).
> >>
> >>Any ideas?
> >>    
> >
> >Would you show me the output of dmesg?(Only vge(4) related one)
> >Also show me the output of "devinfo -rv | grep phy".
> >  
> 
> dmesg:
> 
> vge0: <VIA Networking Gigabit Ethernet> port 0xe800-0xe8ff mem 
> 0xfeaffc00-0xfeaf
> fcff irq 28 at device 0.0 on pci3
> vge0: Reserved 0x100 bytes for rid 0x14 type 3 at 0xfeaffc00
> miibus0: <MII bus> on vge0
> ip1000phy0: <IC Plus IP1001 10/100/1000 media interface> PHY 22 on miibus0
> ip1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 
> 1000bas
> eTX-FDX, auto
> vge0: WARNING: using obsoleted if_watchdog interface
> vge0: bpf attached
> vge0: Ethernet address: 00:40:63:xx:xx:xx
> ioapic1: routing intpin 4 (PCI IRQ 28) to vector 49
> vge0: [MPSAFE]
> vge0: [ITHREAD]
> 
> 
> devinfo -rv | grep phy
>                ip1000phy0 pnpinfo oui=0x90c3 model=0x19 rev=0x0 at phyno=22
>            ukphy0 pnpinfo oui=0x4063 model=0x32 rev=0xa at phyno=1
> 

Would you try attached patch? Due to lack of hardware access I
don't know whether it helps or not(Just compilation tested).

--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ip1000phy.diff2"

Index: sys/dev/mii/ip1000phy.c
===================================================================
--- sys/dev/mii/ip1000phy.c	(revision 189548)
+++ sys/dev/mii/ip1000phy.c	(working copy)
@@ -118,7 +118,6 @@
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = ip1000phy_service;
 	sc->mii_pdata = mii;
-	sc->mii_anegticks = MII_ANEGTICKS_GIGE;
 	sc->mii_flags |= MIIF_NOISOLATE;
 
 	mii->mii_instance++;
@@ -126,37 +125,14 @@
 	isc->model = MII_MODEL(ma->mii_id2);
 	isc->revision = MII_REV(ma->mii_id2);
 
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	if (sc->mii_capabilities & BMSR_EXTSTAT)
+		sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
 	device_printf(dev, " ");
 
-#define	ADD(m, c)	ifmedia_add(&mii->mii_media, (m), (c), NULL)
-
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
-	    BMCR_ISO);
-
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
-	    IP1000PHY_BMCR_10);
-	printf("10baseT, ");
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
-	    IP1000PHY_BMCR_10 | IP1000PHY_BMCR_FDX);
-	printf("10baseT-FDX, ");
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst),
-	    IP1000PHY_BMCR_100);
-	printf("100baseTX, ");
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst),
-	    IP1000PHY_BMCR_100 | IP1000PHY_BMCR_FDX);
-	printf("100baseTX-FDX, ");
-	/* 1000baseT half-duplex, really supported? */
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst),
-	    IP1000PHY_BMCR_1000);
-	printf("1000baseTX, ");
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst),
-	    IP1000PHY_BMCR_1000 | IP1000PHY_BMCR_FDX);
-	printf("1000baseTX-FDX, ");
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0);
-	printf("auto\n");
-#undef ADD
-
 	ip1000phy_reset(sc);
+	mii_phy_add_media(sc);
+	printf("\n");
 
 	MIIBUS_MEDIAINIT(sc->mii_dev);
 	return(0);
@@ -296,7 +272,7 @@
 		 * Only retry autonegotiation every mii_anegticks seconds.
 		 */
 		if (sc->mii_ticks <= sc->mii_anegticks)
-			return (0);
+			break;
 
 		sc->mii_ticks = 0;
 		ip1000phy_mii_phy_auto(sc);
@@ -353,6 +329,9 @@
 		case IP1000PHY_LSR_SPEED_1000:
 			mii->mii_media_active |= IFM_1000_T;
 			break;
+		default:
+			mii->mii_media_active |= IFM_NONE;
+			return;
 		}
 		if ((stat & IP1000PHY_LSR_FULL_DUPLEX) != 0)
 			mii->mii_media_active |= IFM_FDX;
@@ -373,6 +352,9 @@
 		case PC_LinkSpeed_1000:
 			mii->mii_media_active |= IFM_1000_T;
 			break;
+		default:
+			mii->mii_media_active |= IFM_NONE;
+			return;
 		}
 		if ((stat & PC_PhyDuplexStatus) != 0)
 			mii->mii_media_active |= IFM_FDX;
@@ -409,18 +391,24 @@
 }
 
 static int
-ip1000phy_mii_phy_auto(struct mii_softc *mii)
+ip1000phy_mii_phy_auto(struct mii_softc *sc)
 {
+	struct ip1000phy_softc *isc;
 	uint32_t reg;
 
-	PHY_WRITE(mii, IP1000PHY_MII_ANAR,
-	    IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX |
+	isc = (struct ip1000phy_softc *)sc;
+	reg = 0;
+	if (isc->model == MII_MODEL_ICPLUS_IP1001)
+		reg = PHY_READ(sc, IP1000PHY_MII_ANAR);
+	reg |= IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX |
 	    IP1000PHY_ANAR_100TX | IP1000PHY_ANAR_100TX_FDX |
-	    IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE);
+	    IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE;
+	PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA);
+
 	reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX;
 	reg |= IP1000PHY_1000CR_MASTER;
-	PHY_WRITE(mii, IP1000PHY_MII_1000CR, reg);
-	PHY_WRITE(mii, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX |
+	PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg);
+	PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX |
 	    IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG));
 
 	return (EJUSTRETURN);
Index: sys/dev/mii/ip1000phyreg.h
===================================================================
--- sys/dev/mii/ip1000phyreg.h	(revision 189548)
+++ sys/dev/mii/ip1000phyreg.h	(working copy)
@@ -61,6 +61,7 @@
 
 /* Autonegotiation advertisement register */
 #define	IP1000PHY_MII_ANAR		0x04
+#define	IP1000PHY_ANAR_CSMA		0x0001
 #define	IP1000PHY_ANAR_10T		0x0020
 #define	IP1000PHY_ANAR_10T_FDX		0x0040
 #define	IP1000PHY_ANAR_100TX		0x0080

--zhXaljGHf11kAtnf--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090309005857.GE5039>