Source-Changes-HG archive

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

[src/bouyer-socketcan]: src/sys/arch/arm/allwinner Print some informations fo...



details:   https://anonhg.NetBSD.org/src/rev/583854914383
branches:  bouyer-socketcan
changeset: 820897:583854914383
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Apr 20 17:30:52 2017 +0000

description:
Print some informations for error interrupts.
Fix some registers values.
Now we can transmit frames. Receive still doesn't work.

diffstat:

 sys/arch/arm/allwinner/awin_can.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r a7aefc167cf5 -r 583854914383 sys/arch/arm/allwinner/awin_can.c
--- a/sys/arch/arm/allwinner/awin_can.c Thu Apr 20 17:29:10 2017 +0000
+++ b/sys/arch/arm/allwinner/awin_can.c Thu Apr 20 17:30:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awin_can.c,v 1.1.2.3 2017/04/20 13:00:52 bouyer Exp $  */
+/*     $NetBSD: awin_can.c,v 1.1.2.4 2017/04/20 17:30:52 bouyer Exp $  */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.1.2.3 2017/04/20 13:00:52 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.1.2.4 2017/04/20 17:30:52 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -303,6 +303,7 @@
                printf("can_input2\n");
                can_input(ifp, m); /* loopback */
                sc->sc_m_transmit = NULL;
+               ifp->if_timer = 0;
        }
 
        IF_DEQUEUE(&ifp->if_snd, m);
@@ -382,13 +383,17 @@
        struct ifnet * const ifp = sc->sc_ifp;
        KASSERT(mutex_owned(&sc->sc_intr_lock));
        int txerr = 0;
+       uint32_t reg;
 
        if (irq & AWIN_CAN_INT_DATA_OR) {
                ifp->if_ierrors++;
                awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_CLR_OR);
        }
        if (irq & AWIN_CAN_INT_ERR) {
-               /* XXX todo */
+               reg = awin_can_read(sc, AWIN_CAN_REC_REG);
+               printf("%s: ERR interrupt status 0x%x counters 0x%x\n",
+                   device_xname(sc->sc_dev), sts, reg);
+
        }
        if (irq & AWIN_CAN_INT_BERR) {
                if (sts & AWIN_CAN_STA_TX)
@@ -397,7 +402,8 @@
                        ifp->if_ierrors++;
        }
        if (irq & AWIN_CAN_INT_ERR_PASSIVE) {
-               /* XXX todo */
+               printf("%s: PASSV interrupt status 0x%x\n",
+                   device_xname(sc->sc_dev), sts);
        }
        if (irq & AWIN_CAN_INT_ARB_LOST) {
                txerr++;
@@ -459,7 +465,7 @@
        uint32_t reg;
 
        /* setup timings and mode - has to be done in reset */
-       reg = 0;
+       reg = AWIN_CAN_MODSEL_RST;
        if (sc->sc_linkmodes & CAN_LINKMODE_LISTENONLY)
                reg |= AWIN_CAN_MODSEL_LST_ONLY;
 



Home | Main Index | Thread Index | Old Index