xlphy.c (95722) | xlphy.c (95723) |
---|---|
1/* $NetBSD: exphy.c,v 1.16 1999/04/23 04:24:32 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, --- 74 unchanged lines hidden (view full) --- 83#include <dev/mii/mii.h> 84#include <dev/mii/miivar.h> 85#include <dev/mii/miidevs.h> 86 87#include "miibus_if.h" 88 89#if !defined(lint) 90static const char rcsid[] = | 1/* $NetBSD: exphy.c,v 1.16 1999/04/23 04:24:32 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, --- 74 unchanged lines hidden (view full) --- 83#include <dev/mii/mii.h> 84#include <dev/mii/miivar.h> 85#include <dev/mii/miidevs.h> 86 87#include "miibus_if.h" 88 89#if !defined(lint) 90static const char rcsid[] = |
91 "$FreeBSD: head/sys/dev/mii/exphy.c 95722 2002-04-29 13:07:38Z phk $"; | 91 "$FreeBSD: head/sys/dev/mii/exphy.c 95723 2002-04-29 13:35:31Z phk $"; |
92#endif 93 94static int exphy_probe (device_t); 95static int exphy_attach (device_t); 96 97static device_method_t exphy_methods[] = { 98 /* device interface */ 99 DEVMETHOD(device_probe, exphy_probe), --- 89 unchanged lines hidden (view full) --- 189 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), 190 BMCR_LOOP|BMCR_S100); 191 192 exphy_reset(sc); 193 194 sc->mii_capabilities = 195 PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 196 device_printf(dev, " "); | 92#endif 93 94static int exphy_probe (device_t); 95static int exphy_attach (device_t); 96 97static device_method_t exphy_methods[] = { 98 /* device interface */ 99 DEVMETHOD(device_probe, exphy_probe), --- 89 unchanged lines hidden (view full) --- 189 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), 190 BMCR_LOOP|BMCR_S100); 191 192 exphy_reset(sc); 193 194 sc->mii_capabilities = 195 PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 196 device_printf(dev, " "); |
197 mii_add_media(sc); | 197 mii_phy_add_media(sc); |
198 printf("\n"); 199#undef ADD 200 MIIBUS_MEDIAINIT(sc->mii_dev); 201 return(0); 202} 203 204static int 205exphy_service(sc, mii, cmd) --- 15 unchanged lines hidden (view full) --- 221 222 case MII_MEDIACHG: 223 /* 224 * If the interface is not up, don't do anything. 225 */ 226 if ((mii->mii_ifp->if_flags & IFF_UP) == 0) 227 break; 228 | 198 printf("\n"); 199#undef ADD 200 MIIBUS_MEDIAINIT(sc->mii_dev); 201 return(0); 202} 203 204static int 205exphy_service(sc, mii, cmd) --- 15 unchanged lines hidden (view full) --- 221 222 case MII_MEDIACHG: 223 /* 224 * If the interface is not up, don't do anything. 225 */ 226 if ((mii->mii_ifp->if_flags & IFF_UP) == 0) 227 break; 228 |
229 switch (IFM_SUBTYPE(ife->ifm_media)) { 230 case IFM_AUTO: 231 /* 232 * If we're already in auto mode, just return. 233 */ 234 if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) 235 return (0); 236 (void) mii_phy_auto(sc, 1); 237 break; 238 case IFM_100_T4: 239 /* 240 * XXX Not supported as a manual setting right now. 241 */ 242 return (EINVAL); 243 default: 244 /* 245 * BMCR data is stored in the ifmedia entry. 246 */ 247 PHY_WRITE(sc, MII_ANAR, 248 mii_anar(ife->ifm_media)); 249 PHY_WRITE(sc, MII_BMCR, ife->ifm_data); 250 } | 229 mii_phy_setmedia(sc); |
251 break; 252 253 case MII_TICK: 254 /* 255 * Is the interface even up? 256 */ 257 if ((mii->mii_ifp->if_flags & IFF_UP) == 0) 258 return (0); --- 15 unchanged lines hidden (view full) --- 274 ukphy_status(sc); 275 276 /* Callback if something changed. */ 277 mii_phy_update(sc, cmd); 278 return (0); 279} 280 281static void | 230 break; 231 232 case MII_TICK: 233 /* 234 * Is the interface even up? 235 */ 236 if ((mii->mii_ifp->if_flags & IFF_UP) == 0) 237 return (0); --- 15 unchanged lines hidden (view full) --- 253 ukphy_status(sc); 254 255 /* Callback if something changed. */ 256 mii_phy_update(sc, cmd); 257 return (0); 258} 259 260static void |
282exphy_reset(sc) 283 struct mii_softc *sc; | 261exphy_reset(struct mii_softc *sc) |
284{ 285 286 mii_phy_reset(sc); 287 288 /* 289 * XXX 3Com PHY doesn't set the BMCR properly after 290 * XXX reset, which breaks autonegotiation. 291 */ 292 PHY_WRITE(sc, MII_BMCR, BMCR_S100|BMCR_AUTOEN|BMCR_FDX); 293} | 262{ 263 264 mii_phy_reset(sc); 265 266 /* 267 * XXX 3Com PHY doesn't set the BMCR properly after 268 * XXX reset, which breaks autonegotiation. 269 */ 270 PHY_WRITE(sc, MII_BMCR, BMCR_S100|BMCR_AUTOEN|BMCR_FDX); 271} |