Sat Mar 26 17:04:03 2016 UTC ()
David Binderman in port-arm/51013: masking of rxbdtlen happened before
the value was read - move it down a few lines.


(martin)
diff -r1.13 -r1.14 src/sys/arch/arm/rockchip/rockchip_emac.c

cvs diff -r1.13 -r1.14 src/sys/arch/arm/rockchip/Attic/rockchip_emac.c (expand / switch to unified diff)

--- src/sys/arch/arm/rockchip/Attic/rockchip_emac.c 2016/02/09 08:32:08 1.13
+++ src/sys/arch/arm/rockchip/Attic/rockchip_emac.c 2016/03/26 17:04:03 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rockchip_emac.c,v 1.13 2016/02/09 08:32:08 ozaki-r Exp $ */ 1/* $NetBSD: rockchip_emac.c,v 1.14 2016/03/26 17:04:03 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_rkemac.h" 29#include "opt_rkemac.h"
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: rockchip_emac.c,v 1.13 2016/02/09 08:32:08 ozaki-r Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: rockchip_emac.c,v 1.14 2016/03/26 17:04:03 martin Exp $");
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/bus.h> 35#include <sys/bus.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/intr.h> 37#include <sys/intr.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/mutex.h> 40#include <sys/mutex.h>
41#include <sys/condvar.h> 41#include <sys/condvar.h>
42#include <sys/cprng.h> 42#include <sys/cprng.h>
43 43
44#include <arm/rockchip/rockchip_reg.h> 44#include <arm/rockchip/rockchip_reg.h>
45#include <arm/rockchip/rockchip_var.h> 45#include <arm/rockchip/rockchip_var.h>
@@ -511,39 +511,39 @@ rkemac_init(struct ifnet *ifp) @@ -511,39 +511,39 @@ rkemac_init(struct ifnet *ifp)
511{ 511{
512 struct rkemac_softc *sc = ifp->if_softc; 512 struct rkemac_softc *sc = ifp->if_softc;
513 uint32_t control; 513 uint32_t control;
514 514
515 if (ifp->if_flags & IFF_RUNNING) 515 if (ifp->if_flags & IFF_RUNNING)
516 return 0; 516 return 0;
517 517
518 rkemac_stop(ifp, 0); 518 rkemac_stop(ifp, 0);
519 519
520 EMAC_WRITE(sc, EMAC_POLLRATE_REG, RKEMAC_POLLRATE); 520 EMAC_WRITE(sc, EMAC_POLLRATE_REG, RKEMAC_POLLRATE);
521 EMAC_WRITE(sc, EMAC_RXRINGPTR_REG, sc->sc_rxq.r_physaddr); 521 EMAC_WRITE(sc, EMAC_RXRINGPTR_REG, sc->sc_rxq.r_physaddr);
522 EMAC_WRITE(sc, EMAC_TXRINGPTR_REG, sc->sc_txq.t_physaddr); 522 EMAC_WRITE(sc, EMAC_TXRINGPTR_REG, sc->sc_txq.t_physaddr);
523 523
524 control &= ~EMAC_CONTROL_RXBDTLEN; 
525 control = EMAC_READ(sc, EMAC_CONTROL_REG); 524 control = EMAC_READ(sc, EMAC_CONTROL_REG);
526 if (ifp->if_flags & IFF_PROMISC) { 525 if (ifp->if_flags & IFF_PROMISC) {
527 control |= EMAC_CONTROL_PROM; 526 control |= EMAC_CONTROL_PROM;
528 } else { 527 } else {
529 control &= ~EMAC_CONTROL_PROM; 528 control &= ~EMAC_CONTROL_PROM;
530 } 529 }
531 if (ifp->if_flags & IFF_BROADCAST) { 530 if (ifp->if_flags & IFF_BROADCAST) {
532 control &= ~EMAC_CONTROL_DISBC; 531 control &= ~EMAC_CONTROL_DISBC;
533 } else { 532 } else {
534 control |= EMAC_CONTROL_DISBC; 533 control |= EMAC_CONTROL_DISBC;
535 } 534 }
536 535
 536 control &= ~EMAC_CONTROL_RXBDTLEN;
537 control |= __SHIFTIN(RKEMAC_RX_RING_COUNT, EMAC_CONTROL_RXBDTLEN); 537 control |= __SHIFTIN(RKEMAC_RX_RING_COUNT, EMAC_CONTROL_RXBDTLEN);
538 control &= ~EMAC_CONTROL_TXBDTLEN; 538 control &= ~EMAC_CONTROL_TXBDTLEN;
539 control |= __SHIFTIN(RKEMAC_TX_RING_COUNT, EMAC_CONTROL_TXBDTLEN); 539 control |= __SHIFTIN(RKEMAC_TX_RING_COUNT, EMAC_CONTROL_TXBDTLEN);
540 control |= EMAC_CONTROL_RXRN; 540 control |= EMAC_CONTROL_RXRN;
541 control |= EMAC_CONTROL_TXRN; 541 control |= EMAC_CONTROL_TXRN;
542 EMAC_WRITE(sc, EMAC_CONTROL_REG, control); 542 EMAC_WRITE(sc, EMAC_CONTROL_REG, control);
543 543
544 rkemac_setmulti(sc); 544 rkemac_setmulti(sc);
545 545
546 control |= EMAC_CONTROL_EN; 546 control |= EMAC_CONTROL_EN;
547 EMAC_WRITE(sc, EMAC_CONTROL_REG, control); 547 EMAC_WRITE(sc, EMAC_CONTROL_REG, control);
548 548
549 callout_schedule(&sc->sc_mii_tick, hz); 549 callout_schedule(&sc->sc_mii_tick, hz);