Mon Dec 12 07:04:31 2016 UTC ()
Pull up following revision(s) (requested by msaitoh in ticket #1301):
	sys/dev/mii/inphy.c: revision 1.55
	sys/dev/mii/makphy.c: revision 1.42
	sys/dev/mii/ikphy.c: revision 1.12
	sys/dev/mii/atphy.c: revision 1.18
	sys/dev/mii/ihphy.c: revision 1.10
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,rev}.


(snj)
diff -r1.16.2.1 -r1.16.2.2 src/sys/dev/mii/atphy.c
diff -r1.8 -r1.8.2.1 src/sys/dev/mii/ihphy.c
diff -r1.10 -r1.10.2.1 src/sys/dev/mii/ikphy.c
diff -r1.53 -r1.53.2.1 src/sys/dev/mii/inphy.c
diff -r1.40 -r1.40.2.1 src/sys/dev/mii/makphy.c

cvs diff -r1.16.2.1 -r1.16.2.2 src/sys/dev/mii/atphy.c (expand / switch to unified diff)

--- src/sys/dev/mii/atphy.c 2015/11/04 18:19:58 1.16.2.1
+++ src/sys/dev/mii/atphy.c 2016/12/12 07:04:31 1.16.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atphy.c,v 1.16.2.1 2015/11/04 18:19:58 riz Exp $ */ 1/* $NetBSD: atphy.c,v 1.16.2.2 2016/12/12 07:04:31 snj Exp $ */
2/* $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $ */ 2/* $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> 5 * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice unmodified, this list of conditions, and the following 12 * notice unmodified, this list of conditions, and the following
13 * disclaimer. 13 * disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31/* 31/*
32 * Driver for the Attansic F1 10/100/1000 PHY. 32 * Driver for the Attansic F1 10/100/1000 PHY.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.16.2.1 2015/11/04 18:19:58 riz Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.16.2.2 2016/12/12 07:04:31 snj Exp $");
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/socket.h> 42#include <sys/socket.h>
43 43
44#include <net/if.h> 44#include <net/if.h>
45#include <net/if_media.h> 45#include <net/if_media.h>
46 46
47#include <dev/mii/mii.h> 47#include <dev/mii/mii.h>
48#include <dev/mii/miivar.h> 48#include <dev/mii/miivar.h>
49#include <dev/mii/miidevs.h> 49#include <dev/mii/miidevs.h>
@@ -136,26 +136,29 @@ atphy_attach(device_t parent, device_t s @@ -136,26 +136,29 @@ atphy_attach(device_t parent, device_t s
136 struct mii_softc *sc = device_private(self); 136 struct mii_softc *sc = device_private(self);
137 struct mii_attach_args *ma = aux; 137 struct mii_attach_args *ma = aux;
138 struct mii_data *mii = ma->mii_data; 138 struct mii_data *mii = ma->mii_data;
139 const struct mii_phydesc *mpd; 139 const struct mii_phydesc *mpd;
140 uint16_t bmsr; 140 uint16_t bmsr;
141 141
142 mpd = mii_phy_match(ma, etphys); 142 mpd = mii_phy_match(ma, etphys);
143 aprint_naive(": Media interface\n"); 143 aprint_naive(": Media interface\n");
144 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); 144 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
145 145
146 sc->mii_dev = self; 146 sc->mii_dev = self;
147 sc->mii_inst = mii->mii_instance; 147 sc->mii_inst = mii->mii_instance;
148 sc->mii_phy = ma->mii_phyno; 148 sc->mii_phy = ma->mii_phyno;
 149 sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 150 sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
 151 sc->mii_mpd_rev = MII_REV(ma->mii_id2);
149 sc->mii_funcs = &atphy_funcs; 152 sc->mii_funcs = &atphy_funcs;
150 sc->mii_pdata = mii; 153 sc->mii_pdata = mii;
151 sc->mii_flags = ma->mii_flags; 154 sc->mii_flags = ma->mii_flags;
152 if (atphy_is_gige(mpd)) 155 if (atphy_is_gige(mpd))
153 sc->mii_anegticks = MII_ANEGTICKS_GIGE; 156 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
154 else 157 else
155 sc->mii_anegticks = MII_ANEGTICKS; 158 sc->mii_anegticks = MII_ANEGTICKS;
156 159
157 sc->mii_flags |= MIIF_NOLOOP; 160 sc->mii_flags |= MIIF_NOLOOP;
158 161
159 PHY_RESET(sc); 162 PHY_RESET(sc);
160 163
161 bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); 164 bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);

cvs diff -r1.8 -r1.8.2.1 src/sys/dev/mii/ihphy.c (expand / switch to unified diff)

--- src/sys/dev/mii/ihphy.c 2014/06/16 16:48:16 1.8
+++ src/sys/dev/mii/ihphy.c 2016/12/12 07:04:31 1.8.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ihphy.c,v 1.8 2014/06/16 16:48:16 msaitoh Exp $ */ 1/* $NetBSD: ihphy.c,v 1.8.2.1 2016/12/12 07:04:31 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2000 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, and by Frank van der Linden. 9 * NASA Ames Research Center, and by Frank van der Linden.
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
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */ 55 */
56 56
57/* 57/*
58 * Driver for Intel's 82577 (Hanksville) Ethernet 10/100/1000 PHY 58 * Driver for Intel's 82577 (Hanksville) Ethernet 10/100/1000 PHY
59 * Data Sheet: http://download.intel.com/design/network/datashts/319439.pdf 59 * Data Sheet: http://download.intel.com/design/network/datashts/319439.pdf
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.8 2014/06/16 16:48:16 msaitoh Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.8.2.1 2016/12/12 07:04:31 snj Exp $");
64 64
65#include <sys/param.h> 65#include <sys/param.h>
66#include <sys/systm.h> 66#include <sys/systm.h>
67#include <sys/kernel.h> 67#include <sys/kernel.h>
68#include <sys/device.h> 68#include <sys/device.h>
69#include <sys/socket.h> 69#include <sys/socket.h>
70#include <sys/errno.h> 70#include <sys/errno.h>
71 71
72#include <net/if.h> 72#include <net/if.h>
73#include <net/if_media.h> 73#include <net/if_media.h>
74 74
75#include <dev/mii/mii.h> 75#include <dev/mii/mii.h>
76#include <dev/mii/miivar.h> 76#include <dev/mii/miivar.h>
@@ -122,26 +122,29 @@ ihphyattach(device_t parent, device_t se @@ -122,26 +122,29 @@ ihphyattach(device_t parent, device_t se
122 struct mii_softc *sc = device_private(self); 122 struct mii_softc *sc = device_private(self);
123 struct mii_attach_args *ma = aux; 123 struct mii_attach_args *ma = aux;
124 struct mii_data *mii = ma->mii_data; 124 struct mii_data *mii = ma->mii_data;
125 const struct mii_phydesc *mpd; 125 const struct mii_phydesc *mpd;
126 int reg; 126 int reg;
127 127
128 mpd = mii_phy_match(ma, ihphys); 128 mpd = mii_phy_match(ma, ihphys);
129 aprint_naive(": Media interface\n"); 129 aprint_naive(": Media interface\n");
130 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); 130 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
131 131
132 sc->mii_dev = self; 132 sc->mii_dev = self;
133 sc->mii_inst = mii->mii_instance; 133 sc->mii_inst = mii->mii_instance;
134 sc->mii_phy = ma->mii_phyno; 134 sc->mii_phy = ma->mii_phyno;
 135 sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 136 sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
 137 sc->mii_mpd_rev = MII_REV(ma->mii_id2);
135 sc->mii_funcs = &ihphy_funcs; 138 sc->mii_funcs = &ihphy_funcs;
136 sc->mii_pdata = mii; 139 sc->mii_pdata = mii;
137 sc->mii_flags = ma->mii_flags; 140 sc->mii_flags = ma->mii_flags;
138 sc->mii_anegticks = MII_ANEGTICKS; 141 sc->mii_anegticks = MII_ANEGTICKS;
139 142
140 PHY_RESET(sc); 143 PHY_RESET(sc);
141 144
142 sc->mii_capabilities = 145 sc->mii_capabilities =
143 PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 146 PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
144 if (sc->mii_capabilities & BMSR_EXTSTAT) 147 if (sc->mii_capabilities & BMSR_EXTSTAT)
145 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); 148 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
146 aprint_normal_dev(self, ""); 149 aprint_normal_dev(self, "");
147 if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && 150 if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&

cvs diff -r1.10 -r1.10.2.1 src/sys/dev/mii/ikphy.c (expand / switch to unified diff)

--- src/sys/dev/mii/ikphy.c 2014/06/16 16:48:16 1.10
+++ src/sys/dev/mii/ikphy.c 2016/12/12 07:04:31 1.10.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ikphy.c,v 1.10 2014/06/16 16:48:16 msaitoh Exp $ */ 1/* $NetBSD: ikphy.c,v 1.10.2.1 2016/12/12 07:04:31 snj Exp $ */
2 2
3/******************************************************************************* 3/*******************************************************************************
4Copyright (c) 2001-2005, Intel Corporation  4Copyright (c) 2001-2005, Intel Corporation
5All rights reserved. 5All rights reserved.
6 6
7Redistribution and use in source and binary forms, with or without  7Redistribution and use in source and binary forms, with or without
8modification, are permitted provided that the following conditions are met: 8modification, are permitted provided that the following conditions are met:
9 9
10 1. Redistributions of source code must retain the above copyright notice,  10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. 11 this list of conditions and the following disclaimer.
12 12
13 2. Redistributions in binary form must reproduce the above copyright  13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the  14 notice, this list of conditions and the following disclaimer in the
@@ -49,27 +49,27 @@ POSSIBILITY OF SUCH DAMAGE. @@ -49,27 +49,27 @@ POSSIBILITY OF SUCH DAMAGE.
49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */ 55 */
56 56
57/* 57/*
58 * driver for Intel's i82563 ethernet 10/100/1000 PHY 58 * driver for Intel's i82563 ethernet 10/100/1000 PHY
59 */ 59 */
60 60
61#include <sys/cdefs.h> 61#include <sys/cdefs.h>
62__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.10 2014/06/16 16:48:16 msaitoh Exp $"); 62__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.10.2.1 2016/12/12 07:04:31 snj Exp $");
63 63
64#include <sys/param.h> 64#include <sys/param.h>
65#include <sys/systm.h> 65#include <sys/systm.h>
66#include <sys/kernel.h> 66#include <sys/kernel.h>
67#include <sys/device.h> 67#include <sys/device.h>
68#include <sys/socket.h> 68#include <sys/socket.h>
69#include <sys/errno.h> 69#include <sys/errno.h>
70 70
71#include <net/if.h> 71#include <net/if.h>
72#include <net/if_media.h> 72#include <net/if_media.h>
73 73
74#include <dev/mii/mii.h> 74#include <dev/mii/mii.h>
75#include <dev/mii/miivar.h> 75#include <dev/mii/miivar.h>
@@ -115,26 +115,29 @@ ikphyattach(device_t parent, device_t se @@ -115,26 +115,29 @@ ikphyattach(device_t parent, device_t se
115{ 115{
116 struct mii_softc *sc = device_private(self); 116 struct mii_softc *sc = device_private(self);
117 struct mii_attach_args *ma = aux; 117 struct mii_attach_args *ma = aux;
118 struct mii_data *mii = ma->mii_data; 118 struct mii_data *mii = ma->mii_data;
119 const struct mii_phydesc *mpd; 119 const struct mii_phydesc *mpd;
120 120
121 mpd = mii_phy_match(ma, ikphys); 121 mpd = mii_phy_match(ma, ikphys);
122 aprint_naive(": Media interface\n"); 122 aprint_naive(": Media interface\n");
123 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); 123 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
124 124
125 sc->mii_dev = self; 125 sc->mii_dev = self;
126 sc->mii_inst = mii->mii_instance; 126 sc->mii_inst = mii->mii_instance;
127 sc->mii_phy = ma->mii_phyno; 127 sc->mii_phy = ma->mii_phyno;
 128 sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 129 sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
 130 sc->mii_mpd_rev = MII_REV(ma->mii_id2);
128 sc->mii_funcs = &ikphy_funcs; 131 sc->mii_funcs = &ikphy_funcs;
129 sc->mii_pdata = mii; 132 sc->mii_pdata = mii;
130 sc->mii_flags = ma->mii_flags; 133 sc->mii_flags = ma->mii_flags;
131 sc->mii_anegticks = MII_ANEGTICKS; 134 sc->mii_anegticks = MII_ANEGTICKS;
132 135
133 PHY_RESET(sc); 136 PHY_RESET(sc);
134 137
135 sc->mii_capabilities = 138 sc->mii_capabilities =
136 PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 139 PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
137 if (sc->mii_capabilities & BMSR_EXTSTAT) 140 if (sc->mii_capabilities & BMSR_EXTSTAT)
138 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); 141 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
139 aprint_normal_dev(self, ""); 142 aprint_normal_dev(self, "");
140 if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && 143 if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&

cvs diff -r1.53 -r1.53.2.1 src/sys/dev/mii/inphy.c (expand / switch to unified diff)

--- src/sys/dev/mii/inphy.c 2014/06/16 16:48:16 1.53
+++ src/sys/dev/mii/inphy.c 2016/12/12 07:04:31 1.53.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: inphy.c,v 1.53 2014/06/16 16:48:16 msaitoh Exp $ */ 1/* $NetBSD: inphy.c,v 1.53.2.1 2016/12/12 07:04:31 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2000 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
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */ 55 */
56 56
57/* 57/*
58 * driver for Intel's i82555 ethernet 10/100 PHY 58 * driver for Intel's i82555 ethernet 10/100 PHY
59 * Data Sheet available from www.intel.com 59 * Data Sheet available from www.intel.com
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.53 2014/06/16 16:48:16 msaitoh Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.53.2.1 2016/12/12 07:04:31 snj Exp $");
64 64
65#include <sys/param.h> 65#include <sys/param.h>
66#include <sys/systm.h> 66#include <sys/systm.h>
67#include <sys/kernel.h> 67#include <sys/kernel.h>
68#include <sys/device.h> 68#include <sys/device.h>
69#include <sys/socket.h> 69#include <sys/socket.h>
70#include <sys/errno.h> 70#include <sys/errno.h>
71 71
72#include <net/if.h> 72#include <net/if.h>
73#include <net/if_media.h> 73#include <net/if_media.h>
74 74
75#include <dev/mii/mii.h> 75#include <dev/mii/mii.h>
76#include <dev/mii/miivar.h> 76#include <dev/mii/miivar.h>
@@ -127,26 +127,29 @@ inphyattach(device_t parent, device_t se @@ -127,26 +127,29 @@ inphyattach(device_t parent, device_t se
127{ 127{
128 struct mii_softc *sc = device_private(self); 128 struct mii_softc *sc = device_private(self);
129 struct mii_attach_args *ma = aux; 129 struct mii_attach_args *ma = aux;
130 struct mii_data *mii = ma->mii_data; 130 struct mii_data *mii = ma->mii_data;
131 const struct mii_phydesc *mpd; 131 const struct mii_phydesc *mpd;
132 132
133 mpd = mii_phy_match(ma, inphys); 133 mpd = mii_phy_match(ma, inphys);
134 aprint_naive(": Media interface\n"); 134 aprint_naive(": Media interface\n");
135 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); 135 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
136 136
137 sc->mii_dev = self; 137 sc->mii_dev = self;
138 sc->mii_inst = mii->mii_instance; 138 sc->mii_inst = mii->mii_instance;
139 sc->mii_phy = ma->mii_phyno; 139 sc->mii_phy = ma->mii_phyno;
 140 sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 141 sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
 142 sc->mii_mpd_rev = MII_REV(ma->mii_id2);
140 sc->mii_funcs = &inphy_funcs; 143 sc->mii_funcs = &inphy_funcs;
141 sc->mii_pdata = mii; 144 sc->mii_pdata = mii;
142 sc->mii_flags = ma->mii_flags; 145 sc->mii_flags = ma->mii_flags;
143 sc->mii_anegticks = MII_ANEGTICKS; 146 sc->mii_anegticks = MII_ANEGTICKS;
144 147
145 PHY_RESET(sc); 148 PHY_RESET(sc);
146 149
147 sc->mii_capabilities = 150 sc->mii_capabilities =
148 PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 151 PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
149 aprint_normal_dev(self, ""); 152 aprint_normal_dev(self, "");
150 if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) 153 if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
151 aprint_error("no media present"); 154 aprint_error("no media present");
152 else 155 else

cvs diff -r1.40 -r1.40.2.1 src/sys/dev/mii/makphy.c (expand / switch to unified diff)

--- src/sys/dev/mii/makphy.c 2014/06/16 16:48:16 1.40
+++ src/sys/dev/mii/makphy.c 2016/12/12 07:04:31 1.40.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: makphy.c,v 1.40 2014/06/16 16:48:16 msaitoh Exp $ */ 1/* $NetBSD: makphy.c,v 1.40.2.1 2016/12/12 07:04:31 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2000, 2001 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
@@ -49,27 +49,27 @@ @@ -49,27 +49,27 @@
49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */ 55 */
56 56
57/* 57/*
58 * Driver for the Marvell 88E1000 ``Alaska'' 10/100/1000 PHY. 58 * Driver for the Marvell 88E1000 ``Alaska'' 10/100/1000 PHY.
59 */ 59 */
60 60
61#include <sys/cdefs.h> 61#include <sys/cdefs.h>
62__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.40 2014/06/16 16:48:16 msaitoh Exp $"); 62__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.40.2.1 2016/12/12 07:04:31 snj Exp $");
63 63
64#include <sys/param.h> 64#include <sys/param.h>
65#include <sys/systm.h> 65#include <sys/systm.h>
66#include <sys/kernel.h> 66#include <sys/kernel.h>
67#include <sys/device.h> 67#include <sys/device.h>
68#include <sys/socket.h> 68#include <sys/socket.h>
69#include <sys/errno.h> 69#include <sys/errno.h>
70 70
71#include <net/if.h> 71#include <net/if.h>
72#include <net/if_media.h> 72#include <net/if_media.h>
73 73
74#include <dev/mii/mii.h> 74#include <dev/mii/mii.h>
75#include <dev/mii/miivar.h> 75#include <dev/mii/miivar.h>
@@ -144,27 +144,29 @@ makphymatch(device_t parent, cfdata_t ma @@ -144,27 +144,29 @@ makphymatch(device_t parent, cfdata_t ma
144static void 144static void
145makphyattach(device_t parent, device_t self, void *aux) 145makphyattach(device_t parent, device_t self, void *aux)
146{ 146{
147 struct mii_softc *sc = device_private(self); 147 struct mii_softc *sc = device_private(self);
148 struct mii_attach_args *ma = aux; 148 struct mii_attach_args *ma = aux;
149 struct mii_data *mii = ma->mii_data; 149 struct mii_data *mii = ma->mii_data;
150 const struct mii_phydesc *mpd; 150 const struct mii_phydesc *mpd;
151 151
152 mpd = mii_phy_match(ma, makphys); 152 mpd = mii_phy_match(ma, makphys);
153 aprint_naive(": Media interface\n"); 153 aprint_naive(": Media interface\n");
154 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); 154 aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
155 155
156 sc->mii_dev = self; 156 sc->mii_dev = self;
 157 sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
157 sc->mii_mpd_model = MII_MODEL(ma->mii_id2); 158 sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
 159 sc->mii_mpd_rev = MII_REV(ma->mii_id2);
158 sc->mii_inst = mii->mii_instance; 160 sc->mii_inst = mii->mii_instance;
159 sc->mii_phy = ma->mii_phyno; 161 sc->mii_phy = ma->mii_phyno;
160 sc->mii_funcs = &makphy_funcs; 162 sc->mii_funcs = &makphy_funcs;
161 sc->mii_pdata = mii; 163 sc->mii_pdata = mii;
162 sc->mii_flags = ma->mii_flags; 164 sc->mii_flags = ma->mii_flags;
163 sc->mii_anegticks = MII_ANEGTICKS; 165 sc->mii_anegticks = MII_ANEGTICKS;
164 166
165 switch (sc->mii_mpd_model) { 167 switch (sc->mii_mpd_model) {
166 case MII_MODEL_xxMARVELL_E1011: 168 case MII_MODEL_xxMARVELL_E1011:
167 case MII_MODEL_xxMARVELL_E1112: 169 case MII_MODEL_xxMARVELL_E1112:
168 if (PHY_READ(sc, MII_MAKPHY_ESSR) & ESSR_FIBER_LINK) 170 if (PHY_READ(sc, MII_MAKPHY_ESSR) & ESSR_FIBER_LINK)
169 sc->mii_flags |= MIIF_HAVEFIBER; 171 sc->mii_flags |= MIIF_HAVEFIBER;
170 break; 172 break;