MDIO(8)

NAME
mdio - Direct MDIO bus access

SYNOPSIS
mdio [bus [device [operation]]]
mdio [-h | -v]

DESCRIPTION
Without any arguments, all available MDIO buses are listed. Supplying only bus (see Buses) will list any Clause 22 addressable devices on it. Omitting operation prints a brief status message for the device (see Devices) if the driver supports it. Otherwise, perform operation (see Operations) on device attached to bus

  Options

-h  Print usage message and exit.

-v  Print version information and exit.

  Buses
Denoted by their sysfs names as listed in /sys/class/mdio_bus/. As these are typically very awkward to type, glob(3) patterns may be used to abbreviate them (see EXAMPLES)

  Devices
Multiple types of devices are supported via pluggable drivers. Different devices will use different addressing schemes. If you are unsure about which type of device you have, using the phy driver is probably a good bet if your PHY runs at speeds ≤ 1 Gbps. If your PHY is capable of speeds > 1 Gbps, you will most likely want to use the mmd driver.

The following devices are supported:

phy PHYAD
    Clause 22 (MDIO) PHY using address PHYAD.

    PHYAD
        := 0-31
    REG := 0-31

mmd PRTAD:DEVAD
    Clause 45 (XMDIO) MMD using address PRTAD:DEVAD.

    PRTAD
        := 0-31
    DEVAD
        := 0-31
    REG := 0-0xffff

mmd-c22 PRTAD:DEVAD
    Clause 45 (XMDIO) MMD, accessed over Clause 22 registers 13 and 14, using address PRTAD:DEVAD.

    PRTAD
        := 0-31
    DEVAD
        := 0-31
    REG := 0-0xffff

mva PHYAD
    Marvell Alaska (mv88e1xxx) paged PHY. Register 22 is a paging register used to expand the register space.

    PHYAD
        := 0-31
    REG := PAGE:0-31
    PAGE
        := 0-255|copper|fiber

mvls ID
    Marvell LinkStreet (mv88e6xxx) Ethernet switch. If ID = 0, single-chip addressing is used; if ID ≠ 0, multi-chip addressing is used.

    ID  := 0-31
    REG := PORT:0-31
    PORT
        := 0-31|g1|g2

xrs PHYAD
    Arrow/Flexibilis XRS700x Ethernet switch. Register space has a stride of 2, i.e. only even numbered registers are valid.

    PHYAD
        := 0-31
    REG := 0-0xffffffff

  Operations
The following operations are supported:

raw REG [DATA[/MASK]]
    Raw register access. Without DATA, REG is read. DATA without MASK will perform a single write to REG. DATA with MASK will perform a read/mask/write sequence.

    REG Determined by the device type (see Devices)
    DATA
        := 0-0xffff
    MASK
        := 0-0xffff

bench REG [DATA]
    Benchmark read performance. If DATA is supplied, it is written to REG, otherwise the current value in REG is read. REG is then read 1000 times. Any unexpected values are reported, along with the total time.

    REG Determined by the device type (see Devices)
    DATA
        := 0-0xffff

EXAMPLES

Show all available buses:

    ~# mdio
    30be0000.ethernet-1
    fixed-0

List all Clause 22 addressable devices on a bus (using glob(3) pattern to abbreviate bus name):

    ~# mdio 3*
     DEV      PHY-ID  LINK
    0x01  0x01410dd0  up

Read register 2 from PHY 1:

    ~# mdio 3* phy 1 raw 2
    0x0141

Perform a reset on PHY 1:

    ~# mdio 3* phy 1 raw 0 0x8000/0x7fff

Read register 0x1000 from MMD 4 on PHY 9:

    ~# mdio 3* mmd 9:4 raw 0x1000
    0x2040

Read status register from the copper page of an Alaska PHY:

    ~# mdio 3* mva 1 raw copper:1
    0x796d

Set the device number, of LinkStreet switch 4, to 10:

    ~# mdio 3* mvls 4 raw g1:28 0xa/0xfff0

SEE ALSO
mvls(8) mdio-netlink(9)

STANDARDS
IEEE Std 802.3-2018
•   Clause 22 (MDIO)
•   Clause 45 (XMDIO)

AUTHORS
Tobias Waldekranz <tobias@waldekranz.com>

CAVEATS
In addition to the userspace parts of mdio, the mdio-netlink(9) kernel module must also be installed.