Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Support mii_tick().



details:   https://anonhg.NetBSD.org/src/rev/00918510ba38
branches:  trunk
changeset: 749375:00918510ba38
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Sat Nov 28 08:44:00 2009 +0000

description:
Support mii_tick().
  Thanks tsubai@.

diffstat:

 sys/dev/ic/lan9118.c    |  25 +++++++++++++++++++++++--
 sys/dev/ic/lan9118var.h |   3 ++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diffs (95 lines):

diff -r fb67d597cda2 -r 00918510ba38 sys/dev/ic/lan9118.c
--- a/sys/dev/ic/lan9118.c      Sat Nov 28 08:16:00 2009 +0000
+++ b/sys/dev/ic/lan9118.c      Sat Nov 28 08:44:00 2009 +0000
@@ -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);
+}
diff -r fb67d597cda2 -r 00918510ba38 sys/dev/ic/lan9118var.h
--- a/sys/dev/ic/lan9118var.h   Sat Nov 28 08:16:00 2009 +0000
+++ b/sys/dev/ic/lan9118var.h   Sat Nov 28 08:44:00 2009 +0000
@@ -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



Home | Main Index | Thread Index | Old Index