Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Enable AXEN_RXCTL_START bit only when RX is read...



details:   https://anonhg.NetBSD.org/src/rev/dcf228056f2e
branches:  trunk
changeset: 996418:dcf228056f2e
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Jan 31 15:22:56 2019 +0000

description:
Enable AXEN_RXCTL_START bit only when RX is ready. Otherwise,
the adapter eventually falls into "no carrier" state while it
is not running.

diffstat:

 sys/dev/usb/if_axen.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 1959e9554274 -r dcf228056f2e sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Jan 31 15:21:05 2019 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Jan 31 15:22:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axen.c,v 1.20 2019/01/31 15:21:05 rin Exp $ */
+/*     $NetBSD: if_axen.c,v 1.21 2019/01/31 15:22:56 rin Exp $ */
 /*     $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.20 2019/01/31 15:21:05 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.21 2019/01/31 15:22:56 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -571,7 +571,6 @@
        /* Set RX control register */
        ctl = AXEN_RXCTL_IPE | AXEN_RXCTL_DROPCRCERR | AXEN_RXCTL_AUTOB;
        ctl |= AXEN_RXCTL_ACPT_PHY_MCAST | AXEN_RXCTL_ACPT_ALL_MCAST;
-       ctl |= AXEN_RXCTL_START;
        wval = htole16(ctl);
        axen_cmd(sc, AXEN_CMD_MAC_WRITE2, 2, AXEN_MAC_RXCTL, &wval);
 
@@ -1535,9 +1534,19 @@
        struct axen_softc *sc = ifp->if_softc;
        usbd_status err;
        int i;
+       uint16_t rxmode, wval;
 
        axen_reset(sc);
 
+       /* Disable receiver, set RX mode */
+       axen_lock_mii(sc);
+       axen_cmd(sc, AXEN_CMD_MAC_READ2, 2, AXEN_MAC_RXCTL, &wval);
+       rxmode = le16toh(wval);
+       rxmode &= ~AXEN_RXCTL_START;
+       wval = htole16(rxmode);
+       axen_cmd(sc, AXEN_CMD_MAC_WRITE2, 2, AXEN_MAC_RXCTL, &wval);
+       axen_unlock_mii(sc);
+
        ifp->if_timer = 0;
        ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
 



Home | Main Index | Thread Index | Old Index