Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/imx - fix interrupt type ans interrupt masks



details:   https://anonhg.NetBSD.org/src/rev/bf74b425de74
branches:  trunk
changeset: 806876:bf74b425de74
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sun Mar 15 04:12:07 2015 +0000

description:
- fix interrupt type ans interrupt masks
- change timing of callout_schedule because it doesn't schedule once enet_stop is called
- typo

diffstat:

 sys/arch/arm/imx/if_enet.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (79 lines):

diff -r 5330f95b447c -r bf74b425de74 sys/arch/arm/imx/if_enet.c
--- a/sys/arch/arm/imx/if_enet.c        Sun Mar 15 01:42:27 2015 +0000
+++ b/sys/arch/arm/imx/if_enet.c        Sun Mar 15 04:12:07 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet.c,v 1.1 2014/09/25 05:05:28 ryo Exp $  */
+/*     $NetBSD: if_enet.c,v 1.2 2015/03/15 04:12:07 ryo Exp $  */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.1 2014/09/25 05:05:28 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.2 2015/03/15 04:12:07 ryo Exp $");
 
 #include "imxocotp.h"
 #include "imxccm.h"
@@ -346,11 +346,15 @@
 
        /* setup interrupt handlers */
        if ((sc->sc_ih = intr_establish(aa->aa_irq, IPL_NET,
-           IST_EDGE, enet_intr, sc)) == NULL) {
+           IST_LEVEL, enet_intr, sc)) == NULL) {
                aprint_error_dev(self, "unable to establish interrupt\n");
                goto failure;
        }
 
+       /* callout will be scheduled from enet_init() */
+       callout_init(&sc->sc_tick_ch, 0);
+       callout_setfunc(&sc->sc_tick_ch, enet_tick, sc);
+
        /* setup ifp */
        ifp = &sc->sc_ethercom.ec_if;
        strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
@@ -410,9 +414,6 @@
 #endif
 
        sc->sc_stopping = false;
-       callout_init(&sc->sc_tick_ch, 0);
-       callout_setfunc(&sc->sc_tick_ch, enet_tick, sc);
-       callout_schedule(&sc->sc_tick_ch, hz);
 
        return;
 
@@ -721,7 +722,7 @@
                                        char flags1buf[128], flags2buf[128];
                                        snprintb(flags1buf, sizeof(flags1buf),
                                            "\20" "\31MISS" "\26LENGTHVIOLATION"
-                                           "\25NONOCTET" "\23CRC" "\22OVERRUN"a
+                                           "\25NONOCTET" "\23CRC" "\22OVERRUN"
                                            "\21TRUNCATED", flags1);
                                        snprintb(flags2buf, sizeof(flags2buf),
                                            "\20" "\40MAC" "\33PHY"
@@ -987,6 +988,7 @@
        ENET_REG_WRITE(sc, ENET_RDAR, ENET_RDAR_ACTIVE);
 
        sc->sc_stopping = false;
+       callout_schedule(&sc->sc_tick_ch, hz);
 
  init_failure:
        splx(s);
@@ -2004,7 +2006,6 @@
        ENET_REG_WRITE(sc, ENET_EIMR, 
            ENET_EIR_TXF |
            ENET_EIR_RXF |
-           ENET_EIR_MII |
            ENET_EIR_EBERR |
            0);
 
@@ -2028,7 +2029,7 @@
        int nsegs, error;
 
        if ((error = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, seglist,
-           1, &nsegs, M_WAITOK)) != 0) {
+           1, &nsegs, M_NOWAIT)) != 0) {
                device_printf(sc->sc_dev,
                    "unable to allocate DMA buffer, error=%d\n", error);
                goto fail_alloc;



Home | Main Index | Thread Index | Old Index