shithub: front

ref: e1854c96324dddac6911f1b49d16d83ba9e8831d
dir: /sys/man/3/mii/

View raw version
.TH MII 3
.SH NAME
mii \- MII/MDIO/SMI PHY debug driver
.SH SYNOPSIS
.nf
.B bind '#Φ' /mnt/mii
.PP
.nf
.BI /mnt/mii/ bus / phy /ctl
.BI /mnt/mii/ bus / phy /mii
.BI /mnt/mii/ bus / phy /mmd
.SH DESCRIPTION
Ethernet hardware is usually split into media-access (MAC)
and PHY parts with a media-independent-interface (MII)
in between.
The MII has a electrical high-speed connection,
for the ethernet frames,
and a low-speed 2-wire serial connection
for PHY management.
There can be multiple PHYs on a single management bus.
.PP
Ethernet drivers can expose this PHY management bus
giving direct access to the PHYs.
.PP
On its top-level directory, the driver serves a
.I bus
directory, one per controller.
It is usually named by the the ethernet device
that registered it (like
.BI ether N
),
but it can be anything.
.PP
Inside each
.I bus
directory,
there appear
.I phy
directories,
named by their 5-bit bus address (phy number) in decimal:
.BR 0 - 31 .
.PP
Each
.I phy
directory contains the following files:
.BR ctl ,
.BR mii ,
.BR mmd .
.PP
The
.B ctl
file provides a textual representation of the phy status.
The following text commands can be written to it:
.TP
.B reset
Reset the phy
.TP
.B status
Update the phy status fields
.TP
.B autoneg
Restart auto-negotiation on the phy
.PP
The
.B mii
file allows direct access to the clause 22 registers.
The read/write offset is directly mapped to
the 5-bit register number:
.BR 0 - 31 .
Reads and writes needs to be exactly 2 bytes,
containing the 16-bit value, with the least
significant byte first.
.PP
The
.B mmd
file provides access to the clause 45 registers.
The lest significant 16 bits of the offset are mapped
to the register number (0-65535) and the top bits [16-20]
map to the device address. So accessing the
.BR ID1 / ID2
register
.B 1.1
and
.B 1.2
map to offsets
.B 0x10001
and
.B 0x10002
respectively.
.SH EXAMPLE
Read the ID1/ID2 registers:
.IP
.EX
bind '#Φ' /mnt/mii
io -f /mnt/mii/ether0/1/mii -Wr 1
io -f /mnt/mii/ether0/1/mii -Wr 2
.EE
.SH "SEE ALSO"
.IR io (1)
.IR ether (3)
.SH SOURCE
.B /sys/src/9/port/devmii.c
.br
.B /sys/src/9/port/ethermii.c