1/* $NetBSD: gentbi.c,v 1.15 2006/03/29 07:05:24 thorpej Exp $ */ 2 3/*- 4 * Copyright (c) 1998, 1999, 2000, 2001 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, --- 48 unchanged lines hidden (view full) --- 57/* 58 * Driver for generic ten-bit (1000BASE-SX) interfaces, built into 59 * many Gigabit Ethernet chips. 60 * 61 * All we have to do here is correctly report speed and duplex. 62 */ 63 64#include <sys/cdefs.h> |
65__FBSDID("$FreeBSD: head/sys/dev/mii/gentbi.c 221407 2011-05-03 19:51:29Z marius $"); |
66 67/* 68 * Driver for generic unknown ten-bit interfaces(1000BASE-{LX,SX} 69 * fiber interfaces). 70 */ 71 72#include <sys/param.h> 73#include <sys/systm.h> --- 32 unchanged lines hidden (view full) --- 106 sizeof(struct mii_softc) 107}; 108 109DRIVER_MODULE(gentbi, miibus, gentbi_driver, gentbi_devclass, 0, 0); 110 111static int gentbi_service(struct mii_softc *, struct mii_data *, int); 112static void gentbi_status(struct mii_softc *); 113 |
114static const struct mii_phy_funcs gentbi_funcs = { 115 gentbi_service, 116 gentbi_status, 117 mii_phy_reset 118}; 119 |
120static int 121gentbi_probe(device_t dev) 122{ 123 device_t parent; 124 struct mii_attach_args *ma; 125 int bmsr, extsr; 126 127 parent = device_get_parent(dev); --- 25 unchanged lines hidden (view full) --- 153 154 return (ENXIO); 155} 156 157static int 158gentbi_attach(device_t dev) 159{ 160 struct mii_softc *sc; |
161 162 sc = device_get_softc(dev); |
163 |
164 mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &gentbi_funcs, 0); |
165 |
166 PHY_RESET(sc); |
167 |
168 /* 169 * Mask out all media in the BMSR. We only are really interested 170 * in "auto". 171 */ 172 sc->mii_capabilities = |
173 PHY_READ(sc, MII_BMSR) & sc->mii_capmask & ~BMSR_MEDIAMASK; |
174 if (sc->mii_capabilities & BMSR_EXTSTAT) 175 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); 176 177 device_printf(dev, " "); 178 mii_phy_add_media(sc); 179 printf("\n"); 180 181 MIIBUS_MEDIAINIT(sc->mii_dev); --- 20 unchanged lines hidden (view full) --- 202 203 case MII_TICK: 204 if (mii_phy_tick(sc) == EJUSTRETURN) 205 return (0); 206 break; 207 } 208 209 /* Update the media status. */ |
210 PHY_STATUS(sc); |
211 212 /* Callback if something changed. */ 213 mii_phy_update(sc, cmd); 214 return (0); 215} 216 217static void 218gentbi_status(struct mii_softc *sc) --- 49 unchanged lines hidden --- |