Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/marvell Add missing mii_tick() call.



details:   https://anonhg.NetBSD.org/src/rev/9bbe809b8db9
branches:  trunk
changeset: 782300:9bbe809b8db9
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Oct 26 21:03:26 2012 +0000

description:
Add missing mii_tick() call.

diffstat:

 sys/dev/marvell/if_mvgbe.c |  32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diffs (100 lines):

diff -r a64b14455ac8 -r 9bbe809b8db9 sys/dev/marvell/if_mvgbe.c
--- a/sys/dev/marvell/if_mvgbe.c        Fri Oct 26 19:15:52 2012 +0000
+++ b/sys/dev/marvell/if_mvgbe.c        Fri Oct 26 21:03:26 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mvgbe.c,v 1.26 2012/10/17 18:12:59 msaitoh Exp $    */
+/*     $NetBSD: if_mvgbe.c,v 1.27 2012/10/26 21:03:26 msaitoh Exp $    */
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,13 +25,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.26 2012/10/17 18:12:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.27 2012/10/26 21:03:26 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
+#include <sys/callout.h>
 #include <sys/device.h>
 #include <sys/endian.h>
 #include <sys/errno.h>
+#include <sys/kernel.h>
 #include <sys/kmem.h>
 #include <sys/mutex.h>
 #include <sys/sockio.h>
@@ -198,13 +200,15 @@
 
        bus_space_tag_t sc_iot;
        bus_space_handle_t sc_ioh;
-       bus_space_handle_t sc_dafh;             /* dest address filter handle */
+       bus_space_handle_t sc_dafh;     /* dest address filter handle */
        bus_dma_tag_t sc_dmat;
 
        struct ethercom sc_ethercom;
        struct mii_data sc_mii;
        u_int8_t sc_enaddr[ETHER_ADDR_LEN];     /* station addr */
 
+       callout_t sc_tick_ch;           /* tick callout */
+
        struct mvgbe_chain_data sc_cdata;
        struct mvgbe_ring_data *sc_rdata;
        bus_dmamap_t sc_ring_map;
@@ -242,6 +246,7 @@
 static int mvgbe_match(device_t, struct cfdata *, void *);
 static void mvgbe_attach(device_t, device_t, void *);
 
+static void mvgbe_tick(void *);
 static int mvgbe_intr(void *);
 
 static void mvgbe_start(struct ifnet *);
@@ -646,6 +651,8 @@
        sc->sc_dev = self;
        sc->sc_port = mva->mva_unit;
        sc->sc_iot = mva->mva_iot;
+       callout_init(&sc->sc_tick_ch, 0);
+       callout_setfunc(&sc->sc_tick_ch, mvgbe_tick, sc);
        if (bus_space_subregion(mva->mva_iot, mva->mva_ioh,
            MVGBE_PORTR_BASE + mva->mva_unit * MVGBE_PORTR_SIZE,
            MVGBE_PORTR_SIZE, &sc->sc_ioh)) {
@@ -862,6 +869,21 @@
        return 0;
 }
 
+static void
+mvgbe_tick(void *arg)
+{
+       struct mvgbe_softc *sc = arg;
+       struct mii_data *mii = &sc->sc_mii;
+       int s;
+
+       s = splnet();
+       mii_tick(mii);
+       /* Need more work */
+       splx(s);
+
+       callout_schedule(&sc->sc_tick_ch, hz);
+}
+
 static int
 mvgbe_intr(void *arg)
 {
@@ -1119,6 +1141,8 @@
            MVGBE_ICE_TXERR |
            MVGBE_ICE_LINKCHG);
 
+       callout_schedule(&sc->sc_tick_ch, hz);
+
        ifp->if_flags |= IFF_RUNNING;
        ifp->if_flags &= ~IFF_OACTIVE;
 
@@ -1137,6 +1161,8 @@
 
        DPRINTFN(2, ("mvgbe_stop\n"));
 
+       callout_stop(&sc->sc_tick_ch);
+
        /* Stop Rx port activity. Check port Rx activity. */
        reg = MVGBE_READ(sc, MVGBE_RQC);
        if (reg & MVGBE_RQC_ENQ_MASK)



Home | Main Index | Thread Index | Old Index