nsphy.c (139749) | nsphy.c (150763) |
---|---|
1/* $NetBSD: nsphy.c,v 1.18 1999/07/14 23:57:36 thorpej Exp $ */ 2 3/*- 4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, --- 53 unchanged lines hidden (view full) --- 62 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 63 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 64 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 66 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 */ 68 69#include <sys/cdefs.h> | 1/* $NetBSD: nsphy.c,v 1.18 1999/07/14 23:57:36 thorpej Exp $ */ 2 3/*- 4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, --- 53 unchanged lines hidden (view full) --- 62 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 63 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 64 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 66 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 */ 68 69#include <sys/cdefs.h> |
70__FBSDID("$FreeBSD: head/sys/dev/mii/nsphy.c 139749 2005-01-06 01:43:34Z imp $"); | 70__FBSDID("$FreeBSD: head/sys/dev/mii/nsphy.c 150763 2005-09-30 19:39:27Z imp $"); |
71 72/* 73 * driver for National Semiconductor's DP83840A ethernet 10/100 PHY 74 * Data Sheet available from www.national.com 75 */ 76 77#include <sys/param.h> 78#include <sys/systm.h> --- 35 unchanged lines hidden (view full) --- 114}; 115 116DRIVER_MODULE(nsphy, miibus, nsphy_driver, nsphy_devclass, 0, 0); 117 118static int nsphy_service(struct mii_softc *, struct mii_data *, int); 119static void nsphy_status(struct mii_softc *); 120 121static int | 71 72/* 73 * driver for National Semiconductor's DP83840A ethernet 10/100 PHY 74 * Data Sheet available from www.national.com 75 */ 76 77#include <sys/param.h> 78#include <sys/systm.h> --- 35 unchanged lines hidden (view full) --- 114}; 115 116DRIVER_MODULE(nsphy, miibus, nsphy_driver, nsphy_devclass, 0, 0); 117 118static int nsphy_service(struct mii_softc *, struct mii_data *, int); 119static void nsphy_status(struct mii_softc *); 120 121static int |
122nsphy_probe(dev) 123 device_t dev; | 122nsphy_probe(device_t dev) |
124{ 125 struct mii_attach_args *ma; 126 127 ma = device_get_ivars(dev); 128 129 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_NATSEMI && 130 MII_MODEL(ma->mii_id2) == MII_MODEL_NATSEMI_DP83840) { 131 device_set_desc(dev, MII_STR_NATSEMI_DP83840); 132 } else 133 return (ENXIO); 134 135 return (0); 136} 137 138static int | 123{ 124 struct mii_attach_args *ma; 125 126 ma = device_get_ivars(dev); 127 128 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_NATSEMI && 129 MII_MODEL(ma->mii_id2) == MII_MODEL_NATSEMI_DP83840) { 130 device_set_desc(dev, MII_STR_NATSEMI_DP83840); 131 } else 132 return (ENXIO); 133 134 return (0); 135} 136 137static int |
139nsphy_attach(dev) 140 device_t dev; | 138nsphy_attach(device_t dev) |
141{ 142 struct mii_softc *sc; 143 struct mii_attach_args *ma; 144 struct mii_data *mii; 145 146 sc = device_get_softc(dev); 147 ma = device_get_ivars(dev); 148 sc->mii_dev = device_get_parent(dev); --- 35 unchanged lines hidden (view full) --- 184 printf("\n"); 185#undef ADD 186 187 MIIBUS_MEDIAINIT(sc->mii_dev); 188 return(0); 189} 190 191static int | 139{ 140 struct mii_softc *sc; 141 struct mii_attach_args *ma; 142 struct mii_data *mii; 143 144 sc = device_get_softc(dev); 145 ma = device_get_ivars(dev); 146 sc->mii_dev = device_get_parent(dev); --- 35 unchanged lines hidden (view full) --- 182 printf("\n"); 183#undef ADD 184 185 MIIBUS_MEDIAINIT(sc->mii_dev); 186 return(0); 187} 188 189static int |
192nsphy_service(sc, mii, cmd) 193 struct mii_softc *sc; 194 struct mii_data *mii; 195 int cmd; | 190nsphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) |
196{ 197 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; 198 int reg; 199 device_t parent; 200 201 switch (cmd) { 202 case MII_POLLSTAT: 203 /* --- 102 unchanged lines hidden (view full) --- 306 nsphy_status(sc); 307 308 /* Callback if something changed. */ 309 mii_phy_update(sc, cmd); 310 return (0); 311} 312 313static void | 191{ 192 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; 193 int reg; 194 device_t parent; 195 196 switch (cmd) { 197 case MII_POLLSTAT: 198 /* --- 102 unchanged lines hidden (view full) --- 301 nsphy_status(sc); 302 303 /* Callback if something changed. */ 304 mii_phy_update(sc, cmd); 305 return (0); 306} 307 308static void |
314nsphy_status(sc) 315 struct mii_softc *sc; | 309nsphy_status(struct mii_softc *sc) |
316{ 317 struct mii_data *mii = sc->mii_pdata; 318 int bmsr, bmcr, par, anlpar; 319 320 mii->mii_media_status = IFM_AVALID; 321 mii->mii_media_active = IFM_ETHER; 322 323 bmsr = PHY_READ(sc, MII_BMSR) | --- 65 unchanged lines hidden --- | 310{ 311 struct mii_data *mii = sc->mii_pdata; 312 int bmsr, bmcr, par, anlpar; 313 314 mii->mii_media_status = IFM_AVALID; 315 mii->mii_media_active = IFM_ETHER; 316 317 bmsr = PHY_READ(sc, MII_BMSR) | --- 65 unchanged lines hidden --- |