Deleted Added
full compact
brgphy.c (160076) brgphy.c (160078)
1/*-
2 * Copyright (c) 2000
3 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000
3 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 160076 2006-07-03 02:53:40Z yongari $");
34__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 160078 2006-07-03 08:01:27Z yongari $");
35
36/*
37 * Driver for the Broadcom BCR5400 1000baseTX PHY. Speed is always
38 * 1000mbps; all we need to negotiate here is full or half duplex.
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 50 unchanged lines hidden (view full) ---

93static void brgphy_reset(struct mii_softc *);
94static void brgphy_loop(struct mii_softc *);
95static void bcm5401_load_dspcode(struct mii_softc *);
96static void bcm5411_load_dspcode(struct mii_softc *);
97static void bcm5703_load_dspcode(struct mii_softc *);
98static void bcm5750_load_dspcode(struct mii_softc *);
99static int brgphy_mii_model;
100
35
36/*
37 * Driver for the Broadcom BCR5400 1000baseTX PHY. Speed is always
38 * 1000mbps; all we need to negotiate here is full or half duplex.
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 50 unchanged lines hidden (view full) ---

93static void brgphy_reset(struct mii_softc *);
94static void brgphy_loop(struct mii_softc *);
95static void bcm5401_load_dspcode(struct mii_softc *);
96static void bcm5411_load_dspcode(struct mii_softc *);
97static void bcm5703_load_dspcode(struct mii_softc *);
98static void bcm5750_load_dspcode(struct mii_softc *);
99static int brgphy_mii_model;
100
101static const struct mii_phydesc brgphys[] = {
102 MII_PHY_DESC(xxBROADCOM, BCM5400),
103 MII_PHY_DESC(xxBROADCOM, BCM5401),
104 MII_PHY_DESC(xxBROADCOM, BCM5411),
105 MII_PHY_DESC(xxBROADCOM, BCM5701),
106 MII_PHY_DESC(xxBROADCOM, BCM5703),
107 MII_PHY_DESC(xxBROADCOM, BCM5704),
108 MII_PHY_DESC(xxBROADCOM, BCM5705),
109 MII_PHY_DESC(xxBROADCOM, BCM5750),
110 MII_PHY_DESC(xxBROADCOM, BCM5714),
111 MII_PHY_DESC(xxBROADCOM, BCM5780),
112 MII_PHY_DESC(xxBROADCOM, BCM5706C),
113 MII_PHY_DESC(xxBROADCOM, BCM5708C),
114 MII_PHY_END
115};
116
101static int
102brgphy_probe(device_t dev)
103{
104 struct mii_attach_args *ma;
117static int
118brgphy_probe(device_t dev)
119{
120 struct mii_attach_args *ma;
121 const struct mii_phydesc *mpd;
105
106 ma = device_get_ivars(dev);
122
123 ma = device_get_ivars(dev);
107
108 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
109 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5400) {
110 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5400);
111 return(BUS_PROBE_DEFAULT);
112 }
113
114 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
115 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5401) {
116 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5401);
117 return(BUS_PROBE_DEFAULT);
118 }
119
120 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
121 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5411) {
122 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5411);
123 return(BUS_PROBE_DEFAULT);
124 }
125
126 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
127 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5701) {
128 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5701);
129 return(BUS_PROBE_DEFAULT);
130 }
131
132 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
133 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5703) {
134 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5703);
135 return(BUS_PROBE_DEFAULT);
136 }
137
138 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
139 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5704) {
140 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5704);
141 return(BUS_PROBE_DEFAULT);
142 }
143
144 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
145 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5705) {
146 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5705);
147 return(BUS_PROBE_DEFAULT);
148 }
149
150 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
151 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5750) {
152 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5750);
153 return(BUS_PROBE_DEFAULT);
154 }
155
156 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
157 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5714) {
158 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5714);
159 return(BUS_PROBE_DEFAULT);
160 }
161
162 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
163 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5780) {
164 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5780);
124 mpd = mii_phy_match(ma, brgphys);
125 if (mpd != NULL) {
126 device_set_desc(dev, mpd->mpd_name);
165 return (BUS_PROBE_DEFAULT);
166 }
167
127 return (BUS_PROBE_DEFAULT);
128 }
129
168 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
169 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5706C) {
170 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5706C);
171 return(BUS_PROBE_DEFAULT);
172 }
173
174 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
175 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5708C) {
176 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5708C);
177 return(BUS_PROBE_DEFAULT);
178 }
179
180 return(ENXIO);
130 return (ENXIO);
181}
182
183static int
184brgphy_attach(device_t dev)
185{
186 struct mii_softc *sc;
187 struct mii_attach_args *ma;
188 struct mii_data *mii;

--- 541 unchanged lines hidden ---
131}
132
133static int
134brgphy_attach(device_t dev)
135{
136 struct mii_softc *sc;
137 struct mii_attach_args *ma;
138 struct mii_data *mii;

--- 541 unchanged lines hidden ---