The MII Management interface is used to access PHY registers. These PHYs can either be internal or external to the FPGA. In SGMII and 1000BASE-X modes, the FPGA contains a single PHY. The details of PHY registers can be found in their respective documents. More details are added based on the IEEE standard. For 1000BASE-X PCS/PMA Management registers, see the 1G/2.5G Ethernet PCS/PMA or SGMII LogiCORE IP Product Guide (PG047).
The value of the PHYAD and REGAD fields in the MII Management Control register determines which PHY registers are accessed. Each PHY, internal or external, should have a unique 5-bit PHY address excluding 00000 which is defined as a broadcast PHY address. The MII Management interface is defined in IEEE Std 802.3, Clause 22 as a two-wire interface with a shared bidirectional serial data bus and a clock with a maximum permitted frequency of 2.5 MHz. As a result, MII Management access can take many AXI4-Lite clock cycles to complete.
To write to a PHY register, the data must be written to the MII Management Data Write register. The PHY address (PHYAD) and PHY register (REGAD) are written to the MII Management Control register. Setting the Initiate bit in the MII Management Control register starts the operation. The format of the PHYAD and REGAD in the MII Management Control register is shown in the following figure.
To read from a PHY register, the PHY address and register number are written to the MII Management Control register. Setting the Initiate bit in the MII Management Control register starts the operation. When the operation completes, the PHY register value is available in the MII Management Read Data register. To access the internal 1G/2.5G Ethernet PCS/PMA or SGMII registers, the PHYAD should match that value set by the parameter C_PHYADDR.
The following table provides an example of a PHY register write through the MII Management Interface.
Register | Access | Value | Activity |
---|---|---|---|
MIIM Write Data register | WO | 0x0000ABCD | Write the value that is written to the PHY register (0xABCD in this case). |
MII Management Control register | WO | 0x01024800 | Initiate the write to the MII Management Control register by setting the PHYAD (00001), REGAD(00010), OP (01), and Initiate bit (1). |
MII Management Control register | RO | 0x01024880 | Poll the MII Management Control register bit 7. When set to 1, the data has been written. |
Register | Access | Value | Activity |
---|---|---|---|
MII Management Control register | WO | 0x01028800 | Initiate the write to the MII Management Control register by setting the PHYAD (00001), REGAD(00001), OP (10), and Initiate bit (1). |
MII Management Control register | RO | 0x01028880 | Poll the MII Management Control register bit 7. When set to 1, the read data is available. |
MII Management Read Data register | RO | Read data provided by PHY register. |
After a transfer has been initiated on the MDIO interface, it is also possible to access a non-MDIO register in the memory space normally. The MDIO transfer has completed when the RDY bit in the MII Management Control register is 1. This bit can either be polled, or the interrupt can be monitored.
If the MII Management Control register is rewritten in an attempt to start a new transfer, the data is captured; however, the transfer does not take place until the current transaction completes. If the previous transaction was a read, the read data is valid when the first transaction completes. If the previous transaction was a write, the MII Management Write Data register can be written after the first transaction completes. The MII Management Control register should be checked to ensure all MDIO transactions have been completed before accessing the data or initiating a transfer.