brgphy.c (273174) | brgphy.c (277093) |
---|---|
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 273174 2014-10-16 18:04:43Z davide $"); | 34__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 277093 2015-01-12 22:27:38Z glebius $"); |
35 36/* 37 * Driver for the Broadcom BCM54xx/57xx 1000baseTX PHY. 38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> --- 150 unchanged lines hidden (view full) --- 193/* Attach the PHY to the MII bus */ 194static int 195brgphy_attach(device_t dev) 196{ 197 struct brgphy_softc *bsc; 198 struct bge_softc *bge_sc = NULL; 199 struct bce_softc *bce_sc = NULL; 200 struct mii_softc *sc; | 35 36/* 37 * Driver for the Broadcom BCM54xx/57xx 1000baseTX PHY. 38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> --- 150 unchanged lines hidden (view full) --- 193/* Attach the PHY to the MII bus */ 194static int 195brgphy_attach(device_t dev) 196{ 197 struct brgphy_softc *bsc; 198 struct bge_softc *bge_sc = NULL; 199 struct bce_softc *bce_sc = NULL; 200 struct mii_softc *sc; |
201 if_t ifp; | |
202 203 bsc = device_get_softc(dev); 204 sc = &bsc->mii_sc; 205 206 mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, 207 &brgphy_funcs, 0); 208 209 bsc->serdes_flags = 0; | 201 202 bsc = device_get_softc(dev); 203 sc = &bsc->mii_sc; 204 205 mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, 206 &brgphy_funcs, 0); 207 208 bsc->serdes_flags = 0; |
210 ifp = sc->mii_pdata->mii_ifp; | |
211 212 /* Find the MAC driver associated with this PHY. */ | 209 210 /* Find the MAC driver associated with this PHY. */ |
213 if (strcmp(if_getdname(ifp), "bge") == 0) 214 bge_sc = if_getsoftc(ifp); 215 else if (strcmp(if_getdname(ifp), "bce") == 0) 216 bce_sc = if_getsoftc(ifp); | 211 if (mii_dev_mac_match(dev, "bge")) 212 bge_sc = mii_dev_mac_softc(dev); 213 else if (mii_dev_mac_match(dev, "bce")) 214 bce_sc = mii_dev_mac_softc(dev); |
217 218 /* Handle any special cases based on the PHY ID */ 219 switch (sc->mii_mpd_oui) { 220 case MII_OUI_BROADCOM: 221 switch (sc->mii_mpd_model) { 222 case MII_MODEL_BROADCOM_BCM5706: 223 case MII_MODEL_BROADCOM_BCM5714: 224 /* --- 703 unchanged lines hidden (view full) --- 928 break; 929 case MII_OUI_BROADCOM4: 930 return; 931 } 932 933 ifp = sc->mii_pdata->mii_ifp; 934 935 /* Find the driver associated with this PHY. */ | 215 216 /* Handle any special cases based on the PHY ID */ 217 switch (sc->mii_mpd_oui) { 218 case MII_OUI_BROADCOM: 219 switch (sc->mii_mpd_model) { 220 case MII_MODEL_BROADCOM_BCM5706: 221 case MII_MODEL_BROADCOM_BCM5714: 222 /* --- 703 unchanged lines hidden (view full) --- 926 break; 927 case MII_OUI_BROADCOM4: 928 return; 929 } 930 931 ifp = sc->mii_pdata->mii_ifp; 932 933 /* Find the driver associated with this PHY. */ |
936 if (strcmp(if_getdname(ifp), "bge") == 0) { 937 bge_sc = if_getsoftc(ifp); 938 } else if (strcmp(if_getdname(ifp), "bce") == 0) { 939 bce_sc = if_getsoftc(ifp); 940 } | 934 if (mii_phy_mac_match(sc, "bge")) 935 bge_sc = mii_phy_mac_softc(sc); 936 else if (mii_phy_mac_match(sc, "bce")) 937 bce_sc = mii_phy_mac_softc(sc); |
941 942 if (bge_sc) { 943 /* Fix up various bugs */ 944 if (bge_sc->bge_phy_flags & BGE_PHY_5704_A0_BUG) 945 brgphy_fixup_5704_a0_bug(sc); 946 if (bge_sc->bge_phy_flags & BGE_PHY_ADC_BUG) 947 brgphy_fixup_adc_bug(sc); 948 if (bge_sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM) --- 129 unchanged lines hidden --- | 938 939 if (bge_sc) { 940 /* Fix up various bugs */ 941 if (bge_sc->bge_phy_flags & BGE_PHY_5704_A0_BUG) 942 brgphy_fixup_5704_a0_bug(sc); 943 if (bge_sc->bge_phy_flags & BGE_PHY_ADC_BUG) 944 brgphy_fixup_adc_bug(sc); 945 if (bge_sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM) --- 129 unchanged lines hidden --- |