world leader in high performance signal processing
Trace: » mii

Das U-Boot Media Independent Interface

Das U-Boot provides a command line option for banging directly on the Media Independent Interface bus. This allows people to poke PHYs directly (presumably for debugging purposes) via supported Ethernet MACs.

Note that not all Ethernet MAC drivers in U-Boot support the MDIO functions. The Blackfin EMAC driver does support it.

Configuration

In your board config, you simply need to enable:

#define CONFIG_CMD_MII

Usage

bfin> help mii
mii - MII utility commands

Usage:
mii device                     - list available devices
mii device <devname>           - set current device
mii info   <addr>              - display MII PHY info
mii read   <addr> <reg>        - read  MII PHY <addr> register <reg>
mii write  <addr> <reg> <data> - write MII PHY <addr> register <reg>
mii dump   <addr> <reg>        - pretty-print <addr> <reg> (0-5 only)
Addr and/or reg may be ranges, e.g. 2-7.

Device Selection

You first have to find a supported device, and then you have to select it. The first ethernet driver is selected by default.

bfin> mii device
MII devices: 'Blackfin EMAC'
Current device: 'Blackfin EMAC'

PHY Info

We can query the PHY at address 1:

bfin> mii info 1
PHY 0x01: OUI = 0x01F0, Model = 0x0A, Rev = 0x03,  10baseT, FDX

PHY Register Access

We can read registers directly from different PHYs. Here we read registers 0 through 4 from the PHY at address 1:

bfin> mii read 1 0
1000
bfin> mii read 1 1
782D
bfin> mii read 1 2
0007
bfin> mii read 1 3
C0A3
bfin> mii read 1 4
0DE1

Conversely, you can use mii write to program hex values directly into specific PHY registers.