Merge "[qca-ssdk]: support port interface status get api for aq phy."
diff --git a/src/hsl/phy/aquantia_phy.c b/src/hsl/phy/aquantia_phy.c
index 72a03eb..4b5c5b0 100755
--- a/src/hsl/phy/aquantia_phy.c
+++ b/src/hsl/phy/aquantia_phy.c
@@ -1487,6 +1487,65 @@
/******************************************************************************
*
+* aquantia_phy_interface mode status get
+*
+* get aquantia phy interface mode status
+*/
+sw_error_t
+aquantia_phy_interface_get_mode_status(a_uint32_t dev_id, a_uint32_t phy_id,
+ fal_port_interface_mode_t *interface_mode_status)
+{
+ a_uint16_t phy_data;
+ a_uint32_t phy_register;
+ fal_port_speed_t speed;
+ sw_error_t rv = SW_OK;
+
+ rv = aquantia_phy_get_speed(dev_id, phy_id, &speed);
+ SW_RTN_ON_ERROR(rv);
+ switch (speed)
+ {
+ case FAL_SPEED_100:
+ phy_register = AQUANTIA_GLOBAL_SYS_CONFIG_FOR_100M;
+ break;
+ case FAL_SPEED_1000:
+ phy_register = AQUANTIA_GLOBAL_SYS_CONFIG_FOR_1000M;
+ break;
+ case FAL_SPEED_2500:
+ phy_register = AQUANTIA_GLOBAL_SYS_CONFIG_FOR_2500M;
+ break;
+ case FAL_SPEED_5000:
+ phy_register = AQUANTIA_GLOBAL_SYS_CONFIG_FOR_5000M;
+ break;
+ case FAL_SPEED_10000:
+ phy_register = AQUANTIA_GLOBAL_SYS_CONFIG_FOR_10000M;
+ break;
+ default:
+ return SW_NOT_SUPPORTED;
+ }
+ rv = aquantia_phy_reg_read(dev_id, phy_id, AQUANTIA_MMD_GLOBAL_REGISTERS,
+ phy_register, &phy_data);
+ SW_RTN_ON_ERROR(rv);
+ phy_data &= (BITS(0, 3));
+ switch(phy_data)
+ {
+ case AQUANTIA_SERDES_MODE_SGMII:
+ *interface_mode_status = PHY_SGMII_BASET;
+ break;
+ case AQUANTIA_SERDES_MODE_XFI:
+ *interface_mode_status = PORT_USXGMII;
+ break;
+ case AQUANTIA_SERDES_MODE_OCSGMII:
+ *interface_mode_status = PORT_SGMII_PLUS;
+ break;
+ default:
+ return SW_NOT_SUPPORTED;
+ }
+
+ return rv;
+}
+
+/******************************************************************************
+*
* aquantia_phy_intr_mask_set - Set interrupt mask with the
* specified device.
*/
@@ -2097,6 +2156,7 @@
aquantia_phy_api_ops->phy_intr_mask_get = aquantia_phy_intr_mask_get;
aquantia_phy_api_ops->phy_id_get = aquantia_phy_get_phy_id;
aquantia_phy_api_ops->phy_interface_mode_set = aquantia_phy_interface_set_mode;
+ aquantia_phy_api_ops->phy_interface_mode_status_get=aquantia_phy_interface_get_mode_status;
aquantia_phy_api_ops->phy_get_status = aquantia_phy_get_status;
aquantia_phy_api_ops->phy_counter_show = aquantia_phy_show_counter;
aquantia_phy_api_ops->phy_eee_adv_set = aquantia_phy_set_eee_adv;