Module Name:    src
Committed By:   kiyohara
Date:           Sat Nov 28 08:44:00 UTC 2009

Modified Files:
        src/sys/dev/ic: lan9118.c lan9118var.h

Log Message:
Support mii_tick().
  Thanks tsu...@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/lan9118.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/lan9118var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/lan9118.c
diff -u src/sys/dev/ic/lan9118.c:1.2 src/sys/dev/ic/lan9118.c:1.3
--- src/sys/dev/ic/lan9118.c:1.2	Mon Nov 23 09:41:53 2009
+++ src/sys/dev/ic/lan9118.c	Sat Nov 28 08:44:00 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lan9118.c,v 1.2 2009/11/23 09:41:53 kiyohara Exp $	*/
+/*	$NetBSD: lan9118.c,v 1.3 2009/11/28 08:44:00 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.2 2009/11/23 09:41:53 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.3 2009/11/28 08:44:00 kiyohara Exp $");
 
 /*
  * The LAN9118 Family
@@ -49,6 +49,7 @@
 #include "rnd.h"
 
 #include <sys/param.h>
+#include <sys/callout.h>
 #include <sys/device.h>
 #include <sys/errno.h>
 #include <sys/bus.h>
@@ -107,6 +108,8 @@
 static void lan9118_rxintr(struct lan9118_softc *);
 static void lan9118_txintr(struct lan9118_softc *);
 
+static void lan9118_tick(void *);
+
 /* This values refer from Linux's smc911x.c */
 static uint32_t afc_cfg[] = {
 	/* 0 */ 0x00000000,
@@ -281,6 +284,8 @@
 	if_attach(ifp);
 	ether_ifattach(ifp, sc->sc_enaddr);
 
+	callout_init(&sc->sc_tick, 0);
+
 #if NRND > 0
 	rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
 	    RND_TYPE_NET, 0);
@@ -595,6 +600,8 @@
 	ifp->if_flags |= IFF_RUNNING;
 	ifp->if_flags &= ~IFF_OACTIVE;
 
+	callout_reset(&sc->sc_tick, hz, lan9118_tick, sc);
+
 	splx(s);
 
 	return 0;
@@ -631,6 +638,8 @@
 	/* Clear RX Status/Data FIFOs */
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, LAN9118_RX_CFG,
 	    LAN9118_RX_CFG_RX_DUMP);
+
+	callout_stop(&sc->sc_tick);
 }
 
 static void
@@ -1104,3 +1113,15 @@
 		 */
 		ifp->if_flags &= ~IFF_OACTIVE;
 }
+
+void
+lan9118_tick(void *v)
+{
+	struct lan9118_softc *sc = v;
+	int s;
+
+	s = splnet();
+	mii_tick(&sc->sc_mii);
+	callout_schedule(&sc->sc_tick, hz);
+	splx(s);
+}

Index: src/sys/dev/ic/lan9118var.h
diff -u src/sys/dev/ic/lan9118var.h:1.1 src/sys/dev/ic/lan9118var.h:1.2
--- src/sys/dev/ic/lan9118var.h:1.1	Sun Aug  9 06:40:10 2009
+++ src/sys/dev/ic/lan9118var.h	Sat Nov 28 08:44:00 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lan9118var.h,v 1.1 2009/08/09 06:40:10 kiyohara Exp $	*/
+/*	$NetBSD: lan9118var.h,v 1.2 2009/11/28 08:44:00 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -69,6 +69,7 @@
 
 	uint32_t sc_afc_cfg;		/* AFC_CFG configuration */
 	int sc_use_extphy;
+	struct callout sc_tick;
 
 	int sc_flags;
 #define LAN9118_FLAGS_SWAP	0x00000001

Reply via email to