brgphy.c (117659) | brgphy.c (118814) |
---|---|
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 --- 22 unchanged lines hidden (view full) --- 31 */ 32 33/* 34 * Driver for the Broadcom BCR5400 1000baseTX PHY. Speed is always 35 * 1000mbps; all we need to negotiate here is full or half duplex. 36 */ 37 38#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 --- 22 unchanged lines hidden (view full) --- 31 */ 32 33/* 34 * Driver for the Broadcom BCR5400 1000baseTX PHY. Speed is always 35 * 1000mbps; all we need to negotiate here is full or half duplex. 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 117659 2003-07-16 00:09:56Z wpaul $"); | 39__FBSDID("$FreeBSD: head/sys/dev/mii/brgphy.c 118814 2003-08-12 05:18:51Z wpaul $"); |
40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> 44#include <sys/socket.h> 45#include <sys/bus.h> 46 47#include <machine/clock.h> --- 5 unchanged lines hidden (view full) --- 53#include <dev/mii/miivar.h> 54#include "miidevs.h" 55 56#include <dev/mii/brgphyreg.h> 57#include <net/if_arp.h> 58#include <machine/bus.h> 59#include <dev/bge/if_bgereg.h> 60 | 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> 44#include <sys/socket.h> 45#include <sys/bus.h> 46 47#include <machine/clock.h> --- 5 unchanged lines hidden (view full) --- 53#include <dev/mii/miivar.h> 54#include "miidevs.h" 55 56#include <dev/mii/brgphyreg.h> 57#include <net/if_arp.h> 58#include <machine/bus.h> 59#include <dev/bge/if_bgereg.h> 60 |
61#include <pci/pcireg.h> 62#include <pci/pcivar.h> 63 |
|
61#include "miibus_if.h" 62 63static int brgphy_probe(device_t); 64static int brgphy_attach(device_t); 65 66static device_method_t brgphy_methods[] = { 67 /* device interface */ 68 DEVMETHOD(device_probe, brgphy_probe), --- 79 unchanged lines hidden (view full) --- 148static int 149brgphy_attach(dev) 150 device_t dev; 151{ 152 struct mii_softc *sc; 153 struct mii_attach_args *ma; 154 struct mii_data *mii; 155 const char *sep = ""; | 64#include "miibus_if.h" 65 66static int brgphy_probe(device_t); 67static int brgphy_attach(device_t); 68 69static device_method_t brgphy_methods[] = { 70 /* device interface */ 71 DEVMETHOD(device_probe, brgphy_probe), --- 79 unchanged lines hidden (view full) --- 151static int 152brgphy_attach(dev) 153 device_t dev; 154{ 155 struct mii_softc *sc; 156 struct mii_attach_args *ma; 157 struct mii_data *mii; 158 const char *sep = ""; |
159 struct bge_softc *bge_sc; 160 int fast_ether_only = FALSE; |
|
156 157 sc = device_get_softc(dev); 158 ma = device_get_ivars(dev); 159 sc->mii_dev = device_get_parent(dev); 160 mii = device_get_softc(sc->mii_dev); 161 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); 162 163 sc->mii_inst = mii->mii_instance; --- 17 unchanged lines hidden (view full) --- 181 brgphy_mii_model = MII_MODEL(ma->mii_id2); 182 brgphy_reset(sc); 183 184 185 sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 186 sc->mii_capabilities &= ~BMSR_ANEG; 187 device_printf(dev, " "); 188 mii_add_media(sc); | 161 162 sc = device_get_softc(dev); 163 ma = device_get_ivars(dev); 164 sc->mii_dev = device_get_parent(dev); 165 mii = device_get_softc(sc->mii_dev); 166 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); 167 168 sc->mii_inst = mii->mii_instance; --- 17 unchanged lines hidden (view full) --- 186 brgphy_mii_model = MII_MODEL(ma->mii_id2); 187 brgphy_reset(sc); 188 189 190 sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 191 sc->mii_capabilities &= ~BMSR_ANEG; 192 device_printf(dev, " "); 193 mii_add_media(sc); |
189 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst), 190 BRGPHY_BMCR_FDX); 191 PRINT(", 1000baseTX"); 192 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst), 0); 193 PRINT("1000baseTX-FDX"); | 194 195 /* The 590x chips are 10/100 only. */ 196 197 bge_sc = mii->mii_ifp->if_softc; 198 199 if (strcmp(mii->mii_ifp->if_name, "bge") == 0 && 200 pci_get_vendor(bge_sc->bge_dev) == BCOM_VENDORID && 201 (pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901 || 202 pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901A2)) 203 fast_ether_only = TRUE; 204 205 if (fast_ether_only == FALSE) { 206 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, 207 sc->mii_inst), BRGPHY_BMCR_FDX); 208 PRINT(", 1000baseTX"); 209 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 210 IFM_FDX, sc->mii_inst), 0); 211 PRINT("1000baseTX-FDX"); 212 } 213 |
194 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); 195 PRINT("auto"); 196 197 printf("\n"); 198#undef ADD 199#undef PRINT 200 201 MIIBUS_MEDIAINIT(sc->mii_dev); --- 402 unchanged lines hidden --- | 214 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); 215 PRINT("auto"); 216 217 printf("\n"); 218#undef ADD 219#undef PRINT 220 221 MIIBUS_MEDIAINIT(sc->mii_dev); --- 402 unchanged lines hidden --- |