The MDIO module includes a user access register
(MDIO CPSW_MDIO_USER_ACCESS_REG_k, where k = 0 or 1) to directly access a specified
PHY device. To read a PHY register, perform the following:
- Check to ensure that the GO bit in the MDIO user
access register (CPSW_MDIO_USER_ACCESS_REG_k, where k = 0 or 1) is cleared.
- Write to the GO, REGADR, and PHYADR bits in the
CPSW_MDIO_USER_ACCESS_REG_k register corresponding to the PHY and PHY register
SW wants to read.
- The read data value is available in the DATA bit
field in MDIO CPSW_MDIO_USER_ACCESS_REG_k register after the module completes
the read operation on the serial bus. Completion of the read operation can be
determined by polling the GO and ACK bits in CPSW_MDIO_USER_ACCESS_REG_k
register. After the GO bit has cleared, the ACK bit is set on a successful
read.
- Completion of the operation sets the
corresponding USERINTRAW bit (0 or 1) in the MDIO user command complete
interrupt register (CPSW_MDIO_USER_INT_RAW_REG) corresponding to MDIO
CPSW_MDIO_USER_ACCESS_REG_k used. If interrupts have been enabled on this bit
using the MDIO user command complete interrupt mask set register
(CPSW_MDIO_USER_INT_MASK_SET_REG), then the bit is also set in the MDIO user
command complete interrupt register (CPSW_MDIO_USER_INT_MASKED_REG) and an
interrupt is triggered on the host processor.