Module Name: src
Committed By: ryo
Date: Sun Mar 15 04:12:07 UTC 2015
Modified Files:
src/sys/arch/arm/imx: if_enet.c
Log Message:
- fix interrupt type ans interrupt masks
- change timing of callout_schedule because it doesn't schedule once enet_stop
is called
- typo
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/if_enet.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.1 src/sys/arch/arm/imx/if_enet.c:1.2
--- src/sys/arch/arm/imx/if_enet.c:1.1 Thu Sep 25 05:05:28 2014
+++ src/sys/arch/arm/imx/if_enet.c Sun Mar 15 04:12:07 2015
@@ -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 <[email protected]>
@@ -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 @@ enet_attach(device_t parent __unused, de
/* 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 @@ enet_attach(device_t parent __unused, de
#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 @@ enet_rx_intr(void *arg)
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_init(struct ifnet *ifp)
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_init_regs(struct enet_softc *sc, in
ENET_REG_WRITE(sc, ENET_EIMR,
ENET_EIR_TXF |
ENET_EIR_RXF |
- ENET_EIR_MII |
ENET_EIR_EBERR |
0);
@@ -2028,7 +2029,7 @@ enet_alloc_dma(struct enet_softc *sc, si
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;