The following steps are performed by the application software or device driver to initialize the MDIO device:
- Configure the PREAMBLE and CLKDIV bits in the
MDIO Control register
(CPSW3_MDIO_CONTROL_REG).
- Enable the MDIO module by setting the ENABLE bit
in CPSW3_MDIO_CONTROL_REG.
- The MDIO PHY alive status register (MDIO
CPSW3_MDIO_ALIVE_REG) can be read in polling
fashion until a PHY connected to the system
responded, and the MDIO PHY link status register
(MDIO CPSW3_MDIO_LINK_REG) can determine whether
this PHY already has a link.
- Set the appropriate PHY addresses in the MDIO
user PHY select register
(CPSW3_MDIO_USER_GROUP_USER_PHY_SEL_REG_k, where k
= 0 or 1), and set the LINKINT_ENABLE bit to
enable a link change event interrupt if
desirable.
- Set the appropriate LINKSEL bit in the
CPSW3_MDIO_USER_GROUP_USER_PHY_SEL_REG_k register
(where k = 0 or 1).
- Set the appropriate USERINTMASKSET bit field in
the CPSW3_MDIO_USER_INT_MASK_SET_REG
register.
- If an interrupt on general MDIO register access
is desired, set the corresponding bit in the MDIO
user command complete interrupt mask set register
(MDIO CPSW3_MDIO_USER_INT_MASK_SET_REG) to use the
MDIO user access register (MDIO
CPSW3_MDIO_USER_GROUP_USER_ACCESS_REG_k, where k =
0 or 1).