pnaphy.c (214263) | pnaphy.c (221407) |
---|---|
1/*- 2 * Copyright (c) 2000 Berkeley Software Design, Inc. 3 * Copyright (c) 1997, 1998, 1999, 2000 4 * Bill Paul <wpaul@osd.bsdi.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Berkeley Software Design, Inc. 3 * Copyright (c) 1997, 1998, 1999, 2000 4 * Bill Paul <wpaul@osd.bsdi.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/mii/pnaphy.c 214263 2010-10-24 11:38:25Z marius $"); | 35__FBSDID("$FreeBSD: head/sys/dev/mii/pnaphy.c 221407 2011-05-03 19:51:29Z marius $"); |
36 37/* 38 * driver for homePNA PHYs 39 * This is really just a stub that allows us to identify homePNA-based 40 * transceicers and display the link status. MII-based homePNA PHYs 41 * only support one media type and no autonegotiation. If we were 42 * really clever, we could tweak some of the vendor-specific registers 43 * to optimize the link. --- 36 unchanged lines hidden (view full) --- 80 sizeof(struct mii_softc) 81}; 82 83DRIVER_MODULE(pnaphy, miibus, pnaphy_driver, pnaphy_devclass, 0, 0); 84 85static int pnaphy_service(struct mii_softc *, struct mii_data *,int); 86 87static const struct mii_phydesc pnaphys[] = { | 36 37/* 38 * driver for homePNA PHYs 39 * This is really just a stub that allows us to identify homePNA-based 40 * transceicers and display the link status. MII-based homePNA PHYs 41 * only support one media type and no autonegotiation. If we were 42 * really clever, we could tweak some of the vendor-specific registers 43 * to optimize the link. --- 36 unchanged lines hidden (view full) --- 80 sizeof(struct mii_softc) 81}; 82 83DRIVER_MODULE(pnaphy, miibus, pnaphy_driver, pnaphy_devclass, 0, 0); 84 85static int pnaphy_service(struct mii_softc *, struct mii_data *,int); 86 87static const struct mii_phydesc pnaphys[] = { |
88 MII_PHY_DESC(AMD, 79c978), | 88 MII_PHY_DESC(yyAMD, 79c901home), |
89 MII_PHY_END 90}; 91 | 89 MII_PHY_END 90}; 91 |
92static const struct mii_phy_funcs pnaphy_funcs = { 93 pnaphy_service, 94 ukphy_status, 95 mii_phy_reset 96}; 97 |
|
92static int 93pnaphy_probe(device_t dev) 94{ 95 96 return (mii_phy_dev_probe(dev, pnaphys, BUS_PROBE_DEFAULT)); 97} 98 99static int 100pnaphy_attach(device_t dev) 101{ | 98static int 99pnaphy_probe(device_t dev) 100{ 101 102 return (mii_phy_dev_probe(dev, pnaphys, BUS_PROBE_DEFAULT)); 103} 104 105static int 106pnaphy_attach(device_t dev) 107{ |
102 struct mii_softc *sc; 103 struct mii_attach_args *ma; 104 struct mii_data *mii; | |
105 | 108 |
106 sc = device_get_softc(dev); 107 ma = device_get_ivars(dev); 108 sc->mii_dev = device_get_parent(dev); 109 mii = ma->mii_data; 110 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); 111 112 sc->mii_flags = miibus_get_flags(dev); 113 sc->mii_inst = mii->mii_instance++; 114 sc->mii_phy = ma->mii_phyno; 115 sc->mii_service = pnaphy_service; 116 sc->mii_pdata = mii; 117 118 sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; 119 120 mii_phy_reset(sc); 121 122 sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; 123 device_printf(dev, " "); 124 mii_phy_add_media(sc); 125 printf("\n"); 126 127 MIIBUS_MEDIAINIT(sc->mii_dev); | 109 mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_IS_HPNA | 110 MIIF_NOMANPAUSE, &pnaphy_funcs, 1); |
128 return (0); 129} 130 131static int 132pnaphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) 133{ 134 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; 135 --- 19 unchanged lines hidden (view full) --- 155 156 case MII_TICK: 157 if (mii_phy_tick(sc) == EJUSTRETURN) 158 return (0); 159 break; 160 } 161 162 /* Update the media status. */ | 111 return (0); 112} 113 114static int 115pnaphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) 116{ 117 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; 118 --- 19 unchanged lines hidden (view full) --- 138 139 case MII_TICK: 140 if (mii_phy_tick(sc) == EJUSTRETURN) 141 return (0); 142 break; 143 } 144 145 /* Update the media status. */ |
163 ukphy_status(sc); | 146 PHY_STATUS(sc); |
164 if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) 165 mii->mii_media_active = IFM_ETHER | IFM_HPNA_1; 166 167 /* Callback if something changed. */ 168 mii_phy_update(sc, cmd); 169 return (0); 170} | 147 if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) 148 mii->mii_media_active = IFM_ETHER | IFM_HPNA_1; 149 150 /* Callback if something changed. */ 151 mii_phy_update(sc, cmd); 152 return (0); 153} |