Deleted Added
full compact
brgphy.c (166676) brgphy.c (166677)
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 166676 2007-02-12 23:33:05Z jkim $");
34__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 166677 2007-02-12 23:58:52Z jkim $");
35
36/*
37 * Driver for the Broadcom BCR5400 1000baseTX PHY.
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

98static void brgphy_reset(struct mii_softc *);
99static void brgphy_loop(struct mii_softc *);
100static void bcm5401_load_dspcode(struct mii_softc *);
101static void bcm5411_load_dspcode(struct mii_softc *);
102static void brgphy_fixup_5704_a0_bug(struct mii_softc *);
103static void brgphy_fixup_adc_bug(struct mii_softc *);
104static void brgphy_fixup_adjust_trim(struct mii_softc *);
105static void brgphy_fixup_ber_bug(struct mii_softc *);
35
36/*
37 * Driver for the Broadcom BCR5400 1000baseTX PHY.
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

98static void brgphy_reset(struct mii_softc *);
99static void brgphy_loop(struct mii_softc *);
100static void bcm5401_load_dspcode(struct mii_softc *);
101static void bcm5411_load_dspcode(struct mii_softc *);
102static void brgphy_fixup_5704_a0_bug(struct mii_softc *);
103static void brgphy_fixup_adc_bug(struct mii_softc *);
104static void brgphy_fixup_adjust_trim(struct mii_softc *);
105static void brgphy_fixup_ber_bug(struct mii_softc *);
106static void brgphy_fixup_crc_bug(struct mii_softc *);
106static void brgphy_fixup_jitter_bug(struct mii_softc *);
107static void brgphy_ethernet_wirespeed(struct mii_softc *);
108static void brgphy_jumbo_settings(struct mii_softc *, u_long);
109
110static const struct mii_phydesc brgphys[] = {
111 MII_PHY_DESC(xxBROADCOM, BCM5400),
112 MII_PHY_DESC(xxBROADCOM, BCM5401),
113 MII_PHY_DESC(xxBROADCOM, BCM5411),

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

607 };
608 int i;
609
610 for (i = 0; dspcode[i].reg != 0; i++)
611 PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
612}
613
614static void
107static void brgphy_fixup_jitter_bug(struct mii_softc *);
108static void brgphy_ethernet_wirespeed(struct mii_softc *);
109static void brgphy_jumbo_settings(struct mii_softc *, u_long);
110
111static const struct mii_phydesc brgphys[] = {
112 MII_PHY_DESC(xxBROADCOM, BCM5400),
113 MII_PHY_DESC(xxBROADCOM, BCM5401),
114 MII_PHY_DESC(xxBROADCOM, BCM5411),

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

608 };
609 int i;
610
611 for (i = 0; dspcode[i].reg != 0; i++)
612 PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
613}
614
615static void
616brgphy_fixup_crc_bug(struct mii_softc *sc)
617{
618 static const struct {
619 int reg;
620 uint16_t val;
621 } dspcode[] = {
622 { BRGPHY_MII_DSP_ADDR_REG, 0x0a75 },
623 { 0x1c, 0x8c68 },
624 { 0x1c, 0x8d68 },
625 { 0x1c, 0x8c68 },
626 { 0, 0 },
627 };
628 int i;
629
630 for (i = 0; dspcode[i].reg != 0; i++)
631 PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
632}
633
634static void
615brgphy_fixup_jitter_bug(struct mii_softc *sc)
616{
617 static const struct {
618 int reg;
619 uint16_t val;
620 } dspcode[] = {
621 { BRGPHY_MII_AUXCTL, 0x0c00 },
622 { BRGPHY_MII_DSP_ADDR_REG, 0x000a },

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

711 if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG)
712 brgphy_fixup_5704_a0_bug(sc);
713 if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG)
714 brgphy_fixup_adc_bug(sc);
715 if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM)
716 brgphy_fixup_adjust_trim(sc);
717 if (bge_sc->bge_flags & BGE_FLAG_BER_BUG)
718 brgphy_fixup_ber_bug(sc);
635brgphy_fixup_jitter_bug(struct mii_softc *sc)
636{
637 static const struct {
638 int reg;
639 uint16_t val;
640 } dspcode[] = {
641 { BRGPHY_MII_AUXCTL, 0x0c00 },
642 { BRGPHY_MII_DSP_ADDR_REG, 0x000a },

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

731 if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG)
732 brgphy_fixup_5704_a0_bug(sc);
733 if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG)
734 brgphy_fixup_adc_bug(sc);
735 if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM)
736 brgphy_fixup_adjust_trim(sc);
737 if (bge_sc->bge_flags & BGE_FLAG_BER_BUG)
738 brgphy_fixup_ber_bug(sc);
739 if (bge_sc->bge_flags & BGE_FLAG_CRC_BUG)
740 brgphy_fixup_crc_bug(sc);
719 if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG)
720 brgphy_fixup_jitter_bug(sc);
721
722 brgphy_jumbo_settings(sc, ifp->if_mtu);
723
724 /*
725 * Don't enable Ethernet@WireSpeed for the 5700 or the
726 * 5705 A1 and A2 chips.

--- 18 unchanged lines hidden ---
741 if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG)
742 brgphy_fixup_jitter_bug(sc);
743
744 brgphy_jumbo_settings(sc, ifp->if_mtu);
745
746 /*
747 * Don't enable Ethernet@WireSpeed for the 5700 or the
748 * 5705 A1 and A2 chips.

--- 18 unchanged lines hidden ---