Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jan 2006 08:52:30 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 89203 for review
Message-ID:  <200601050852.k058qUS1088689@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=89203

Change 89203 by imp@imp_plunger on 2006/01/05 08:51:29

	Make sure we reschedule the next tick.
	In stop, make sure we turn off the running and active flags as well as
	stopping the timer.
	Add notes about needing to worry about busdma resources.
	Write a watchdog.

Affected files ...

.. //depot/projects/arm/src/sys/arm/at91/if_ate.c#10 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#10 (text+ko) ====

@@ -350,6 +350,11 @@
 	 * clearing them here.  The datasheet is a bit vague on the topic.
 	 */
 	WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_CSR);
+
+	/*
+	 * Schedule another timeout one second from now.
+	 */
+	callout_reset(&sc->tick_ch, hz, ate_tick, sc);
 }
 
 
@@ -448,12 +453,20 @@
 static void
 atestop(struct ate_softc *sc)
 {
+	struct ifnet *ifp = sc->ifp;
+
+	if (ifp) {
+		ifp->if_timer = 0;
+		ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+	}
+
 	callout_stop(&sc->tick_ch);
 
 	/*
 	 * Enable some parts of the MAC that are needed always (like the
 	 * MII bus.  This turns off the RE and TE bits, which will remain
-	 * off until atestart() is called to turn them on.
+	 * off until atestart() is called to turn them on.  With RE and TE
+	 * turned off, there's no DMA to worry about after this write.
 	 */
 	WR4(sc, ETH_CTL, ETH_CTL_MPE);
 
@@ -477,6 +490,12 @@
 	WR4(sc, ETH_RSR, 0xffffffff);
 
 	/*
+	 * XXX need to worry about the busdma resources?  Yes, I think we need
+	 * to sync and unload them.  We may also need to release the mbufs
+	 * that are assocaited with RX and TX operations.
+	 */
+
+	/*
 	 * XXX we should power down the EMAC if it isn't in use, after
 	 * putting it into loopback mode.  This saves about 400uA according
 	 * to the datasheet.
@@ -486,7 +505,13 @@
 static void
 atewatchdog(struct ifnet *ifp)
 {
-	/* timeout, not sure what to do */
+	struct ate_softc *sc = ifp->if_softc;
+
+	ATE_LOCK(sc);
+	device_printf(sc->dev, "Device timeout\n");
+	ifp->if_oerrors++;
+	ateinit_locked(sc);
+	ATE_UNLOCK(sc);
 }
 
 static int



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