Deleted Added
sdiff udiff text old ( 146413 ) new ( 150763 )
full compact
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 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
101brgphy_probe(device_t dev)
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
165brgphy_attach(device_t dev)
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
238brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
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
404brgphy_status(struct mii_softc *sc)
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
466brgphy_mii_phy_auto(struct mii_softc *mii)
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 ---