Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/dev/mii



Module Name:    src
Committed By:   msaitoh
Date:           Tue Feb 26 05:26:10 UTC 2019

Modified Files:
        src/sys/dev/mii: miivar.h rgephy.c

Log Message:
Add MI MII clause 45 MMD MDIO access macros via clause 22 indirect registers:

DESCRIPTION
    static inline int
    MMD_INDIRECT(struct mii_softc *sc, uint16_t daddr, uint16_t regnum):
        Setup MMD device address and register number. It also setup
        address incrementation function.

    static inline int
    MMD_INDIRECT_READ(struct mii_softc *sc, uint16_t daddr, uint16_t regnum,
      uint16_t *valp)):
        Do MMD_INDIRECT() and then read the register.

    static inline int
    MMD_INDIRECT_WRITE(struct mii_softc *sc, uint16_t daddr, uint16_t regnum,
      uint16_t val):
        Do MMD_INDIRECT() and then write the register.

RETURN VALUE
    Retruns 0 on success. Non-zero vaule on failure.

    Note that old PHYs have no indirect access registers. Accessing such
    devices with these functions cause timeout and return non-zero value
    (e.g. ETIMEDOUT).

EXAMPLE
        Read MMD Auto negotiation device's EEE advertisement register,
        drop 100BASE-TX support and write it.

        uint16_t eeadvert;

        /* Post increment is not required */
        MMD_INDIRECT_READ(sc, MDIO_MMD_AN | MMDACR_FN_DATA,
            MDIO_AN_EEEADVERT, &eeadvert);
        eeadvert &= ~AN_EEEADVERT_100_TX;

        /*
         * MMD device address and the register number are already set, so it's
         * enough to read MII_MMDACR.
         */
        PHY_WRITE(sc. MII_MMDACR, eeadvert);


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/mii/rgephy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index