Tue Jun 11 16:57:05 2013 UTC ()
In interrupt function, use mii_pollstat() instead of mii_tick() to update
PHY status.


(msaitoh)
diff -r1.5 -r1.6 src/sys/arch/arm/gemini/if_gmc.c
diff -r1.83 -r1.84 src/sys/dev/ic/smc91cxx.c

cvs diff -r1.5 -r1.6 src/sys/arch/arm/gemini/if_gmc.c (expand / switch to unified diff)

--- src/sys/arch/arm/gemini/if_gmc.c 2012/07/22 14:32:50 1.5
+++ src/sys/arch/arm/gemini/if_gmc.c 2013/06/11 16:57:05 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_gmc.c,v 1.5 2012/07/22 14:32:50 matt Exp $ */ 1/* $NetBSD: if_gmc.c,v 1.6 2013/06/11 16:57:05 msaitoh Exp $ */
2/*- 2/*-
3 * Copyright (c) 2008 The NetBSD Foundation, Inc. 3 * Copyright (c) 2008 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas <matt@3am-software.com> 7 * by Matt Thomas <matt@3am-software.com>
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -37,27 +37,27 @@ @@ -37,27 +37,27 @@
37#include <sys/mbuf.h> 37#include <sys/mbuf.h>
38 38
39#include <sys/bus.h> 39#include <sys/bus.h>
40#include <machine/intr.h> 40#include <machine/intr.h>
41 41
42#include <arm/gemini/gemini_reg.h> 42#include <arm/gemini/gemini_reg.h>
43#include <arm/gemini/gemini_gmacreg.h> 43#include <arm/gemini/gemini_gmacreg.h>
44#include <arm/gemini/gemini_gmacvar.h> 44#include <arm/gemini/gemini_gmacvar.h>
45 45
46#include <net/if.h> 46#include <net/if.h>
47#include <net/if_ether.h> 47#include <net/if_ether.h>
48#include <net/if_dl.h> 48#include <net/if_dl.h>
49 49
50__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.5 2012/07/22 14:32:50 matt Exp $"); 50__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.6 2013/06/11 16:57:05 msaitoh Exp $");
51 51
52#define MAX_TXSEG 32 52#define MAX_TXSEG 32
53 53
54struct gmc_softc { 54struct gmc_softc {
55 device_t sc_dev; 55 device_t sc_dev;
56 struct gmac_softc *sc_psc; 56 struct gmac_softc *sc_psc;
57 struct gmc_softc *sc_sibling; 57 struct gmc_softc *sc_sibling;
58 bus_dma_tag_t sc_dmat; 58 bus_dma_tag_t sc_dmat;
59 bus_space_tag_t sc_iot; 59 bus_space_tag_t sc_iot;
60 bus_space_handle_t sc_ioh; 60 bus_space_handle_t sc_ioh;
61 bus_space_handle_t sc_dma_ioh; 61 bus_space_handle_t sc_dma_ioh;
62 bus_space_handle_t sc_gmac_ioh; 62 bus_space_handle_t sc_gmac_ioh;
63 struct ethercom sc_ec; 63 struct ethercom sc_ec;
@@ -696,27 +696,27 @@ gmc_intr(void *arg) @@ -696,27 +696,27 @@ gmc_intr(void *arg)
696 } 696 }
697 if (status & INT4_TX_XOFF) { 697 if (status & INT4_TX_XOFF) {
698 } 698 }
699 if (status & INT4_RX_FIFO_OVRN) { 699 if (status & INT4_RX_FIFO_OVRN) {
700#if 0 700#if 0
701 if (sc->sc_psc->sc_swfree_min < MAX_RXMAPS) { 701 if (sc->sc_psc->sc_swfree_min < MAX_RXMAPS) {
702 sc->sc_psc->sc_swfree_min++; 702 sc->sc_psc->sc_swfree_min++;
703 gmac_swfree_min_update(psc); 703 gmac_swfree_min_update(psc);
704 } 704 }
705#endif 705#endif
706 sc->sc_if.if_ierrors++; 706 sc->sc_if.if_ierrors++;
707 } 707 }
708 if (status & INT4_RGMII_STSCHG) { 708 if (status & INT4_RGMII_STSCHG) {
709 mii_tick(&sc->sc_mii); 709 mii_pollstat(&sc->sc_mii);
710 } 710 }
711 bus_space_write_4(sc->sc_iot, sc->sc_ioh, GMAC_INT4_STATUS, status); 711 bus_space_write_4(sc->sc_iot, sc->sc_ioh, GMAC_INT4_STATUS, status);
712 712
713 if (do_ifstart) 713 if (do_ifstart)
714 gmc_ifstart(&sc->sc_if); 714 gmc_ifstart(&sc->sc_if);
715 715
716 aprint_debug_dev(sc->sc_dev, "gmac_intr: sts=%#x/%#x/%#x/%#x/%#x\n", 716 aprint_debug_dev(sc->sc_dev, "gmac_intr: sts=%#x/%#x/%#x/%#x/%#x\n",
717 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT0_STATUS), 717 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT0_STATUS),
718 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT1_STATUS), 718 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT1_STATUS),
719 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT2_STATUS), 719 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT2_STATUS),
720 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT3_STATUS), 720 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT3_STATUS),
721 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT4_STATUS)); 721 bus_space_read_4(sc->sc_iot, sc->sc_ioh, GMAC_INT4_STATUS));
722 aprint_debug_dev(sc->sc_dev, "gmac_intr: exit rv=%d\n", rv); 722 aprint_debug_dev(sc->sc_dev, "gmac_intr: exit rv=%d\n", rv);

cvs diff -r1.83 -r1.84 src/sys/dev/ic/smc91cxx.c (expand / switch to unified diff)

--- src/sys/dev/ic/smc91cxx.c 2012/10/27 17:18:22 1.83
+++ src/sys/dev/ic/smc91cxx.c 2013/06/11 16:57:05 1.84
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: smc91cxx.c,v 1.83 2012/10/27 17:18:22 chs Exp $ */ 1/* $NetBSD: smc91cxx.c,v 1.84 2013/06/11 16:57:05 msaitoh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center. 9 * NASA Ames Research Center.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -61,27 +61,27 @@ @@ -61,27 +61,27 @@
61 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 * 62 *
63 * from FreeBSD Id: if_sn.c,v 1.4 1996/03/18 15:47:16 gardner Exp 63 * from FreeBSD Id: if_sn.c,v 1.4 1996/03/18 15:47:16 gardner Exp
64 */ 64 */
65 65
66/* 66/*
67 * Core driver for the SMC 91Cxx family of Ethernet chips. 67 * Core driver for the SMC 91Cxx family of Ethernet chips.
68 * 68 *
69 * Memory allocation interrupt logic is drived from an SMC 91C90 driver 69 * Memory allocation interrupt logic is drived from an SMC 91C90 driver
70 * written for NetBSD/amiga by Michael Hitch. 70 * written for NetBSD/amiga by Michael Hitch.
71 */ 71 */
72 72
73#include <sys/cdefs.h> 73#include <sys/cdefs.h>
74__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.83 2012/10/27 17:18:22 chs Exp $"); 74__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.84 2013/06/11 16:57:05 msaitoh Exp $");
75 75
76#include "opt_inet.h" 76#include "opt_inet.h"
77 77
78#include <sys/param.h> 78#include <sys/param.h>
79#include <sys/systm.h> 79#include <sys/systm.h>
80#include <sys/mbuf.h> 80#include <sys/mbuf.h>
81#include <sys/syslog.h> 81#include <sys/syslog.h>
82#include <sys/socket.h> 82#include <sys/socket.h>
83#include <sys/device.h> 83#include <sys/device.h>
84#include <sys/kernel.h> 84#include <sys/kernel.h>
85#include <sys/malloc.h> 85#include <sys/malloc.h>
86#include <sys/ioctl.h> 86#include <sys/ioctl.h>
87#include <sys/errno.h> 87#include <sys/errno.h>
@@ -1092,27 +1092,27 @@ smc91cxx_intr(void *arg) @@ -1092,27 +1092,27 @@ smc91cxx_intr(void *arg)
1092 /* Multiple collisions. */ 1092 /* Multiple collisions. */
1093 ifp->if_collisions += (card_stats & ECR_MCOLN_MASK) >> 4; 1093 ifp->if_collisions += (card_stats & ECR_MCOLN_MASK) >> 4;
1094 1094
1095 SMC_SELECT_BANK(sc, 2); 1095 SMC_SELECT_BANK(sc, 2);
1096 1096
1097 ifp->if_timer = 0; 1097 ifp->if_timer = 0;
1098 } 1098 }
1099 1099
1100 if (sc->sc_chipid == CHIP_91C111 && sc->sc_internal_phy && 1100 if (sc->sc_chipid == CHIP_91C111 && sc->sc_internal_phy &&
1101 (status & IM_MD_INT)) { 1101 (status & IM_MD_INT)) {
1102 /* 1102 /*
1103 * Internal PHY status change 1103 * Internal PHY status change
1104 */ 1104 */
1105 mii_tick(&sc->sc_mii); 1105 mii_pollstat(&sc->sc_mii);
1106 } 1106 }
1107 1107
1108 /* 1108 /*
1109 * Other errors. Reset the interface. 1109 * Other errors. Reset the interface.
1110 */ 1110 */
1111 if (status & IM_EPH_INT) { 1111 if (status & IM_EPH_INT) {
1112 smc91cxx_stop(sc); 1112 smc91cxx_stop(sc);
1113 smc91cxx_init(sc); 1113 smc91cxx_init(sc);
1114 } 1114 }
1115 1115
1116 /* 1116 /*
1117 * Attempt to queue more packets for transmission. 1117 * Attempt to queue more packets for transmission.
1118 */ 1118 */