Deleted Added
full compact
brgphy.c (129876) brgphy.c (135772)
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 129876 2004-05-30 17:57:46Z phk $");
34__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 135772 2004-09-24 22:24:33Z ps $");
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>

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

89static int brgphy_service(struct mii_softc *, struct mii_data *, int);
90static void brgphy_status(struct mii_softc *);
91static int brgphy_mii_phy_auto(struct mii_softc *);
92static void brgphy_reset(struct mii_softc *);
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 *);
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>

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

89static int brgphy_service(struct mii_softc *, struct mii_data *, int);
90static void brgphy_status(struct mii_softc *);
91static int brgphy_mii_phy_auto(struct mii_softc *);
92static void brgphy_reset(struct mii_softc *);
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 *);
97static int brgphy_mii_model;
98
99static int
100brgphy_probe(dev)
101 device_t dev;
102{
103 struct mii_attach_args *ma;
104

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

141 }
142
143 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
144 MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5705) {
145 device_set_desc(dev, MII_STR_xxBROADCOM_BCM5705);
146 return(0);
147 }
148
98static int brgphy_mii_model;
99
100static int
101brgphy_probe(dev)
102 device_t dev;
103{
104 struct mii_attach_args *ma;
105

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

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(0);
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(0);
154 }
155
149 return(ENXIO);
150}
151
152static int
153brgphy_attach(dev)
154 device_t dev;
155{
156 struct mii_softc *sc;

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

574 };
575 int i;
576
577 for (i = 0; dspcode[i].reg != 0; i++)
578 PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
579}
580
581static void
156 return(ENXIO);
157}
158
159static int
160brgphy_attach(dev)
161 device_t dev;
162{
163 struct mii_softc *sc;

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

581 };
582 int i;
583
584 for (i = 0; dspcode[i].reg != 0; i++)
585 PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
586}
587
588static void
589bcm5750_load_dspcode(struct mii_softc *sc)
590{
591 static const struct {
592 int reg;
593 u_int16_t val;
594 } dspcode[] = {
595 { 0x18, 0x0c00 },
596 { 0x17, 0x000a },
597 { 0x15, 0x310b },
598 { 0x17, 0x201f },
599 { 0x15, 0x9506 },
600 { 0x17, 0x401f },
601 { 0x15, 0x14e2 },
602 { 0x18, 0x0400 },
603 { 0, 0 },
604 };
605 int i;
606
607 for (i = 0; dspcode[i].reg != 0; i++)
608 PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
609}
610
611static void
582brgphy_reset(struct mii_softc *sc)
583{
584 u_int32_t val;
585 struct ifnet *ifp;
586 struct bge_softc *bge_sc;
587
588 mii_phy_reset(sc);
589

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

595 bcm5411_load_dspcode(sc);
596 break;
597 case MII_MODEL_xxBROADCOM_BCM5703:
598 bcm5703_load_dspcode(sc);
599 break;
600 case MII_MODEL_xxBROADCOM_BCM5704:
601 bcm5704_load_dspcode(sc);
602 break;
612brgphy_reset(struct mii_softc *sc)
613{
614 u_int32_t val;
615 struct ifnet *ifp;
616 struct bge_softc *bge_sc;
617
618 mii_phy_reset(sc);
619

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

625 bcm5411_load_dspcode(sc);
626 break;
627 case MII_MODEL_xxBROADCOM_BCM5703:
628 bcm5703_load_dspcode(sc);
629 break;
630 case MII_MODEL_xxBROADCOM_BCM5704:
631 bcm5704_load_dspcode(sc);
632 break;
633 case MII_MODEL_xxBROADCOM_BCM5750:
634 bcm5750_load_dspcode(sc);
635 break;
603 }
604
605 ifp = sc->mii_pdata->mii_ifp;
606 bge_sc = ifp->if_softc;
607
608 /*
609 * Don't enable Ethernet@WireSpeed for the 5700 or the
610 * 5705 A1 and A2 chips. Make sure we only do this test

--- 21 unchanged lines hidden ---
636 }
637
638 ifp = sc->mii_pdata->mii_ifp;
639 bge_sc = ifp->if_softc;
640
641 /*
642 * Don't enable Ethernet@WireSpeed for the 5700 or the
643 * 5705 A1 and A2 chips. Make sure we only do this test

--- 21 unchanged lines hidden ---