Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Nov 2009 14:23:50 +0100
From:      Matthias Reyelt <Matthias.Reyelt@brunel.de>
To:        Rafal Jaworowski <raj@semihalf.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: Marvell Kirkwood 6281 mge1 interface
Message-ID:  <200911051423.52940.Matthias.Reyelt@brunel.de>
In-Reply-To: <F56B3167-E60F-413F-8F35-1AE8732B38F4@semihalf.com>
References:  <200911040956.09749.Matthias.Reyelt@brunel.de> <200911041142.32349.Matthias.Reyelt@brunel.de> <F56B3167-E60F-413F-8F35-1AE8732B38F4@semihalf.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_oHt8KBer93oXNpg
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Disposition: inline

Hi,

here is the diff. The removal of the debug options were due to some 
performance tests I did before.

Am Donnerstag 05 November 2009 11:46:06 schrieb Rafal Jaworowski:
> 
> On 2009-11-04, at 11:42, Matthias Reyelt wrote:
> 
> > Hi,
> >
> > here is the boot log. I have added several device_printf's and  
> > removed the
> > 0xffff condition in mii_phy_probe()
> 
> Before trying to identify PHY problems,  can you share all your  
> changes (a diff)? So far all Kirkwood based boards we support had only  
> a single active Ethernet port, so the Kirkwood platform config only  
Yes, the OpenRD client is rather new, and the board contains an awful lot of 
interfaces (and no fan), really great. 
> accounted for a single MAC, have you altered the obio_devices[] in  
> particular?
I did add the second interface to the obio_devices[], and adjusted the defines 
according to the header files as good as I knew (although I have been aware 
that there would be a reason for the missing interface :-)

Matthias

--Boundary-00=_oHt8KBer93oXNpg
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff; charset="iso-8859-1"; name="changes-kw2ndif.diff"
Content-Disposition: attachment;
	filename="changes-kw2ndif.diff"

Index: arm/mv/kirkwood/kirkwood.c
===================================================================
--- arm/mv/kirkwood/kirkwood.c	(revision 198539)
+++ arm/mv/kirkwood/kirkwood.c	(working copy)
@@ -95,6 +95,12 @@
 		{ -1 },
 		CPU_PM_CTRL_GE0
 	},
+        { "mge", MV_ETH1_BASE, MV_ETH_SIZE,
+                { MV_INT_GBE1RX, MV_INT_GBE1TX, MV_INT_GBE1MISC,
+                  MV_INT_GBE1SUM, MV_INT_GBEERR, -1 },
+                { -1 },
+                CPU_PM_CTRL_GE1
+        },
 	{ "twsi", MV_TWSI0_BASE, MV_TWSI_SIZE,
 		{ -1 }, { -1 },
 		CPU_PM_CTRL_NONE
Index: arm/conf/DB-88F6XXX
===================================================================
--- arm/conf/DB-88F6XXX	(revision 198539)
+++ arm/conf/DB-88F6XXX	(working copy)
@@ -39,12 +39,12 @@
 # Debugging
 options 	ALT_BREAK_TO_DEBUGGER
 options 	DDB
-options 	DIAGNOSTIC
+#options 	DIAGNOSTIC
 #options 	INVARIANTS		#Enable calls of extra sanity checking
 #options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
 options 	KDB
-options 	WITNESS			#Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
+#options 	WITNESS			#Enable checks to detect deadlocks and cycles
+#options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
 #options 	WITNESS_KDB
 
 device		pci
Index: conf/NOTES
===================================================================
--- conf/NOTES	(revision 198539)
+++ conf/NOTES	(working copy)
@@ -266,12 +266,12 @@
 #	  a lock hierarchy violation occurs or if locks are held when going to
 #	  sleep.
 # WITNESS_SKIPSPIN disables the witness checks on spin mutexes.
-options 	PREEMPTION
-options 	FULL_PREEMPTION
-options 	MUTEX_DEBUG
-options 	WITNESS
-options 	WITNESS_KDB
-options 	WITNESS_SKIPSPIN
+#options 	PREEMPTION
+#options 	FULL_PREEMPTION
+#options 	MUTEX_DEBUG
+#options 	WITNESS
+#options 	WITNESS_KDB
+#options 	WITNESS_SKIPSPIN
 
 # LOCK_PROFILING - Profiling locks.  See LOCK_PROFILING(9) for details.
 options 	LOCK_PROFILING
Index: dev/mge/if_mge.c
===================================================================
--- dev/mge/if_mge.c	(revision 198785)
+++ dev/mge/if_mge.c	(working copy)
@@ -685,6 +685,7 @@
 	ether_ifattach(ifp, hwaddr);
 	callout_init(&sc->wd_callout, 0);
 
+	device_printf( dev, "Now probing PHY\n" );
 	/* Probe PHY(s) */
 	error = mii_phy_probe(dev, &sc->miibus, mge_ifmedia_upd, mge_ifmedia_sts);
 	if (error) {
@@ -1273,10 +1274,11 @@
 	 * unit.
 	 */
 
-	
+
 	if ((MII_ADDR_BASE + device_get_unit(dev)) != phy)
 		return (0);
 
+
 	MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &
 	    (MGE_SMI_READ | (reg << 21) | (phy << 16)));
 
@@ -1298,6 +1300,7 @@
 	if ((MII_ADDR_BASE + device_get_unit(dev)) != phy)
 		return (0);
 
+	device_printf( dev, "Writing %x to reg %x on phy %x\n", value, reg, phy );
 	MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &
 	    (MGE_SMI_WRITE | (reg << 21) | (phy << 16) | (value & 0xffff)));
 
Index: dev/mii/e1000phy.c
===================================================================
--- dev/mii/e1000phy.c	(revision 198539)
+++ dev/mii/e1000phy.c	(working copy)
@@ -119,7 +119,7 @@
 static int
 e1000phy_probe(device_t	dev)
 {
-
+  device_printf( dev, "Probing e1000 PHY\n" );
 	return (mii_phy_dev_probe(dev, e1000phys, BUS_PROBE_DEFAULT));
 }
 
Index: dev/mii/mii.c
===================================================================
--- dev/mii/mii.c	(revision 198539)
+++ dev/mii/mii.c	(working copy)
@@ -124,7 +124,9 @@
 	int			bmsr, capmask = 0xFFFFFFFF;
 
 	mii = device_get_softc(dev);
+	device_printf( dev, "(miibus_probe) is the mii device\n" );
 	parent = device_get_parent(dev);
+	device_printf( parent, "(miibus_probe) is the eth device\n" );
 	LIST_INIT(&mii->mii_phys);
 
 	for (ma.mii_phyno = 0; ma.mii_phyno < MII_NPHY; ma.mii_phyno++) {
@@ -133,13 +135,15 @@
 		 * many braindead PHYs report 0/0 in their ID registers,
 		 * so we test for media in the BMSR.
 	 	 */
+  	        device_printf( dev, "Probing phy %x ", ma.mii_phyno );
 		bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
-		if (bmsr == 0 || bmsr == 0xffff ||
+		if (bmsr == 0 ||
 		    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
 			/* Assume no PHY at this address. */
-			continue;
+		  device_printf( dev, "No phy found\n" );
+		  continue;
 		}
-
+		device_printf( dev, "found one. Now looking for ID\n" );
 		/*
 		 * Extract the IDs. Braindead PHYs will be handled by
 		 * the `ukphy' driver, as we have no ID information to
@@ -179,6 +183,7 @@
 	 * Note that each NIC's softc must start with an ifnet pointer.
 	 * XXX: EVIL HACK!
 	 */
+	device_printf( dev, "miibus_attach\n" );
 	mii->mii_ifp = *(struct ifnet**)device_get_softc(device_get_parent(dev));
 	ivars = device_get_ivars(dev);
 	ifmedia_init(&mii->mii_media, IFM_IMASK, ivars->ifmedia_upd,
@@ -337,13 +342,16 @@
 	*child = device_add_child(dev, "miibus", -1);
 	device_set_ivars(*child, ivars);
 
+	device_printf( dev, "mii_phy_probe: Starting to probe PHYs: " );
 	for (i = 0; i < MII_NPHY; i++) {
 		bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
-                if (bmsr == 0 || bmsr == 0xffff ||
+	        printf( "%d:%d ", i, bmsr );
+                if (bmsr == 0 ||
                     (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
                         /* Assume no PHY at this address. */
                         continue;
                 } else
+	 	        printf( "ok\n" );
 			break;
 	}
 


--Boundary-00=_oHt8KBer93oXNpg--



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