AM261x MCU+ SDK: APIs for MDIO

| AM261x MCU+ SDK 26.00.00 |

Functions
APIs for MDIO
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the MDIO module.

## Functions
int32_t | MDIO_initClock (uint32_t baseAddr)
| This function initializes the MDIO clock. More...
int32_t | MDIO_phyRegRead (uint32_t baseAddr, void *pUserGroup, uint32_t phyAddr, uint32_t regNum, uint16_t *pData)
| This API reads an IEEE defined PHY register using MDIO. It should be called only after successful execution of MDIO_initClock(). More...
int32_t | MDIO_phyRegWrite (uint32_t baseAddr, void *pUserGroup, uint32_t phyAddr, uint32_t regNum, uint16_t wrVal)
| This API writes an IEEE defined PHY register using MDIO. It should be called only after successful execution of MDIO_initClock(). More...
int32_t | MDIO_phyExtRegRead (uint32_t baseAddr, void *pUserGroup, uint32_t phyAddr, uint32_t regNum, uint16_t *pData)
| This API reads an extended PHY register using MDIO. It should be called only after successful execution of MDIO_initClock(). More...
int32_t | MDIO_phyExtRegWrite (uint32_t baseAddr, void *pUserGroup, uint32_t phyAddr, uint32_t regNum, uint16_t wrVal)
| This API writes an extended PHY register using MDIO. It should be called only after successful execution of MDIO_initClock(). More...
int32_t | MDIO_phyLinkStatus (uint32_t baseAddr, uint32_t phyAddr)
| This API reads the link status of all PHY connected to this MDIO. The bit corresponding to the PHY address will be set if the PHY link is active. More...
int32_t | MDIO_enableLinkInterrupt (uint32_t mdioBaseAddress, uint32_t regInst, uint32_t phyAddr, uint8_t linkSel)
| Function to enable the MDIO Link change interrupt. More...

## MDIO Link Status Determination Select
#define | MDIO_LINKSEL_MDIO_MODE (0)
#define | MDIO_LINKSEL_MLINK_MODE (1)

## Macro Definition Documentation

## ◆ MDIO_LINKSEL_MDIO_MODE

#define MDIO_LINKSEL_MDIO_MODE (0)

Macro to select MDIO mode of Link detection

## ◆ MDIO_LINKSEL_MLINK_MODE

#define MDIO_LINKSEL_MLINK_MODE (1)

Macro to select MLINK mode of Link detection

## Function Documentation

## ◆ MDIO_initClock()

int32_t MDIO_initClock | ( | uint32_t | baseAddr | ) |

This function initializes the MDIO clock.

Parameters

  baseAddr | Base Address of the MDIO module

Returns
  SystemP_SUCCESS in case of success, SystemP_FAILURE otherwise

## ◆ MDIO_phyRegRead()

int32_t MDIO_phyRegRead | ( | uint32_t | baseAddr,
|  | void * | pUserGroup,
|  | uint32_t | phyAddr,
|  | uint32_t | regNum,
|  | uint16_t * | pData
| ) |  |

This API reads an IEEE defined PHY register using MDIO. It should be called only after successful execution of MDIO_initClock().

Parameters

  baseAddr | Base Address of the MDIO module
  pUserGroup | Pointer to uint32_t storing user group to be used while accessing PHY registers. Pass NULL for using default value
  phyAddr | PHY Address
  regNum | Register Number to be read.
  pData | Pointer where the read value shall be written

Returns
  SystemP_SUCCESS on success, else failure

## ◆ MDIO_phyRegWrite()

int32_t MDIO_phyRegWrite | ( | uint32_t | baseAddr,
|  | void * | pUserGroup,
|  | uint32_t | phyAddr,
|  | uint32_t | regNum,
|  | uint16_t | wrVal
| ) |  |

This API writes an IEEE defined PHY register using MDIO. It should be called only after successful execution of MDIO_initClock().

Parameters

  baseAddr | Base Address of the MDIO module
  pUserGroup | Pointer to uint32_t storing user group to be used while accessing PHY registers. Pass NULL for using default value
  phyAddr | PHY Address
  regNum | Register Number to be written
  wrVal | Value to be written

Returns
  SystemP_SUCCESS on success, else failure

## ◆ MDIO_phyExtRegRead()

int32_t MDIO_phyExtRegRead | ( | uint32_t | baseAddr,
|  | void * | pUserGroup,
|  | uint32_t | phyAddr,
|  | uint32_t | regNum,
|  | uint16_t * | pData
| ) |  |

This API reads an extended PHY register using MDIO. It should be called only after successful execution of MDIO_initClock().

Parameters

  baseAddr | Base Address of the MDIO module
  pUserGroup | Pointer to uint32_t storing user group to be used while accessing PHY registers. Pass NULL for using default value
  phyAddr | PHY Address
  regNum | Register Number to be read.
  pData | Pointer where the read value shall be written

Returns
  SystemP_SUCCESS on success, else failure

## ◆ MDIO_phyExtRegWrite()

int32_t MDIO_phyExtRegWrite | ( | uint32_t | baseAddr,
|  | void * | pUserGroup,
|  | uint32_t | phyAddr,
|  | uint32_t | regNum,
|  | uint16_t | wrVal
| ) |  |

This API writes an extended PHY register using MDIO. It should be called only after successful execution of MDIO_initClock().

Parameters

  baseAddr | Base Address of the MDIO module
  pUserGroup | Pointer to uint32_t storing user group to be used while accessing PHY registers. Pass NULL for using default value
  phyAddr | PHY Address
  regNum | Register Number to be written
  wrVal | Value to be written

Returns
  SystemP_SUCCESS on success, else failure

## ◆ MDIO_phyLinkStatus()

int32_t MDIO_phyLinkStatus | ( | uint32_t | baseAddr,
|  | uint32_t | phyAddr
| ) |  |

This API reads the link status of all PHY connected to this MDIO. The bit corresponding to the PHY address will be set if the PHY link is active.

Parameters

  baseAddr | Base Address of the MDIO module
  phyAddr | PHY Address

Returns
  SystemP_SUCCESS if link is up, else failure

## ◆ MDIO_enableLinkInterrupt()

int32_t MDIO_enableLinkInterrupt | ( | uint32_t | mdioBaseAddress,
|  | uint32_t | regInst,
|  | uint32_t | phyAddr,
|  | uint8_t | linkSel
| ) |  |

Function to enable the MDIO Link change interrupt.

Parameters

  mdioBaseAddress | Base Address of the MDIO module
  regInst | 0/1 to select the MDIO User PHY Select Register
  phyAddr | PHY Address
  linkSel | Flag to select to use MDIO mode or MLINK mode. Allowed values are MDIO_LinkSelModes

Returns
  SystemP_SUCCESS if link is up, else failure