Deleted Added
full compact
brgphy.c (146413) brgphy.c (150763)
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 146413 2005-05-19 21:08:59Z ps $");
34__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 150763 2005-09-30 19:39:27Z imp $");
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_loop(struct mii_softc *);
94static void bcm5401_load_dspcode(struct mii_softc *);
95static void bcm5411_load_dspcode(struct mii_softc *);
96static void bcm5703_load_dspcode(struct mii_softc *);
97static void bcm5750_load_dspcode(struct mii_softc *);
98static int brgphy_mii_model;
99
100static int
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_loop(struct mii_softc *);
94static void bcm5401_load_dspcode(struct mii_softc *);
95static void bcm5411_load_dspcode(struct mii_softc *);
96static void bcm5703_load_dspcode(struct mii_softc *);
97static void bcm5750_load_dspcode(struct mii_softc *);
98static int brgphy_mii_model;
99
100static int
101brgphy_probe(dev)
102 device_t dev;
101brgphy_probe(device_t dev)
103{
104 struct mii_attach_args *ma;
105
106 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);

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

158 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5714);
159 return(0);
160 }
161
162 return(ENXIO);
163}
164
165static int
102{
103 struct mii_attach_args *ma;
104
105 ma = device_get_ivars(dev);
106
107 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
108 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5400) {
109 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5400);

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

157 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5714);
158 return(0);
159 }
160
161 return(ENXIO);
162}
163
164static int
166brgphy_attach(dev)
167 device_t dev;
165brgphy_attach(device_t dev)
168{
169 struct mii_softc *sc;
170 struct mii_attach_args *ma;
171 struct mii_data *mii;
172 const char *sep = "";
173 struct bge_softc *bge_sc;
174 int fast_ether_only = FALSE;
175

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

232#undef ADD
233#undef PRINT
234
235 MIIBUS_MEDIAINIT(sc->mii_dev);
236 return(0);
237}
238
239static int
166{
167 struct mii_softc *sc;
168 struct mii_attach_args *ma;
169 struct mii_data *mii;
170 const char *sep = "";
171 struct bge_softc *bge_sc;
172 int fast_ether_only = FALSE;
173

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

230#undef ADD
231#undef PRINT
232
233 MIIBUS_MEDIAINIT(sc->mii_dev);
234 return(0);
235}
236
237static int
240brgphy_service(sc, mii, cmd)
241 struct mii_softc *sc;
242 struct mii_data *mii;
243 int cmd;
238brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
244{
245 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
246 int reg, speed, gig;
247
248 switch (cmd) {
249 case MII_POLLSTAT:
250 /*
251 * If we're not polling our PHY instance, just return.

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

401 break;
402 }
403 }
404 mii_phy_update(sc, cmd);
405 return (0);
406}
407
408static void
239{
240 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
241 int reg, speed, gig;
242
243 switch (cmd) {
244 case MII_POLLSTAT:
245 /*
246 * If we're not polling our PHY instance, just return.

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

396 break;
397 }
398 }
399 mii_phy_update(sc, cmd);
400 return (0);
401}
402
403static void
409brgphy_status(sc)
410 struct mii_softc *sc;
404brgphy_status(struct mii_softc *sc)
411{
412 struct mii_data *mii = sc->mii_pdata;
413 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
414 int bmsr, bmcr;
415
416 mii->mii_media_status = IFM_AVALID;
417 mii->mii_media_active = IFM_ETHER;
418

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

464
465 mii->mii_media_active = ife->ifm_media;
466
467 return;
468}
469
470
471static int
405{
406 struct mii_data *mii = sc->mii_pdata;
407 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
408 int bmsr, bmcr;
409
410 mii->mii_media_status = IFM_AVALID;
411 mii->mii_media_active = IFM_ETHER;
412

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

458
459 mii->mii_media_active = ife->ifm_media;
460
461 return;
462}
463
464
465static int
472brgphy_mii_phy_auto(mii)
473 struct mii_softc *mii;
466brgphy_mii_phy_auto(struct mii_softc *mii)
474{
475 int ktcr = 0;
476
477 brgphy_loop(mii);
478 brgphy_reset(mii);
479 ktcr = BRGPHY_1000CTL_AFD|BRGPHY_1000CTL_AHD;
480 if (brgphy_mii_model == MII_MODEL_xxBROADCOM_BCM5701)
481 ktcr |= BRGPHY_1000CTL_MSE|BRGPHY_1000CTL_MSC;

--- 190 unchanged lines hidden ---
467{
468 int ktcr = 0;
469
470 brgphy_loop(mii);
471 brgphy_reset(mii);
472 ktcr = BRGPHY_1000CTL_AFD|BRGPHY_1000CTL_AHD;
473 if (brgphy_mii_model == MII_MODEL_xxBROADCOM_BCM5701)
474 ktcr |= BRGPHY_1000CTL_MSE|BRGPHY_1000CTL_MSC;

--- 190 unchanged lines hidden ---