aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/include/port.h
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/include/port.h')
-rw-r--r--target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/include/port.h959
1 files changed, 959 insertions, 0 deletions
diff --git a/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/include/port.h b/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/include/port.h
new file mode 100644
index 0000000000..fcac1bcb84
--- /dev/null
+++ b/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/include/port.h
@@ -0,0 +1,959 @@
+/*
+ * Copyright (C) 2013 Realtek Semiconductor Corp.
+ * All Rights Reserved.
+ *
+ * Unless you and Realtek execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2,
+ * available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+ *
+ * Purpose : RTL8367/RTL8367C switch high-level API
+ *
+ * Feature : The file includes port module high-layer API defination
+ *
+ */
+
+#ifndef __RTK_API_PORT_H__
+#define __RTK_API_PORT_H__
+
+/*
+ * Data Type Declaration
+ */
+
+#define PHY_CONTROL_REG 0
+#define PHY_STATUS_REG 1
+#define PHY_AN_ADVERTISEMENT_REG 4
+#define PHY_AN_LINKPARTNER_REG 5
+#define PHY_1000_BASET_CONTROL_REG 9
+#define PHY_1000_BASET_STATUS_REG 10
+#define PHY_RESOLVED_REG 26
+
+#define RTK_EFID_MAX 0x7
+
+#define RTK_FIBER_FORCE_1000M 3
+#define RTK_FIBER_FORCE_100M 5
+#define RTK_FIBER_FORCE_100M1000M 7
+
+#define RTK_INDRECT_ACCESS_CRTL 0x1f00
+#define RTK_INDRECT_ACCESS_STATUS 0x1f01
+#define RTK_INDRECT_ACCESS_ADDRESS 0x1f02
+#define RTK_INDRECT_ACCESS_WRITE_DATA 0x1f03
+#define RTK_INDRECT_ACCESS_READ_DATA 0x1f04
+#define RTK_INDRECT_ACCESS_DELAY 0x1f80
+#define RTK_INDRECT_ACCESS_BURST 0x1f81
+#define RTK_RW_MASK 0x2
+#define RTK_CMD_MASK 0x1
+#define RTK_PHY_BUSY_OFFSET 2
+
+
+typedef enum rtk_mode_ext_e
+{
+ MODE_EXT_DISABLE = 0,
+ MODE_EXT_RGMII,
+ MODE_EXT_MII_MAC,
+ MODE_EXT_MII_PHY,
+ MODE_EXT_TMII_MAC,
+ MODE_EXT_TMII_PHY,
+ MODE_EXT_GMII,
+ MODE_EXT_RMII_MAC,
+ MODE_EXT_RMII_PHY,
+ MODE_EXT_SGMII,
+ MODE_EXT_HSGMII,
+ MODE_EXT_1000X_100FX,
+ MODE_EXT_1000X,
+ MODE_EXT_100FX,
+ MODE_EXT_RGMII_2,
+ MODE_EXT_MII_MAC_2,
+ MODE_EXT_MII_PHY_2,
+ MODE_EXT_TMII_MAC_2,
+ MODE_EXT_TMII_PHY_2,
+ MODE_EXT_RMII_MAC_2,
+ MODE_EXT_RMII_PHY_2,
+ MODE_EXT_END
+} rtk_mode_ext_t;
+
+typedef enum rtk_port_duplex_e
+{
+ PORT_HALF_DUPLEX = 0,
+ PORT_FULL_DUPLEX,
+ PORT_DUPLEX_END
+} rtk_port_duplex_t;
+
+typedef enum rtk_port_linkStatus_e
+{
+ PORT_LINKDOWN = 0,
+ PORT_LINKUP,
+ PORT_LINKSTATUS_END
+} rtk_port_linkStatus_t;
+
+typedef struct rtk_port_mac_ability_s
+{
+ rtk_uint32 forcemode;
+ rtk_uint32 speed;
+ rtk_uint32 duplex;
+ rtk_uint32 link;
+ rtk_uint32 nway;
+ rtk_uint32 txpause;
+ rtk_uint32 rxpause;
+}rtk_port_mac_ability_t;
+
+typedef struct rtk_port_phy_ability_s
+{
+ rtk_uint32 AutoNegotiation; /*PHY register 0.12 setting for auto-negotiation process*/
+ rtk_uint32 Half_10; /*PHY register 4.5 setting for 10BASE-TX half duplex capable*/
+ rtk_uint32 Full_10; /*PHY register 4.6 setting for 10BASE-TX full duplex capable*/
+ rtk_uint32 Half_100; /*PHY register 4.7 setting for 100BASE-TX half duplex capable*/
+ rtk_uint32 Full_100; /*PHY register 4.8 setting for 100BASE-TX full duplex capable*/
+ rtk_uint32 Full_1000; /*PHY register 9.9 setting for 1000BASE-T full duplex capable*/
+ rtk_uint32 FC; /*PHY register 4.10 setting for flow control capability*/
+ rtk_uint32 AsyFC; /*PHY register 4.11 setting for asymmetric flow control capability*/
+} rtk_port_phy_ability_t;
+
+typedef rtk_uint32 rtk_port_phy_data_t; /* phy page */
+
+typedef enum rtk_port_phy_mdix_mode_e
+{
+ PHY_AUTO_CROSSOVER_MODE= 0,
+ PHY_FORCE_MDI_MODE,
+ PHY_FORCE_MDIX_MODE,
+ PHY_FORCE_MODE_END
+} rtk_port_phy_mdix_mode_t;
+
+typedef enum rtk_port_phy_mdix_status_e
+{
+ PHY_STATUS_AUTO_MDI_MODE= 0,
+ PHY_STATUS_AUTO_MDIX_MODE,
+ PHY_STATUS_FORCE_MDI_MODE,
+ PHY_STATUS_FORCE_MDIX_MODE,
+ PHY_STATUS_FORCE_MODE_END
+} rtk_port_phy_mdix_status_t;
+
+typedef rtk_uint32 rtk_port_phy_page_t; /* phy page */
+
+typedef enum rtk_port_phy_reg_e
+{
+ PHY_REG_CONTROL = 0,
+ PHY_REG_STATUS,
+ PHY_REG_IDENTIFIER_1,
+ PHY_REG_IDENTIFIER_2,
+ PHY_REG_AN_ADVERTISEMENT,
+ PHY_REG_AN_LINKPARTNER,
+ PHY_REG_1000_BASET_CONTROL = 9,
+ PHY_REG_1000_BASET_STATUS,
+ PHY_REG_END = 32
+} rtk_port_phy_reg_t;
+
+typedef enum rtk_port_phy_test_mode_e
+{
+ PHY_TEST_MODE_NORMAL= 0,
+ PHY_TEST_MODE_1,
+ PHY_TEST_MODE_2,
+ PHY_TEST_MODE_3,
+ PHY_TEST_MODE_4,
+ PHY_TEST_MODE_END
+} rtk_port_phy_test_mode_t;
+
+typedef enum rtk_port_speed_e
+{
+ PORT_SPEED_10M = 0,
+ PORT_SPEED_100M,
+ PORT_SPEED_1000M,
+ PORT_SPEED_500M,
+ PORT_SPEED_2500M,
+ PORT_SPEED_END
+} rtk_port_speed_t;
+
+typedef enum rtk_port_media_e
+{
+ PORT_MEDIA_COPPER = 0,
+ PORT_MEDIA_FIBER,
+ PORT_MEDIA_END
+}rtk_port_media_t;
+
+typedef struct rtk_rtctResult_s
+{
+ rtk_port_speed_t linkType;
+ union
+ {
+ struct fe_result_s
+ {
+ rtk_uint32 isRxShort;
+ rtk_uint32 isTxShort;
+ rtk_uint32 isRxOpen;
+ rtk_uint32 isTxOpen;
+ rtk_uint32 isRxMismatch;
+ rtk_uint32 isTxMismatch;
+ rtk_uint32 isRxLinedriver;
+ rtk_uint32 isTxLinedriver;
+ rtk_uint32 rxLen;
+ rtk_uint32 txLen;
+ } fe_result;
+
+ struct ge_result_s
+ {
+ rtk_uint32 channelAShort;
+ rtk_uint32 channelBShort;
+ rtk_uint32 channelCShort;
+ rtk_uint32 channelDShort;
+
+ rtk_uint32 channelAOpen;
+ rtk_uint32 channelBOpen;
+ rtk_uint32 channelCOpen;
+ rtk_uint32 channelDOpen;
+
+ rtk_uint32 channelAMismatch;
+ rtk_uint32 channelBMismatch;
+ rtk_uint32 channelCMismatch;
+ rtk_uint32 channelDMismatch;
+
+ rtk_uint32 channelALinedriver;
+ rtk_uint32 channelBLinedriver;
+ rtk_uint32 channelCLinedriver;
+ rtk_uint32 channelDLinedriver;
+
+ rtk_uint32 channelALen;
+ rtk_uint32 channelBLen;
+ rtk_uint32 channelCLen;
+ rtk_uint32 channelDLen;
+ } ge_result;
+ }result;
+} rtk_rtctResult_t;
+
+/* Function Name:
+ * rtk_port_phyAutoNegoAbility_set
+ * Description:
+ * Set ethernet PHY auto-negotiation desired ability.
+ * Input:
+ * port - port id.
+ * pAbility - Ability structure
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * If Full_1000 bit is set to 1, the AutoNegotiation will be automatic set to 1. While both AutoNegotiation and Full_1000 are set to 0, the PHY speed and duplex selection will
+ * be set as following 100F > 100H > 10F > 10H priority sequence.
+ */
+extern rtk_api_ret_t rtk_port_phyAutoNegoAbility_set(rtk_port_t port, rtk_port_phy_ability_t *pAbility);
+
+/* Function Name:
+ * rtk_port_phyAutoNegoAbility_get
+ * Description:
+ * Get PHY ability through PHY registers.
+ * Input:
+ * port - Port id.
+ * Output:
+ * pAbility - Ability structure
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * Get the capablity of specified PHY.
+ */
+extern rtk_api_ret_t rtk_port_phyAutoNegoAbility_get(rtk_port_t port, rtk_port_phy_ability_t *pAbility);
+
+/* Function Name:
+ * rtk_port_phyForceModeAbility_set
+ * Description:
+ * Set the port speed/duplex mode/pause/asy_pause in the PHY force mode.
+ * Input:
+ * port - port id.
+ * pAbility - Ability structure
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * While both AutoNegotiation and Full_1000 are set to 0, the PHY speed and duplex selection will
+ * be set as following 100F > 100H > 10F > 10H priority sequence.
+ */
+extern rtk_api_ret_t rtk_port_phyForceModeAbility_set(rtk_port_t port, rtk_port_phy_ability_t *pAbility);
+
+/* Function Name:
+ * rtk_port_phyForceModeAbility_get
+ * Description:
+ * Get PHY ability through PHY registers.
+ * Input:
+ * port - Port id.
+ * Output:
+ * pAbility - Ability structure
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * Get the capablity of specified PHY.
+ */
+extern rtk_api_ret_t rtk_port_phyForceModeAbility_get(rtk_port_t port, rtk_port_phy_ability_t *pAbility);
+
+/* Function Name:
+ * rtk_port_phyStatus_get
+ * Description:
+ * Get ethernet PHY linking status
+ * Input:
+ * port - Port id.
+ * Output:
+ * linkStatus - PHY link status
+ * speed - PHY link speed
+ * duplex - PHY duplex mode
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * API will return auto negotiation status of phy.
+ */
+extern rtk_api_ret_t rtk_port_phyStatus_get(rtk_port_t port, rtk_port_linkStatus_t *pLinkStatus, rtk_port_speed_t *pSpeed, rtk_port_duplex_t *pDuplex);
+
+/* Function Name:
+ * rtk_port_macForceLink_set
+ * Description:
+ * Set port force linking configuration.
+ * Input:
+ * port - port id.
+ * pPortability - port ability configuration
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * This API can set Port/MAC force mode properties.
+ */
+extern rtk_api_ret_t rtk_port_macForceLink_set(rtk_port_t port, rtk_port_mac_ability_t *pPortability);
+
+/* Function Name:
+ * rtk_port_macForceLink_get
+ * Description:
+ * Get port force linking configuration.
+ * Input:
+ * port - Port id.
+ * Output:
+ * pPortability - port ability configuration
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can get Port/MAC force mode properties.
+ */
+extern rtk_api_ret_t rtk_port_macForceLink_get(rtk_port_t port, rtk_port_mac_ability_t *pPortability);
+
+/* Function Name:
+ * rtk_port_macForceLinkExt_set
+ * Description:
+ * Set external interface force linking configuration.
+ * Input:
+ * port - external port ID
+ * mode - external interface mode
+ * pPortability - port ability configuration
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can set external interface force mode properties.
+ * The external interface can be set to:
+ * - MODE_EXT_DISABLE,
+ * - MODE_EXT_RGMII,
+ * - MODE_EXT_MII_MAC,
+ * - MODE_EXT_MII_PHY,
+ * - MODE_EXT_TMII_MAC,
+ * - MODE_EXT_TMII_PHY,
+ * - MODE_EXT_GMII,
+ * - MODE_EXT_RMII_MAC,
+ * - MODE_EXT_RMII_PHY,
+ * - MODE_EXT_SGMII,
+ * - MODE_EXT_HSGMII,
+ * - MODE_EXT_1000X_100FX,
+ * - MODE_EXT_1000X,
+ * - MODE_EXT_100FX,
+ */
+extern rtk_api_ret_t rtk_port_macForceLinkExt_set(rtk_port_t port, rtk_mode_ext_t mode, rtk_port_mac_ability_t *pPortability);
+
+/* Function Name:
+ * rtk_port_macForceLinkExt_get
+ * Description:
+ * Set external interface force linking configuration.
+ * Input:
+ * port - external port ID
+ * Output:
+ * pMode - external interface mode
+ * pPortability - port ability configuration
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can get external interface force mode properties.
+ */
+extern rtk_api_ret_t rtk_port_macForceLinkExt_get(rtk_port_t port, rtk_mode_ext_t *pMode, rtk_port_mac_ability_t *pPortability);
+
+/* Function Name:
+ * rtk_port_macStatus_get
+ * Description:
+ * Get port link status.
+ * Input:
+ * port - Port id.
+ * Output:
+ * pPortstatus - port ability configuration
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * This API can get Port/PHY properties.
+ */
+extern rtk_api_ret_t rtk_port_macStatus_get(rtk_port_t port, rtk_port_mac_ability_t *pPortstatus);
+
+/* Function Name:
+ * rtk_port_macLocalLoopbackEnable_set
+ * Description:
+ * Set Port Local Loopback. (Redirect TX to RX.)
+ * Input:
+ * port - Port id.
+ * enable - Loopback state, 0:disable, 1:enable
+ * Output:
+ * None.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * This API can enable/disable Local loopback in MAC.
+ * For UTP port, This API will also enable the digital
+ * loopback bit in PHY register for sync of speed between
+ * PHY and MAC. For EXT port, users need to force the
+ * link state by themself.
+ */
+extern rtk_api_ret_t rtk_port_macLocalLoopbackEnable_set(rtk_port_t port, rtk_enable_t enable);
+
+/* Function Name:
+ * rtk_port_macLocalLoopbackEnable_get
+ * Description:
+ * Get Port Local Loopback. (Redirect TX to RX.)
+ * Input:
+ * port - Port id.
+ * Output:
+ * pEnable - Loopback state, 0:disable, 1:enable
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * None.
+ */
+extern rtk_api_ret_t rtk_port_macLocalLoopbackEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
+
+/* Function Name:
+ * rtk_port_phyReg_set
+ * Description:
+ * Set PHY register data of the specific port.
+ * Input:
+ * port - port id.
+ * reg - Register id
+ * regData - Register data
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * This API can set PHY register data of the specific port.
+ */
+extern rtk_api_ret_t rtk_port_phyReg_set(rtk_port_t port, rtk_port_phy_reg_t reg, rtk_port_phy_data_t value);
+
+/* Function Name:
+ * rtk_port_phyReg_get
+ * Description:
+ * Get PHY register data of the specific port.
+ * Input:
+ * port - Port id.
+ * reg - Register id
+ * Output:
+ * pData - Register data
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PHY_REG_ID - Invalid PHY address
+ * RT_ERR_BUSYWAIT_TIMEOUT - PHY access busy
+ * Note:
+ * This API can get PHY register data of the specific port.
+ */
+extern rtk_api_ret_t rtk_port_phyReg_get(rtk_port_t port, rtk_port_phy_reg_t reg, rtk_port_phy_data_t *pData);
+
+/* Function Name:
+ * rtk_port_backpressureEnable_set
+ * Description:
+ * Set the half duplex backpressure enable status of the specific port.
+ * Input:
+ * port - port id.
+ * enable - Back pressure status.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_ENABLE - Invalid enable input.
+ * Note:
+ * This API can set the half duplex backpressure enable status of the specific port.
+ * The half duplex backpressure enable status of the port is as following:
+ * - DISABLE
+ * - ENABLE
+ */
+extern rtk_api_ret_t rtk_port_backpressureEnable_set(rtk_port_t port, rtk_enable_t enable);
+
+/* Function Name:
+ * rtk_port_backpressureEnable_get
+ * Description:
+ * Get the half duplex backpressure enable status of the specific port.
+ * Input:
+ * port - Port id.
+ * Output:
+ * pEnable - Back pressure status.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * This API can get the half duplex backpressure enable status of the specific port.
+ * The half duplex backpressure enable status of the port is as following:
+ * - DISABLE
+ * - ENABLE
+ */
+extern rtk_api_ret_t rtk_port_backpressureEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
+
+/* Function Name:
+ * rtk_port_adminEnable_set
+ * Description:
+ * Set port admin configuration of the specific port.
+ * Input:
+ * port - port id.
+ * enable - Back pressure status.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_ENABLE - Invalid enable input.
+ * Note:
+ * This API can set port admin configuration of the specific port.
+ * The port admin configuration of the port is as following:
+ * - DISABLE
+ * - ENABLE
+ */
+extern rtk_api_ret_t rtk_port_adminEnable_set(rtk_port_t port, rtk_enable_t enable);
+
+/* Function Name:
+ * rtk_port_adminEnable_get
+ * Description:
+ * Get port admin configurationof the specific port.
+ * Input:
+ * port - Port id.
+ * Output:
+ * pEnable - Back pressure status.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * This API can get port admin configuration of the specific port.
+ * The port admin configuration of the port is as following:
+ * - DISABLE
+ * - ENABLE
+ */
+extern rtk_api_ret_t rtk_port_adminEnable_get(rtk_port_t port, rtk_enable_t *pEnable);
+
+/* Function Name:
+ * rtk_port_isolation_set
+ * Description:
+ * Set permitted port isolation portmask
+ * Input:
+ * port - port id.
+ * pPortmask - Permit port mask
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * RT_ERR_PORT_MASK - Invalid portmask.
+ * Note:
+ * This API set the port mask that a port can trasmit packet to of each port
+ * A port can only transmit packet to ports included in permitted portmask
+ */
+extern rtk_api_ret_t rtk_port_isolation_set(rtk_port_t port, rtk_portmask_t *pPortmask);
+
+/* Function Name:
+ * rtk_port_isolation_get
+ * Description:
+ * Get permitted port isolation portmask
+ * Input:
+ * port - Port id.
+ * Output:
+ * pPortmask - Permit port mask
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port number.
+ * Note:
+ * This API get the port mask that a port can trasmit packet to of each port
+ * A port can only transmit packet to ports included in permitted portmask
+ */
+extern rtk_api_ret_t rtk_port_isolation_get(rtk_port_t port, rtk_portmask_t *pPortmask);
+
+/* Function Name:
+ * rtk_port_rgmiiDelayExt_set
+ * Description:
+ * Set RGMII interface delay value for TX and RX.
+ * Input:
+ * txDelay - TX delay value, 1 for delay 2ns and 0 for no-delay
+ * rxDelay - RX delay value, 0~7 for delay setup.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can set external interface 2 RGMII delay.
+ * In TX delay, there are 2 selection: no-delay and 2ns delay.
+ * In RX dekay, there are 8 steps for delay tunning. 0 for no-delay, and 7 for maximum delay.
+ */
+extern rtk_api_ret_t rtk_port_rgmiiDelayExt_set(rtk_port_t port, rtk_data_t txDelay, rtk_data_t rxDelay);
+
+/* Function Name:
+ * rtk_port_rgmiiDelayExt_get
+ * Description:
+ * Get RGMII interface delay value for TX and RX.
+ * Input:
+ * None
+ * Output:
+ * pTxDelay - TX delay value
+ * pRxDelay - RX delay value
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can set external interface 2 RGMII delay.
+ * In TX delay, there are 2 selection: no-delay and 2ns delay.
+ * In RX dekay, there are 8 steps for delay tunning. 0 for n0-delay, and 7 for maximum delay.
+ */
+extern rtk_api_ret_t rtk_port_rgmiiDelayExt_get(rtk_port_t port, rtk_data_t *pTxDelay, rtk_data_t *pRxDelay);
+
+/* Function Name:
+ * rtk_port_phyEnableAll_set
+ * Description:
+ * Set all PHY enable status.
+ * Input:
+ * enable - PHY Enable State.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_ENABLE - Invalid enable input.
+ * Note:
+ * This API can set all PHY status.
+ * The configuration of all PHY is as following:
+ * - DISABLE
+ * - ENABLE
+ */
+extern rtk_api_ret_t rtk_port_phyEnableAll_set(rtk_enable_t enable);
+
+/* Function Name:
+ * rtk_port_phyEnableAll_get
+ * Description:
+ * Get all PHY enable status.
+ * Input:
+ * None
+ * Output:
+ * pEnable - PHY Enable State.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * Note:
+ * This API can set all PHY status.
+ * The configuration of all PHY is as following:
+ * - DISABLE
+ * - ENABLE
+ */
+extern rtk_api_ret_t rtk_port_phyEnableAll_get(rtk_enable_t *pEnable);
+
+/* Function Name:
+ * rtk_port_efid_set
+ * Description:
+ * Set port-based enhanced filtering database
+ * Input:
+ * port - Port id.
+ * efid - Specified enhanced filtering database.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_L2_FID - Invalid fid.
+ * RT_ERR_INPUT - Invalid input parameter.
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can set port-based enhanced filtering database.
+ */
+extern rtk_api_ret_t rtk_port_efid_set(rtk_port_t port, rtk_data_t efid);
+
+/* Function Name:
+ * rtk_port_efid_get
+ * Description:
+ * Get port-based enhanced filtering database
+ * Input:
+ * port - Port id.
+ * Output:
+ * pEfid - Specified enhanced filtering database.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can get port-based enhanced filtering database status.
+ */
+extern rtk_api_ret_t rtk_port_efid_get(rtk_port_t port, rtk_data_t *pEfid);
+
+/* Function Name:
+ * rtk_port_phyComboPortMedia_set
+ * Description:
+ * Set Combo port media type
+ * Input:
+ * port - Port id. (Should be Port 4)
+ * media - Media (COPPER or FIBER)
+ * Output:
+ * None.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can Set Combo port media type.
+ */
+extern rtk_api_ret_t rtk_port_phyComboPortMedia_set(rtk_port_t port, rtk_port_media_t media);
+
+/* Function Name:
+ * rtk_port_phyComboPortMedia_get
+ * Description:
+ * Get Combo port media type
+ * Input:
+ * port - Port id. (Should be Port 4)
+ * Output:
+ * pMedia - Media (COPPER or FIBER)
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can Set Combo port media type.
+ */
+extern rtk_api_ret_t rtk_port_phyComboPortMedia_get(rtk_port_t port, rtk_port_media_t *pMedia);
+
+/* Function Name:
+ * rtk_port_rtctEnable_set
+ * Description:
+ * Enable RTCT test
+ * Input:
+ * pPortmask - Port mask of RTCT enabled port
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_MASK - Invalid port mask.
+ * Note:
+ * The API can enable RTCT Test
+ */
+extern rtk_api_ret_t rtk_port_rtctEnable_set(rtk_portmask_t *pPortmask);
+
+/* Function Name:
+ * rtk_port_rtctDisable_set
+ * Description:
+ * Disable RTCT test
+ * Input:
+ * pPortmask - Port mask of RTCT disabled port
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_MASK - Invalid port mask.
+ * Note:
+ * The API can disable RTCT Test
+ */
+rtk_api_ret_t rtk_port_rtctDisable_set(rtk_portmask_t *pPortmask);
+
+
+/* Function Name:
+ * rtk_port_rtctResult_get
+ * Description:
+ * Get the result of RTCT test
+ * Input:
+ * port - Port ID
+ * Output:
+ * pRtctResult - The result of RTCT result
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * RT_ERR_PHY_RTCT_NOT_FINISH - Testing does not finish.
+ * Note:
+ * The API can get RTCT test result.
+ * RTCT test may takes 4.8 seconds to finish its test at most.
+ * Thus, if this API return RT_ERR_PHY_RTCT_NOT_FINISH or
+ * other error code, the result can not be referenced and
+ * user should call this API again until this API returns
+ * a RT_ERR_OK.
+ * The result is stored at pRtctResult->ge_result
+ * pRtctResult->linkType is unused.
+ * The unit of channel length is 2.5cm. Ex. 300 means 300 * 2.5 = 750cm = 7.5M
+ */
+extern rtk_api_ret_t rtk_port_rtctResult_get(rtk_port_t port, rtk_rtctResult_t *pRtctResult);
+
+/* Function Name:
+ * rtk_port_sds_reset
+ * Description:
+ * Reset Serdes
+ * Input:
+ * port - Port ID
+ * Output:
+ * None.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can reset Serdes
+ */
+extern rtk_api_ret_t rtk_port_sds_reset(rtk_port_t port);
+
+/* Function Name:
+ * rtk_port_sgmiiLinkStatus_get
+ * Description:
+ * Get SGMII status
+ * Input:
+ * port - Port ID
+ * Output:
+ * pSignalDetect - Signal detect
+ * pSync - Sync
+ * pLink - Link
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can reset Serdes
+ */
+extern rtk_api_ret_t rtk_port_sgmiiLinkStatus_get(rtk_port_t port, rtk_data_t *pSignalDetect, rtk_data_t *pSync, rtk_port_linkStatus_t *pLink);
+
+/* Function Name:
+ * rtk_port_sgmiiNway_set
+ * Description:
+ * Configure SGMII/HSGMII port Nway state
+ * Input:
+ * port - Port ID
+ * state - Nway state
+ * Output:
+ * None.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API configure SGMII/HSGMII port Nway state
+ */
+extern rtk_api_ret_t rtk_port_sgmiiNway_set(rtk_port_t port, rtk_enable_t state);
+
+/* Function Name:
+ * rtk_port_sgmiiNway_get
+ * Description:
+ * Get SGMII/HSGMII port Nway state
+ * Input:
+ * port - Port ID
+ * Output:
+ * pState - Nway state
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_PORT_ID - Invalid port ID.
+ * Note:
+ * The API can get SGMII/HSGMII port Nway state
+ */
+extern rtk_api_ret_t rtk_port_sgmiiNway_get(rtk_port_t port, rtk_enable_t *pState);
+
+#endif /* __RTK_API_PORT_H__ */
+
+
+