ip1000phy.c (189566) | ip1000phy.c (189567) |
---|---|
1/*- 2 * Copyright (c) 2006, Pyun YongHyeon <yongari@FreeBSD.org> 3 * 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 --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006, Pyun YongHyeon <yongari@FreeBSD.org> 3 * 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 --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/mii/ip1000phy.c 189566 2009-03-09 08:09:06Z yongari $"); | 30__FBSDID("$FreeBSD: head/sys/dev/mii/ip1000phy.c 189567 2009-03-09 08:17:46Z yongari $"); |
31 32/* 33 * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY. 34 */ 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> --- 347 unchanged lines hidden (view full) --- 386 if ((mii->mii_media_active & IFM_1000_T) != 0) { 387 stat = PHY_READ(sc, IP1000PHY_MII_1000SR); 388 if ((stat & IP1000PHY_1000SR_MASTER) != 0) 389 mii->mii_media_active |= IFM_FLAG2; 390 } 391} 392 393static int | 31 32/* 33 * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY. 34 */ 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> --- 347 unchanged lines hidden (view full) --- 386 if ((mii->mii_media_active & IFM_1000_T) != 0) { 387 stat = PHY_READ(sc, IP1000PHY_MII_1000SR); 388 if ((stat & IP1000PHY_1000SR_MASTER) != 0) 389 mii->mii_media_active |= IFM_FLAG2; 390 } 391} 392 393static int |
394ip1000phy_mii_phy_auto(struct mii_softc *mii) | 394ip1000phy_mii_phy_auto(struct mii_softc *sc) |
395{ | 395{ |
396 struct ip1000phy_softc *isc; |
|
396 uint32_t reg; 397 | 397 uint32_t reg; 398 |
398 PHY_WRITE(mii, IP1000PHY_MII_ANAR, 399 IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX | | 399 isc = (struct ip1000phy_softc *)sc; 400 reg = 0; 401 if (isc->model == MII_MODEL_ICPLUS_IP1001) 402 reg = PHY_READ(sc, IP1000PHY_MII_ANAR); 403 reg |= IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX | |
400 IP1000PHY_ANAR_100TX | IP1000PHY_ANAR_100TX_FDX | | 404 IP1000PHY_ANAR_100TX | IP1000PHY_ANAR_100TX_FDX | |
401 IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE); | 405 IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE; 406 PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); 407 |
402 reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; 403 reg |= IP1000PHY_1000CR_MASTER; | 408 reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; 409 reg |= IP1000PHY_1000CR_MASTER; |
404 PHY_WRITE(mii, IP1000PHY_MII_1000CR, reg); 405 PHY_WRITE(mii, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | | 410 PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); 411 PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | |
406 IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); 407 408 return (EJUSTRETURN); 409} 410 411static void 412ip1000phy_load_dspcode(struct mii_softc *sc) 413{ --- 40 unchanged lines hidden --- | 412 IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); 413 414 return (EJUSTRETURN); 415} 416 417static void 418ip1000phy_load_dspcode(struct mii_softc *sc) 419{ --- 40 unchanged lines hidden --- |