This commit implements 10/100 Mbit Ethernet support in the mimxrt port. The following boards are configured without ETH network: - MIMXRT1010_EVK - Teensy 4.0 The following boards are configured with ETH network: - MIMXRT1020_EVK - MIMXRT1050_EVK - MIMXRT1060_EVK - MIMXRT1064_EVK - Teensy 4.1 Ethernet support tested with TEENSY 4.1, MIMRTX1020_EVK and MIMXRT1050_EVK. Build tested with Teensy 4.0 and MIMXRT1010_EVK to be still working. Compiles and builds properly for MIMXRT1060_EVK and MIMXRT1064_EVK, but not tested lacking suitable boards. Tested functions are: - ping works bothway - simple UDP transfer works bothway - ntptime works - the ftp server works - secure socker works - telnet and webrepl works The MAC address is 0x02 plus 5 bytes from the manifacturing info field, which can be considered as unique per device. Some boards do not wire the RESET and INT pin of the PHY transceiver. For operation, these are not required. If they are defined, they will be used.
164 lines
5.0 KiB
C
164 lines
5.0 KiB
C
/*
|
|
* Copyright 2020 NXP
|
|
* All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/*****************************************************************************
|
|
* PHY DP83825 driver change log
|
|
*****************************************************************************/
|
|
|
|
/*!
|
|
@page driver_log Driver Change Log
|
|
|
|
@section phyksz8081 PHYDP83825
|
|
The current PHYDP83825 driver version is 2.0.0.
|
|
|
|
- 2.0.0
|
|
- Initial version.
|
|
*/
|
|
|
|
#ifndef _FSL_DP83825_H_
|
|
#define _FSL_DP83825_H_
|
|
|
|
#include "fsl_phy.h"
|
|
|
|
/*!
|
|
* @addtogroup phy_driver
|
|
* @{
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
* Definitions
|
|
******************************************************************************/
|
|
|
|
/*! @brief PHY driver version */
|
|
#define FSL_PHY_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
|
|
|
|
/*! @brief PHY operations structure. */
|
|
extern const phy_operations_t phydp83825_ops;
|
|
|
|
/*******************************************************************************
|
|
* API
|
|
******************************************************************************/
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*!
|
|
* @name PHY Driver
|
|
* @{
|
|
*/
|
|
|
|
/*!
|
|
* @brief Initializes PHY.
|
|
*
|
|
* This function initialize PHY.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param config Pointer to structure of phy_config_t.
|
|
* @retval kStatus_Success PHY initialization succeeds
|
|
* @retval kStatus_Fail PHY initialization fails
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_Init(phy_handle_t *handle, const phy_config_t *config);
|
|
|
|
/*!
|
|
* @brief PHY Write function. This function writes data over the SMI to
|
|
* the specified PHY register. This function is called by all PHY interfaces.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param phyReg The PHY register.
|
|
* @param data The data written to the PHY register.
|
|
* @retval kStatus_Success PHY write success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_Write(phy_handle_t *handle, uint32_t phyReg, uint32_t data);
|
|
|
|
/*!
|
|
* @brief PHY Read function. This interface read data over the SMI from the
|
|
* specified PHY register. This function is called by all PHY interfaces.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param phyReg The PHY register.
|
|
* @param dataPtr The address to store the data read from the PHY register.
|
|
* @retval kStatus_Success PHY read success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_Read(phy_handle_t *handle, uint32_t phyReg, uint32_t *dataPtr);
|
|
|
|
/*!
|
|
* @brief Gets the PHY auto-negotiation status.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param status The auto-negotiation status of the PHY.
|
|
* - true the auto-negotiation is over.
|
|
* - false the auto-negotiation is on-going or not started.
|
|
* @retval kStatus_Success PHY gets status success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_GetAutoNegotiationStatus(phy_handle_t *handle, bool *status);
|
|
|
|
/*!
|
|
* @brief Gets the PHY link status.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param status The link up or down status of the PHY.
|
|
* - true the link is up.
|
|
* - false the link is down.
|
|
* @retval kStatus_Success PHY gets link status success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_GetLinkStatus(phy_handle_t *handle, bool *status);
|
|
|
|
/*!
|
|
* @brief Gets the PHY link speed and duplex.
|
|
*
|
|
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
|
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param speed The address of PHY link speed.
|
|
* @param duplex The link duplex of PHY.
|
|
* @retval kStatus_Success PHY gets link speed and duplex success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_GetLinkSpeedDuplex(phy_handle_t *handle, phy_speed_t *speed, phy_duplex_t *duplex);
|
|
|
|
/*!
|
|
* @brief Sets the PHY link speed and duplex.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param speed Specified PHY link speed.
|
|
* @param duplex Specified PHY link duplex.
|
|
* @retval kStatus_Success PHY gets status success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_SetLinkSpeedDuplex(phy_handle_t *handle, phy_speed_t speed, phy_duplex_t duplex);
|
|
|
|
/*!
|
|
* @brief Enables/disables PHY loopback.
|
|
*
|
|
* @param handle PHY device handle.
|
|
* @param mode The loopback mode to be enabled, please see "phy_loop_t".
|
|
* All loopback modes should not be set together, when one loopback mode is set
|
|
* another should be disabled.
|
|
* @param speed PHY speed for loopback mode.
|
|
* @param enable True to enable, false to disable.
|
|
* @retval kStatus_Success PHY loopback success
|
|
* @retval kStatus_PHY_SMIVisitTimeout PHY SMI visit time out
|
|
*/
|
|
status_t PHY_DP83825_EnableLoopback(phy_handle_t *handle, phy_loop_t mode, phy_speed_t speed, bool enable);
|
|
|
|
/* @} */
|
|
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
/*! @}*/
|
|
|
|
#endif /* _FSL_DP83825_H_ */
|