Merge "[qca-ssdk] [add powersaving and fiber feature to Dakota malibu phy module]"
diff --git a/include/api/api_desc.h b/include/api/api_desc.h
index 84a307d..47e339b 100755
--- a/include/api/api_desc.h
+++ b/include/api/api_desc.h
@@ -264,7 +264,140 @@
SW_PARAM_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_GET, SW_UINT8, 1, SW_PARAM_PTR|SW_PARAM_OUT, "On Thres"), \
SW_PARAM_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_GET, SW_UINT8, 1, SW_PARAM_PTR|SW_PARAM_OUT, "Off Thres"),
+#define SW_API_PT_8023AZ_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_8023AZ_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_8023AZ_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_8023AZ_SET, SW_ENABLE, 4, SW_PARAM_IN, "8023az Status"),
+#define SW_API_PT_8023AZ_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_8023AZ_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_8023AZ_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_8023AZ_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "8023az Status"),
+
+#define SW_API_PT_MDIX_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MDIX_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MDIX_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MDIX_SET, SW_CROSSOVER_MODE, sizeof(fal_port_mdix_mode_t), SW_PARAM_IN, "Crossover Mode"),
+
+
+#define SW_API_PT_MDIX_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MDIX_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MDIX_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MDIX_GET, SW_CROSSOVER_MODE, sizeof(fal_port_mdix_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Crossover Mode"),
+
+#define SW_API_PT_MDIX_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MDIX_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MDIX_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MDIX_STATUS_GET, SW_CROSSOVER_STATUS, sizeof(fal_port_mdix_status_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Crossover Status"),
+
+
+#define SW_API_PT_COMBO_PREFER_MEDIUM_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_SET, SW_PREFER_MEDIUM, sizeof(fal_port_medium_t), SW_PARAM_IN, "Prefer Medium"),
+
+
+#define SW_API_PT_COMBO_PREFER_MEDIUM_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_GET, SW_PREFER_MEDIUM, sizeof(fal_port_medium_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Prefer Medium"),
+
+#define SW_API_PT_COMBO_MEDIUM_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_COMBO_MEDIUM_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_MEDIUM_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_MEDIUM_STATUS_GET, SW_PREFER_MEDIUM, sizeof(fal_port_medium_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Medium Type"),
+
+#define SW_API_PT_COMBO_FIBER_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_COMBO_FIBER_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_FIBER_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_FIBER_MODE_SET, SW_FIBER_MODE, sizeof(fal_port_fiber_mode_t), SW_PARAM_IN, "Fbier Mode"),
+
+
+#define SW_API_PT_COMBO_FIBER_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_COMBO_FIBER_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_FIBER_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_COMBO_FIBER_MODE_GET, SW_FIBER_MODE, sizeof(fal_port_fiber_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Fiber Mode"),
+
+#define SW_API_PT_LOCAL_LOOPBACK_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_LOCAL_LOOPBACK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_LOCAL_LOOPBACK_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_LOCAL_LOOPBACK_SET, SW_ENABLE, 4, SW_PARAM_IN, "Local Loopback Status"),
+
+#define SW_API_PT_LOCAL_LOOPBACK_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_LOCAL_LOOPBACK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_LOCAL_LOOPBACK_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_LOCAL_LOOPBACK_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Local Loopback Status"),
+
+#define SW_API_PT_REMOTE_LOOPBACK_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_REMOTE_LOOPBACK_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_REMOTE_LOOPBACK_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_REMOTE_LOOPBACK_SET, SW_ENABLE, 4, SW_PARAM_IN, "Remote Loopback Status"),
+
+#define SW_API_PT_REMOTE_LOOPBACK_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_REMOTE_LOOPBACK_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_REMOTE_LOOPBACK_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_REMOTE_LOOPBACK_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Remote Loopback Status"),
+
+#define SW_API_PT_RESET_DESC \
+ SW_PARAM_DEF(SW_API_PT_RESET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_RESET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+#define SW_API_PT_POWER_OFF_DESC \
+ SW_PARAM_DEF(SW_API_PT_POWER_OFF, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_POWER_OFF, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+#define SW_API_PT_POWER_ON_DESC \
+ SW_PARAM_DEF(SW_API_PT_POWER_ON, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_POWER_ON, SW_UINT32, 4, SW_PARAM_IN, "Port ID"),
+
+#define SW_API_PT_MAGIC_FRAME_MAC_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MAGIC_FRAME_MAC_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAGIC_FRAME_MAC_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAGIC_FRAME_MAC_SET, SW_MACADDR, sizeof(fal_mac_addr_t), SW_PARAM_PTR|SW_PARAM_IN, "Magic mac"),
+
+#define SW_API_PT_MAGIC_FRAME_MAC_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_MAGIC_FRAME_MAC_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAGIC_FRAME_MAC_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_MAGIC_FRAME_MAC_GET, SW_MACADDR, sizeof(fal_mac_addr_t), SW_PARAM_PTR|SW_PARAM_OUT, "Magic mac"),
+
+#define SW_API_PT_PHY_ID_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_PHY_ID_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_PHY_ID_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_PHY_ID_GET, SW_UINT16, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Org ID"), \
+ SW_PARAM_DEF(SW_API_PT_PHY_ID_GET, SW_UINT16, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Rev ID"),
+
+#define SW_API_PT_WOL_STATUS_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_WOL_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_WOL_STATUS_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_WOL_STATUS_SET, SW_ENABLE, 4, SW_PARAM_IN, "Wol Status"),
+
+#define SW_API_PT_WOL_STATUS_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_WOL_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_WOL_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_WOL_STATUS_GET, SW_ENABLE, 4, SW_PARAM_PTR|SW_PARAM_OUT, "Wol Status"),
+
+#define SW_API_PT_INTERFACE_MODE_SET_DESC \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_SET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_SET, SW_INTERFACE_MODE, sizeof(fal_port_interface_mode_t), SW_PARAM_IN, "Interface Mode"),
+
+
+#define SW_API_PT_INTERFACE_MODE_GET_DESC \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_GET, SW_INTERFACE_MODE, sizeof(fal_port_interface_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Interface Mode"),
+
+#define SW_API_PT_INTERFACE_MODE_STATUS_GET_DESC\
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, SW_INTERFACE_MODE, sizeof(fal_port_interface_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, \
+ "Interface Status"),
#define SW_API_VLAN_ADD_DESC \
diff --git a/include/api/sw_api.h b/include/api/sw_api.h
index 4861a75..3c70a67 100755
--- a/include/api/sw_api.h
+++ b/include/api/sw_api.h
@@ -117,6 +117,11 @@
SW_FLOWCOOKIE,
SW_FDB_RFS,
SW_FLOWRFS,
+ SW_CROSSOVER_MODE,
+ SW_CROSSOVER_STATUS,
+ SW_PREFER_MEDIUM,
+ SW_FIBER_MODE,
+ SW_INTERFACE_MODE,
} sw_data_type_e;
typedef struct
diff --git a/include/api/sw_ioctl.h b/include/api/sw_ioctl.h
index 26d94a2..5138558 100755
--- a/include/api/sw_ioctl.h
+++ b/include/api/sw_ioctl.h
@@ -75,10 +75,31 @@
#define SW_API_PT_CONGESTION_DROP_GET (43+ SW_API_PORT_OFFSET)
#define SW_API_PT_RING_FLOW_CTRL_THRES_SET (44+ SW_API_PORT_OFFSET)
#define SW_API_PT_RING_FLOW_CTRL_THRES_GET (45+ SW_API_PORT_OFFSET)
-
-
-
-
+#define SW_API_PT_8023AZ_SET (46 + SW_API_PORT_OFFSET)
+#define SW_API_PT_8023AZ_GET (47 + SW_API_PORT_OFFSET)
+#define SW_API_PT_MDIX_SET (48 + SW_API_PORT_OFFSET)
+#define SW_API_PT_MDIX_GET (49 + SW_API_PORT_OFFSET)
+#define SW_API_PT_MDIX_STATUS_GET (50 + SW_API_PORT_OFFSET)
+#define SW_API_PT_COMBO_PREFER_MEDIUM_SET (51 + SW_API_PORT_OFFSET)
+#define SW_API_PT_COMBO_PREFER_MEDIUM_GET (52 + SW_API_PORT_OFFSET)
+#define SW_API_PT_COMBO_MEDIUM_STATUS_GET (53 + SW_API_PORT_OFFSET)
+#define SW_API_PT_COMBO_FIBER_MODE_SET (54 + SW_API_PORT_OFFSET)
+#define SW_API_PT_COMBO_FIBER_MODE_GET (55 + SW_API_PORT_OFFSET)
+#define SW_API_PT_LOCAL_LOOPBACK_SET (56 + SW_API_PORT_OFFSET)
+#define SW_API_PT_LOCAL_LOOPBACK_GET (57 + SW_API_PORT_OFFSET)
+#define SW_API_PT_REMOTE_LOOPBACK_SET (58 + SW_API_PORT_OFFSET)
+#define SW_API_PT_REMOTE_LOOPBACK_GET (59 + SW_API_PORT_OFFSET)
+#define SW_API_PT_RESET (60 + SW_API_PORT_OFFSET)
+#define SW_API_PT_POWER_OFF (61 + SW_API_PORT_OFFSET)
+#define SW_API_PT_POWER_ON (62 + SW_API_PORT_OFFSET)
+#define SW_API_PT_MAGIC_FRAME_MAC_SET (63 + SW_API_PORT_OFFSET)
+#define SW_API_PT_MAGIC_FRAME_MAC_GET (64 + SW_API_PORT_OFFSET)
+#define SW_API_PT_PHY_ID_GET (65 + SW_API_PORT_OFFSET)
+#define SW_API_PT_WOL_STATUS_SET (66 + SW_API_PORT_OFFSET)
+#define SW_API_PT_WOL_STATUS_GET (67 + SW_API_PORT_OFFSET)
+#define SW_API_PT_INTERFACE_MODE_SET (68 + SW_API_PORT_OFFSET)
+#define SW_API_PT_INTERFACE_MODE_GET (69 + SW_API_PORT_OFFSET)
+#define SW_API_PT_INTERFACE_MODE_STATUS_GET (70 + SW_API_PORT_OFFSET)
/*vlan*/
#define SW_API_VLAN_OFFSET 110
diff --git a/include/fal/fal_api.h b/include/fal/fal_api.h
index afc4739..d8d3bbe 100755
--- a/include/fal/fal_api.h
+++ b/include/fal/fal_api.h
@@ -68,8 +68,32 @@
SW_API_DEF(SW_API_PT_CONGESTION_DROP_SET, fal_port_congestion_drop_set), \
SW_API_DEF(SW_API_PT_CONGESTION_DROP_GET, fal_port_congestion_drop_get), \
SW_API_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_SET, fal_ring_flow_ctrl_thres_set), \
- SW_API_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_GET, fal_ring_flow_ctrl_thres_get),
-
+ SW_API_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_GET, fal_ring_flow_ctrl_thres_get), \
+ SW_API_DEF(SW_API_PT_8023AZ_SET, fal_port_8023az_set), \
+ SW_API_DEF(SW_API_PT_8023AZ_GET, fal_port_8023az_get), \
+ SW_API_DEF(SW_API_PT_MDIX_SET, fal_port_mdix_set), \
+ SW_API_DEF(SW_API_PT_MDIX_GET, fal_port_mdix_get), \
+ SW_API_DEF(SW_API_PT_MDIX_STATUS_GET, fal_port_mdix_status_get), \
+ SW_API_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_SET, fal_port_combo_prefer_medium_set), \
+ SW_API_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_GET, fal_port_combo_prefer_medium_get), \
+ SW_API_DEF(SW_API_PT_COMBO_MEDIUM_STATUS_GET, fal_port_combo_medium_status_get), \
+ SW_API_DEF(SW_API_PT_COMBO_FIBER_MODE_SET, fal_port_combo_fiber_mode_set), \
+ SW_API_DEF(SW_API_PT_COMBO_FIBER_MODE_GET, fal_port_combo_fiber_mode_get), \
+ SW_API_DEF(SW_API_PT_LOCAL_LOOPBACK_SET, fal_port_local_loopback_set), \
+ SW_API_DEF(SW_API_PT_LOCAL_LOOPBACK_GET, fal_port_local_loopback_get), \
+ SW_API_DEF(SW_API_PT_REMOTE_LOOPBACK_SET, fal_port_remote_loopback_set), \
+ SW_API_DEF(SW_API_PT_REMOTE_LOOPBACK_GET, fal_port_remote_loopback_get), \
+ SW_API_DEF(SW_API_PT_RESET, fal_port_reset), \
+ SW_API_DEF(SW_API_PT_POWER_OFF, fal_port_power_off), \
+ SW_API_DEF(SW_API_PT_POWER_ON, fal_port_power_on), \
+ SW_API_DEF(SW_API_PT_MAGIC_FRAME_MAC_SET, fal_port_magic_frame_mac_set), \
+ SW_API_DEF(SW_API_PT_MAGIC_FRAME_MAC_GET, fal_port_magic_frame_mac_get), \
+ SW_API_DEF(SW_API_PT_PHY_ID_GET, fal_port_phy_id_get), \
+ SW_API_DEF(SW_API_PT_WOL_STATUS_SET, fal_port_wol_status_set), \
+ SW_API_DEF(SW_API_PT_WOL_STATUS_GET, fal_port_wol_status_get), \
+ SW_API_DEF(SW_API_PT_INTERFACE_MODE_SET, fal_port_interface_mode_set), \
+ SW_API_DEF(SW_API_PT_INTERFACE_MODE_GET, fal_port_interface_mode_get), \
+ SW_API_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, fal_port_interface_mode_status_get),
#define PORTCONTROL_API_PARAM \
SW_API_DESC(SW_API_PT_DUPLEX_GET) \
@@ -117,7 +141,33 @@
SW_API_DESC(SW_API_PT_CONGESTION_DROP_SET) \
SW_API_DESC(SW_API_PT_CONGESTION_DROP_GET) \
SW_API_DESC(SW_API_PT_RING_FLOW_CTRL_THRES_SET) \
- SW_API_DESC(SW_API_PT_RING_FLOW_CTRL_THRES_GET)
+ SW_API_DESC(SW_API_PT_RING_FLOW_CTRL_THRES_GET) \
+ SW_API_DESC(SW_API_PT_8023AZ_SET) \
+ SW_API_DESC(SW_API_PT_8023AZ_GET) \
+ SW_API_DESC(SW_API_PT_MDIX_SET) \
+ SW_API_DESC(SW_API_PT_MDIX_GET) \
+ SW_API_DESC(SW_API_PT_MDIX_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_COMBO_PREFER_MEDIUM_SET) \
+ SW_API_DESC(SW_API_PT_COMBO_PREFER_MEDIUM_GET) \
+ SW_API_DESC(SW_API_PT_COMBO_MEDIUM_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_COMBO_FIBER_MODE_SET) \
+ SW_API_DESC(SW_API_PT_COMBO_FIBER_MODE_GET) \
+ SW_API_DESC(SW_API_PT_LOCAL_LOOPBACK_SET) \
+ SW_API_DESC(SW_API_PT_LOCAL_LOOPBACK_GET) \
+ SW_API_DESC(SW_API_PT_REMOTE_LOOPBACK_SET) \
+ SW_API_DESC(SW_API_PT_REMOTE_LOOPBACK_GET) \
+ SW_API_DESC(SW_API_PT_RESET) \
+ SW_API_DESC(SW_API_PT_POWER_OFF) \
+ SW_API_DESC(SW_API_PT_POWER_ON) \
+ SW_API_DESC(SW_API_PT_MAGIC_FRAME_MAC_SET) \
+ SW_API_DESC(SW_API_PT_MAGIC_FRAME_MAC_GET) \
+ SW_API_DESC(SW_API_PT_PHY_ID_GET) \
+ SW_API_DESC(SW_API_PT_WOL_STATUS_SET) \
+ SW_API_DESC(SW_API_PT_WOL_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_INTERFACE_MODE_SET) \
+ SW_API_DESC(SW_API_PT_INTERFACE_MODE_GET) \
+ SW_API_DESC(SW_API_PT_INTERFACE_MODE_STATUS_GET)
+
#else
#define PORTCONTROL_API
#define PORTCONTROL_API_PARAM
diff --git a/include/fal/fal_port_ctrl.h b/include/fal/fal_port_ctrl.h
index 7ff25ed..8c34bf9 100755
--- a/include/fal/fal_port_ctrl.h
+++ b/include/fal/fal_port_ctrl.h
@@ -198,6 +198,21 @@
/**< Phy auto-negotiation done */
} fal_port_auto_neg_status_t;
+
+/** Phy interface mode */
+ typedef enum {
+ PHY_PSGMII_BASET = 0,
+ /**< PSGMII mode */
+ PHY_PSGMII_BX1000 = 1,
+ /**< PSGMII BX1000 mode */
+ PHY_PSGMII_FX100 = 2,
+ /**< PSGMII FX100 mode */
+ PHY_PSGMII_AMDET = 3,
+ /**< PSGMII Auto mode */
+ PHY_SGMII_BASET = 4,
+ /**< SGMII mode */
+ } fal_port_interface_mode_t;
+
/*above is new add for malibu phy*/
sw_error_t
@@ -438,6 +453,47 @@
fal_port_remote_loopback_get(a_uint32_t dev_id, fal_port_t port_id,
a_bool_t * enable);
+ sw_error_t
+ fal_port_reset(a_uint32_t dev_id, fal_port_t port_id);
+
+ sw_error_t
+ fal_port_power_off(a_uint32_t dev_id, fal_port_t port_id);
+
+ sw_error_t
+ fal_port_power_on(a_uint32_t dev_id, fal_port_t port_id);
+
+ sw_error_t
+ fal_port_magic_frame_mac_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_mac_addr_t * mac);
+
+ sw_error_t
+ fal_port_magic_frame_mac_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_mac_addr_t * mac);
+
+ sw_error_t
+ fal_port_phy_id_get (a_uint32_t dev_id, fal_port_t port_id,
+ a_uint16_t * org_id, a_uint16_t * rev_id);
+
+ sw_error_t
+ fal_port_wol_status_set (a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable);
+
+ sw_error_t
+ fal_port_wol_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable);
+
+ sw_error_t
+ fal_port_interface_mode_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t mode);
+
+ sw_error_t
+ fal_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode);
+
+ sw_error_t
+ fal_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/include/hsl/dess/dess_api.h b/include/hsl/dess/dess_api.h
index e8b44aa..4db5903 100755
--- a/include/hsl/dess/dess_api.h
+++ b/include/hsl/dess/dess_api.h
@@ -65,7 +65,24 @@
SW_API_DEF(SW_API_PT_CONGESTION_DROP_SET, dess_port_congestion_drop_set), \
SW_API_DEF(SW_API_PT_CONGESTION_DROP_GET, dess_port_congestion_drop_get), \
SW_API_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_SET, dess_ring_flow_ctrl_thres_set), \
- SW_API_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_GET, dess_ring_flow_ctrl_thres_get),
+ SW_API_DEF(SW_API_PT_RING_FLOW_CTRL_THRES_GET, dess_ring_flow_ctrl_thres_get),\
+ SW_API_DEF(SW_API_PT_8023AZ_SET, dess_port_8023az_set), \
+ SW_API_DEF(SW_API_PT_8023AZ_GET, dess_port_8023az_get), \
+ SW_API_DEF(SW_API_PT_MDIX_SET, dess_port_mdix_set), \
+ SW_API_DEF(SW_API_PT_MDIX_GET, dess_port_mdix_get), \
+ SW_API_DEF(SW_API_PT_MDIX_STATUS_GET, dess_port_mdix_status_get), \
+ SW_API_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_SET, dess_port_combo_prefer_medium_set), \
+ SW_API_DEF(SW_API_PT_COMBO_PREFER_MEDIUM_GET, dess_port_combo_prefer_medium_get), \
+ SW_API_DEF(SW_API_PT_COMBO_MEDIUM_STATUS_GET, dess_port_combo_medium_status_get), \
+ SW_API_DEF(SW_API_PT_COMBO_FIBER_MODE_SET, dess_port_combo_fiber_mode_set), \
+ SW_API_DEF(SW_API_PT_COMBO_FIBER_MODE_GET, dess_port_combo_fiber_mode_get), \
+ SW_API_DEF(SW_API_PT_LOCAL_LOOPBACK_SET, dess_port_local_loopback_set), \
+ SW_API_DEF(SW_API_PT_LOCAL_LOOPBACK_GET, dess_port_local_loopback_get), \
+ SW_API_DEF(SW_API_PT_REMOTE_LOOPBACK_SET, dess_port_remote_loopback_set), \
+ SW_API_DEF(SW_API_PT_REMOTE_LOOPBACK_GET, dess_port_remote_loopback_get), \
+ SW_API_DEF(SW_API_PT_RESET, dess_port_reset), \
+ SW_API_DEF(SW_API_PT_POWER_OFF, dess_port_power_off), \
+ SW_API_DEF(SW_API_PT_POWER_ON, dess_port_power_on),
#define PORTCONTROL_API_PARAM \
SW_API_DESC(SW_API_PT_DUPLEX_GET) \
@@ -110,7 +127,25 @@
SW_API_DESC(SW_API_PT_CONGESTION_DROP_SET) \
SW_API_DESC(SW_API_PT_CONGESTION_DROP_GET) \
SW_API_DESC(SW_API_PT_RING_FLOW_CTRL_THRES_SET) \
- SW_API_DESC(SW_API_PT_RING_FLOW_CTRL_THRES_GET)
+ SW_API_DESC(SW_API_PT_RING_FLOW_CTRL_THRES_GET)\
+ SW_API_DESC(SW_API_PT_8023AZ_SET) \
+ SW_API_DESC(SW_API_PT_8023AZ_GET) \
+ SW_API_DESC(SW_API_PT_MDIX_SET) \
+ SW_API_DESC(SW_API_PT_MDIX_GET) \
+ SW_API_DESC(SW_API_PT_MDIX_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_COMBO_PREFER_MEDIUM_SET) \
+ SW_API_DESC(SW_API_PT_COMBO_PREFER_MEDIUM_GET) \
+ SW_API_DESC(SW_API_PT_COMBO_MEDIUM_STATUS_GET) \
+ SW_API_DESC(SW_API_PT_COMBO_FIBER_MODE_SET) \
+ SW_API_DESC(SW_API_PT_COMBO_FIBER_MODE_GET) \
+ SW_API_DESC(SW_API_PT_LOCAL_LOOPBACK_SET) \
+ SW_API_DESC(SW_API_PT_LOCAL_LOOPBACK_GET) \
+ SW_API_DESC(SW_API_PT_REMOTE_LOOPBACK_SET) \
+ SW_API_DESC(SW_API_PT_REMOTE_LOOPBACK_GET) \
+ SW_API_DESC(SW_API_PT_RESET) \
+ SW_API_DESC(SW_API_PT_POWER_OFF) \
+ SW_API_DESC(SW_API_PT_POWER_ON)
+
#else
#define PORTCONTROL_API
#define PORTCONTROL_API_PARAM
diff --git a/include/hsl/dess/dess_port_ctrl.h b/include/hsl/dess/dess_port_ctrl.h
index 540b05e..ea81dfa 100755
--- a/include/hsl/dess/dess_port_ctrl.h
+++ b/include/hsl/dess/dess_port_ctrl.h
@@ -311,7 +311,7 @@
fal_mac_addr_t * mac);
HSL_LOCAL sw_error_t
- dess_port_id_get (a_uint32_t dev_id, fal_port_t port_id,
+ dess_port_phy_id_get (a_uint32_t dev_id, fal_port_t port_id,
a_uint16_t * org_id, a_uint16_t * rev_id);
HSL_LOCAL sw_error_t
@@ -322,6 +322,26 @@
dess_port_wol_status_get (a_uint32_t dev_id, fal_port_t port_id,
a_bool_t * enable);
+ HSL_LOCAL sw_error_t
+ dess_port_reset (a_uint32_t dev_id, fal_port_t port_id);
+
+ HSL_LOCAL sw_error_t
+ dess_port_power_off (a_uint32_t dev_id, fal_port_t port_id);
+
+ HSL_LOCAL sw_error_t
+ dess_port_power_on (a_uint32_t dev_id, fal_port_t port_id);
+
+ HSL_LOCAL sw_error_t
+ dess_port_interface_mode_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t mode);
+
+ HSL_LOCAL sw_error_t
+ dess_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode);
+
+ HSL_LOCAL sw_error_t
+ dess_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode);
#endif
#ifdef __cplusplus
diff --git a/include/hsl/hsl_api.h b/include/hsl/hsl_api.h
index 4175016..d706738 100755
--- a/include/hsl/hsl_api.h
+++ b/include/hsl/hsl_api.h
@@ -492,7 +492,41 @@
(*hsl_port_remote_loopback_get) (a_uint32_t dev_id, fal_port_t port_id,
a_bool_t * enable);
+ typedef sw_error_t
+ (*hsl_port_reset) (a_uint32_t dev_id, fal_port_t port_id);
+ typedef sw_error_t
+ (*hsl_port_power_off) (a_uint32_t dev_id, fal_port_t port_id);
+
+ typedef sw_error_t
+ (*hsl_port_power_on) (a_uint32_t dev_id, fal_port_t port_id);
+
+ typedef sw_error_t
+ (*hsl_port_phy_id_get) (a_uint32_t dev_id, fal_port_t port_id,a_uint16_t * org_id, a_uint16_t * rev_id);
+
+ typedef sw_error_t
+ (*hsl_port_wol_status_set) (a_uint32_t dev_id, fal_port_t port_id,a_bool_t enable);
+
+ typedef sw_error_t
+ (*hsl_port_wol_status_get) (a_uint32_t dev_id, fal_port_t port_id,a_bool_t *enable);
+
+ typedef sw_error_t
+ (*hsl_port_magic_frame_mac_set) (a_uint32_t dev_id, fal_port_t port_id,fal_mac_addr_t * mac);
+
+ typedef sw_error_t
+ (*hsl_port_magic_frame_mac_get) (a_uint32_t dev_id, fal_port_t port_id,fal_mac_addr_t * mac);
+
+ typedef sw_error_t
+ (*hsl_port_interface_mode_set) (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t mode);
+
+ typedef sw_error_t
+ (*hsl_port_interface_mode_get) (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode);
+
+ typedef sw_error_t
+ (*hsl_port_interface_mode_status_get) (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode);
/* VLAN */
#define VLAN_FUNC_PROTOTYPE_DEF
typedef sw_error_t
@@ -1982,7 +2016,6 @@
hsl_port_flowctrl_get port_flowctrl_get;
hsl_port_flowctrl_forcemode_set port_flowctrl_forcemode_set;
hsl_port_flowctrl_forcemode_get port_flowctrl_forcemode_get;
-
hsl_port_powersave_set port_powersave_set;
hsl_port_powersave_get port_powersave_get;
hsl_port_hibernate_set port_hibernate_set;
@@ -2028,7 +2061,17 @@
hsl_port_local_loopback_get port_local_loopback_get;
hsl_port_remote_loopback_set port_remote_loopback_set;
hsl_port_remote_loopback_get port_remote_loopback_get;
-
+ hsl_port_reset port_reset;
+ hsl_port_power_off port_power_off;
+ hsl_port_power_on port_power_on;
+ hsl_port_phy_id_get port_phy_id_get;
+ hsl_port_wol_status_set port_wol_status_set;
+ hsl_port_wol_status_get port_wol_status_get;
+ hsl_port_magic_frame_mac_set port_magic_frame_mac_set;
+ hsl_port_magic_frame_mac_get port_magic_frame_mac_get;
+ hsl_port_interface_mode_set port_interface_mode_set;
+ hsl_port_interface_mode_get port_interface_mode_get;
+ hsl_port_interface_mode_status_get port_interface_mode_status_get;
/* VLAN */
hsl_vlan_entry_append vlan_entry_append;
diff --git a/include/hsl/phy/hsl_phy.h b/include/hsl/phy/hsl_phy.h
index c5c70b6..312a172 100755
--- a/include/hsl/phy/hsl_phy.h
+++ b/include/hsl/phy/hsl_phy.h
@@ -125,6 +125,10 @@
a_uint32_t phy_id,
fal_port_reset_status_t *
status);
+ typedef sw_error_t(*hsl_phy_power_off) (a_uint32_t dev_id,
+ a_uint32_t phy_id);
+ typedef sw_error_t(*hsl_phy_power_on) (a_uint32_t dev_id,
+ a_uint32_t phy_id);
typedef sw_error_t(*hsl_phy_id_get) (a_uint32_t dev_id,
a_uint32_t phy_id,
a_uint16_t * org_id,
@@ -166,18 +170,24 @@
typedef sw_error_t(*hsl_phy_magic_frame_mac_get) (a_uint32_t dev_id,
a_uint32_t phy_id,
fal_mac_addr_t * mac);
-
- typedef sw_error_t(*hsl_phy_phy_id_get) (a_uint32_t dev_id,
- a_uint32_t phy_id,
- a_uint16_t * org_id,
- a_uint16_t * rev_id);
typedef sw_error_t(*hsl_phy_wol_status_set) (a_uint32_t dev_id,
a_uint32_t phy_id,
a_bool_t enable);
typedef sw_error_t(*hsl_phy_wol_status_get) (a_uint32_t dev_id,
a_uint32_t phy_id,
a_bool_t * enable);
-
+ typedef sw_error_t(*hsl_phy_interface_mode_set) (a_uint32_t dev_id,
+ a_uint32_t phy_id,
+ fal_port_interface_mode_t
+ interface_mode);
+ typedef sw_error_t(*hsl_phy_interface_mode_get) (a_uint32_t dev_id,
+ a_uint32_t phy_id,
+ fal_port_interface_mode_t
+ * interface_mode);
+ typedef sw_error_t(*hsl_phy_interface_mode_status_get) (a_uint32_t dev_id,
+ a_uint32_t phy_id,
+ fal_port_interface_mode_t
+ * interface_mode);
typedef struct hsl_phy_ops_s {
hsl_phy_init phy_init;
@@ -191,6 +201,8 @@
hsl_phy_autoneg_enable_get phy_autoneg_enable_get;
hsl_phy_restart_autoneg phy_restart_autoneg;
hsl_phy_autoneg_status_get phy_autoneg_status_get;
+ hsl_phy_autoneg_adv_set phy_autoneg_adv_set;
+ hsl_phy_autoneg_adv_get phy_autoneg_adv_get;
hsl_phy_powersave_set phy_powersave_set;
hsl_phy_powersave_get phy_powersave_get;
hsl_phy_cdt phy_cdt;
@@ -213,10 +225,10 @@
hsl_phy_combo_fiber_mode_set phy_combo_fiber_mode_set;
hsl_phy_combo_fiber_mode_get phy_combo_fiber_mode_get;
hsl_phy_reset phy_reset;
+ hsl_phy_power_off phy_power_off;
+ hsl_phy_power_on phy_power_on;
hsl_phy_reset_status_get phy_reset_status_get;
hsl_phy_id_get phy_id_get;
- hsl_phy_autoneg_adv_set phy_autoneg_adv_set;
- hsl_phy_autoneg_adv_get phy_autoneg_adv_get;
hsl_phy_reg_write phy_reg_write;
hsl_phy_reg_read phy_reg_read;
hsl_phy_debug_write phy_debug_write;
@@ -225,9 +237,11 @@
hsl_phy_mmd_read phy_mmd_read;
hsl_phy_magic_frame_mac_set phy_magic_frame_mac_set;
hsl_phy_magic_frame_mac_get phy_magic_frame_mac_get;
- hsl_phy_phy_id_get phy_phy_id_get;
hsl_phy_wol_status_set phy_wol_status_set;
hsl_phy_wol_status_get phy_wol_status_get;
+ hsl_phy_interface_mode_set phy_interface_mode_set;
+ hsl_phy_interface_mode_get phy_interface_mode_get;
+ hsl_phy_interface_mode_status_get phy_interface_mode_status_get;
} hsl_phy_ops_t;
diff --git a/include/hsl/phy/malibu_phy.h b/include/hsl/phy/malibu_phy.h
index 145dbea..4d1c02d 100755
--- a/include/hsl/phy/malibu_phy.h
+++ b/include/hsl/phy/malibu_phy.h
@@ -87,6 +87,12 @@
#define MALIBU_SG_BX_PAGES 0x0
#define MALIBU_SG_COPPER_PAGES 0x1
+#define MALIBU_PHY_PSGMII_BASET 0x0
+#define MALIBU_PHY_PSGMII_BX1000 0x1
+#define MALIBU_PHY_PSGMII_FX100 0x2
+#define MALIBU_PHY_PSGMII_AMDET 0x3
+#define MALIBU_PHY_SGMII_BASET 0x4
+
#define MALIBU_PHY4_PREFER_FIBER 0x400
#define PHY4_PREFER_COPPER 0x0
#define PHY4_PREFER_FIBER 0x1
diff --git a/include/shell_lib/shell_io.h b/include/shell_lib/shell_io.h
index c8cadae..e316a3f 100755
--- a/include/shell_lib/shell_io.h
+++ b/include/shell_lib/shell_io.h
@@ -209,5 +209,20 @@
cmd_data_check_fdb_rfs(char *cmd_str, void * val, a_uint32_t size);
sw_error_t
cmd_data_check_flow_rfs(char *cmd_str, void * val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_crossover_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_crossover_status(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_prefer_medium(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_fiber_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
+
+sw_error_t
+cmd_data_check_interface_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size);
#endif
diff --git a/src/fal/fal_port_ctrl.c b/src/fal/fal_port_ctrl.c
index e61aa32..1c5bc96 100755
--- a/src/fal/fal_port_ctrl.c
+++ b/src/fal/fal_port_ctrl.c
@@ -994,6 +994,171 @@
return rv;
}
+static sw_error_t
+_fal_port_reset (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_reset)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_reset (dev_id, port_id);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_power_off (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_power_off)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_power_off (dev_id, port_id);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_power_on (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_power_on)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_power_on (dev_id, port_id);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_phy_id_get (a_uint32_t dev_id, fal_port_t port_id,a_uint16_t * org_id, a_uint16_t * rev_id)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_phy_id_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_phy_id_get (dev_id, port_id,org_id,rev_id);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_wol_status_set (a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_wol_status_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_wol_status_set (dev_id, port_id,enable);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_wol_status_get (a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_wol_status_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_wol_status_get (dev_id, port_id,enable);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_magic_frame_mac_set (a_uint32_t dev_id, fal_port_t port_id, fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_magic_frame_mac_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_magic_frame_mac_set (dev_id, port_id, mac);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_magic_frame_mac_get (a_uint32_t dev_id, fal_port_t port_id, fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_magic_frame_mac_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_magic_frame_mac_get (dev_id, port_id, mac);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_interface_mode_set (a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t mode)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_interface_mode_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_interface_mode_set (dev_id, port_id, mode);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_interface_mode_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_interface_mode_get (dev_id, port_id, mode);
+ return rv;
+}
+
+static sw_error_t
+_fal_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL (p_api = hsl_api_ptr_get (dev_id));
+
+ if (NULL == p_api->port_interface_mode_status_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->port_interface_mode_status_get (dev_id, port_id, mode);
+ return rv;
+}
+
/**
* @brief Set duplex mode on a particular port.
* @param[in] dev_id device id
@@ -2129,5 +2294,204 @@
}
/**
+ * @brief software reset on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_reset (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_reset (dev_id, port_id);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief power off on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_power_off (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_power_off (dev_id, port_id);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief power on on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_power_on (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_power_on (dev_id, port_id);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief phy id on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_phy_id_get (a_uint32_t dev_id, fal_port_t port_id, a_uint16_t * org_id, a_uint16_t * rev_id)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_phy_id_get (dev_id, port_id,org_id,rev_id);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief wol status on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_wol_status_set (a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_wol_status_set (dev_id, port_id,enable);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief wol status on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_wol_status_get (a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_wol_status_get (dev_id, port_id,enable);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief magic frame mac on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_magic_frame_mac_set (a_uint32_t dev_id, fal_port_t port_id, fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_magic_frame_mac_set (dev_id, port_id,mac);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief magic frame mac on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_magic_frame_mac_get (a_uint32_t dev_id, fal_port_t port_id, fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_magic_frame_mac_get (dev_id, port_id,mac);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief interface mode on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_interface_mode_set (a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t mode)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_interface_mode_set (dev_id, port_id,mode);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief interface mode on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_interface_mode_get (dev_id, port_id,mode);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief interface mode status on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out]
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_port_interface_mode_status_get (dev_id, port_id,mode);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+
+/**
* @}
*/
diff --git a/src/hsl/dess/dess_port_ctrl.c b/src/hsl/dess/dess_port_ctrl.c
index 0bca916..2599321 100755
--- a/src/hsl/dess/dess_port_ctrl.c
+++ b/src/hsl/dess/dess_port_ctrl.c
@@ -1423,6 +1423,49 @@
}
static sw_error_t
+_dess_ports_link_status_get(a_uint32_t dev_id, a_uint32_t * status)
+{
+ sw_error_t rv;
+ a_uint32_t port_id;
+ a_uint32_t phy_id;
+ hsl_dev_t *pdev = NULL;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK(dev_id);
+ if (NULL == phy_drv->phy_link_status_get)
+ return SW_NOT_SUPPORTED;
+
+ pdev = hsl_dev_ptr_get(dev_id);
+ if (pdev == NULL)
+ return SW_NOT_INITIALIZED;
+
+ *status = 0x0;
+ for (port_id = 0; port_id < pdev->nr_ports; port_id++)
+ {
+ /* for those ports without PHY device supposed always link up */
+ if (A_FALSE == _dess_port_phy_connected(dev_id, port_id))
+ {
+ *status |= (0x1 << port_id);
+ }
+ else
+ {
+ rv = hsl_port_prop_get_phyid(dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR(rv);
+
+ if (A_TRUE == phy_drv->phy_link_status_get (dev_id, phy_id))
+ {
+ *status |= (0x1 << port_id);
+ }
+ else
+ {
+ *status &= ~(0x1 << port_id);
+ }
+ }
+ }
+ return SW_OK;
+}
+
+static sw_error_t
_dess_port_mac_loopback_set (a_uint32_t dev_id, fal_port_t port_id,
a_bool_t enable)
{
@@ -2002,6 +2045,299 @@
return rv;
}
+static sw_error_t
+_dess_port_reset (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_reset)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_reset(dev_id, phy_id);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_power_off (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_power_off)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_power_off(dev_id, phy_id);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_power_on (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_power_on)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_power_on(dev_id, phy_id);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_wol_status_set (a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_wol_status_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_wol_status_set (dev_id, phy_id, enable);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_wol_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_wol_status_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_wol_status_get (dev_id, phy_id, enable);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_phy_id_get (a_uint32_t dev_id, fal_port_t port_id,
+ a_uint16_t * org_id, a_uint16_t * rev_id)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_id_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_id_get (dev_id, phy_id,org_id,rev_id);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_magic_frame_mac_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_magic_frame_mac_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_magic_frame_mac_set (dev_id, phy_id,mac);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_magic_frame_mac_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_magic_frame_mac_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_magic_frame_mac_get (dev_id, phy_id,mac);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_interface_mode_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t mode)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_interface_mode_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_interface_mode_set (dev_id, phy_id,mode);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_interface_mode_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_interface_mode_get (dev_id, phy_id,mode);
+
+ return rv;
+}
+
+static sw_error_t
+_dess_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+ a_uint32_t phy_id = 0;
+ hsl_phy_ops_t *phy_drv;
+
+ HSL_DEV_ID_CHECK (dev_id);
+
+ if (A_TRUE != hsl_port_prop_check (dev_id, port_id, HSL_PP_PHY))
+ {
+ return SW_BAD_PARAM;
+ }
+
+ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get (dev_id));
+ if (NULL == phy_drv->phy_interface_mode_status_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = hsl_port_prop_get_phyid (dev_id, port_id, &phy_id);
+ SW_RTN_ON_ERROR (rv);
+
+ rv = phy_drv->phy_interface_mode_status_get (dev_id, phy_id,mode);
+
+ return rv;
+}
+
/**
* @brief Set duplex mode on a particular port.
* @param[in] dev_id device id
@@ -2698,6 +3034,23 @@
}
/**
+ * @brief Get link status on all ports.
+ * @param[in] dev_id device id
+ * @param[out] status link status bitmap and bit 0 for port 0, bi 1 for port 1, ..., etc.
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_ports_link_status_get(a_uint32_t dev_id, a_uint32_t * status)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_ports_link_status_get(dev_id, status);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
* @brief Set mac loop back on a particular port.
* @param[in] dev_id device id
* @param[in] port_id port id
@@ -3077,6 +3430,203 @@
return rv;
}
+/**
+ * @brief software reset on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[in]
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_reset (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_reset (dev_id, port_id);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief phy power off on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[in]
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_power_off (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_power_off (dev_id, port_id);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief phy power on on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[in]
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_power_on (a_uint32_t dev_id, fal_port_t port_id)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_power_on (dev_id, port_id);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Set phy wol enable on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[in] enable A_TRUE or A_FALSE
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_wol_status_set (a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t enable)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_wol_status_set (dev_id, port_id, enable);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get phy wol status on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out] enable A_TRUE or A_FALSE
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_wol_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ a_bool_t * enable)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_port_wol_status_get (dev_id, port_id, enable);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get phy id on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out] org_id and rev_id
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_phy_id_get (a_uint32_t dev_id, fal_port_t port_id,
+ a_uint16_t * org_id, a_uint16_t * rev_id)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_port_phy_id_get (dev_id, port_id, org_id,rev_id);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Set phy magic frame mac on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[in] mac address
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_magic_frame_mac_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_magic_frame_mac_set (dev_id, port_id, mac);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get phy magic frame mac on a particular port.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out] mac address
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_magic_frame_mac_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_mac_addr_t * mac)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_magic_frame_mac_get (dev_id, port_id, mac);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+
+/**
+ * @brief Set phy interface mode.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[in] interface mode..
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_interface_mode_set (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t mode)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_interface_mode_set (dev_id, port_id, mode);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Set phy interface mode.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out] interface mode..
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_interface_mode_get (dev_id, port_id, mode);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Set phy interface mode status.
+ * @param[in] dev_id device id
+ * @param[in] port_id port id
+ * @param[out] interface mode..
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id,
+ fal_port_interface_mode_t * mode)
+{
+ sw_error_t rv;
+ HSL_API_LOCK;
+ rv = _dess_port_interface_mode_status_get (dev_id, port_id, mode);
+ HSL_API_UNLOCK;
+ return rv;
+}
sw_error_t
dess_port_ctrl_init (a_uint32_t dev_id)
@@ -3126,6 +3676,7 @@
p_api->port_link_forcemode_set = dess_port_link_forcemode_set;
p_api->port_link_forcemode_get = dess_port_link_forcemode_get;
p_api->port_link_status_get = dess_port_link_status_get;
+ p_api->ports_link_status_get = dess_ports_link_status_get;
p_api->port_mac_loopback_set = dess_port_mac_loopback_set;
p_api->port_mac_loopback_get = dess_port_mac_loopback_get;
p_api->port_congestion_drop_set = dess_port_congestion_drop_set;
@@ -3146,6 +3697,17 @@
p_api->port_local_loopback_get = dess_port_local_loopback_get;
p_api->port_remote_loopback_set = dess_port_remote_loopback_set;
p_api->port_remote_loopback_get = dess_port_remote_loopback_get;
+ p_api->port_reset = dess_port_reset;
+ p_api->port_power_off = dess_port_power_off;
+ p_api->port_power_on = dess_port_power_on;
+ p_api->port_phy_id_get = dess_port_phy_id_get;
+ p_api->port_wol_status_set = dess_port_wol_status_set;
+ p_api->port_wol_status_get = dess_port_wol_status_get;
+ p_api->port_magic_frame_mac_set = dess_port_magic_frame_mac_set;
+ p_api->port_magic_frame_mac_get = dess_port_magic_frame_mac_get;
+ p_api->port_interface_mode_set = dess_port_interface_mode_set;
+ p_api->port_interface_mode_get = dess_port_interface_mode_get;
+ p_api->port_interface_mode_status_get = dess_port_interface_mode_status_get;
}
#endif
diff --git a/src/hsl/phy/malibu_phy.c b/src/hsl/phy/malibu_phy.c
index 413cfca..ec7f548 100755
--- a/src/hsl/phy/malibu_phy.c
+++ b/src/hsl/phy/malibu_phy.c
@@ -47,8 +47,37 @@
HSL_PHY_SET(rv, dev_id, phy_addr, reg, phy_data);
}
-#define malibu_phy_reg_read _phy_reg_read
-#define malibu_phy_reg_write _phy_reg_write
+/* #define malibu_phy_reg_read _phy_reg_read */
+/* #define malibu_phy_reg_write _phy_reg_write */
+
+/******************************************************************************
+*
+* malibu_phy_mii_read - mii register read
+*
+* mii register read
+*/
+a_uint16_t
+malibu_phy_reg_read(a_uint32_t dev_id, a_uint32_t phy_id, a_uint32_t reg_id)
+{
+ return _phy_reg_read(dev_id, phy_id, reg_id);
+
+}
+
+/******************************************************************************
+*
+* malibu_phy_mii_write - mii register write
+*
+* mii register write
+*/
+sw_error_t
+malibu_phy_reg_write(a_uint32_t dev_id, a_uint32_t phy_id, a_uint32_t reg_id,
+ a_uint16_t reg_val)
+{
+
+ _phy_reg_write(dev_id,phy_id, reg_id, reg_val);
+
+ return SW_OK;
+}
/******************************************************************************
*
@@ -241,6 +270,175 @@
/******************************************************************************
*
+* malibu_phy_set_powersave - set power saving status
+*
+* set power saving status
+*/
+sw_error_t
+malibu_phy_set_powersave(a_uint32_t dev_id, a_uint32_t phy_id, a_bool_t enable)
+{
+ a_uint16_t phy_data;
+
+ if (phy_id == COMBO_PHY_ID) {
+ if (MALIBU_PHY_MEDIUM_COPPER !=
+ __phy_active_medium_get(dev_id, phy_id))
+ return SW_NOT_SUPPORTED;
+ }
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_DEBUG_PORT_ADDRESS,
+ MALIBU_DEBUG_PHY_POWER_SAVING_CTRL);
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_DEBUG_PORT_DATA);
+
+ if (enable == A_TRUE) {
+ phy_data |= 0x8000;
+ } else {
+ phy_data &= ~0x8000;
+ }
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_DEBUG_PORT_DATA, phy_data);
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_get_powersave - get power saving status
+*
+* set power saving status
+*/
+sw_error_t
+malibu_phy_get_powersave(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_bool_t * enable)
+{
+ a_uint16_t phy_data;
+
+ if (phy_id == COMBO_PHY_ID) {
+ if (MALIBU_PHY_MEDIUM_COPPER !=
+ __phy_active_medium_get(dev_id, phy_id))
+ return SW_NOT_SUPPORTED;
+ }
+
+ *enable = A_FALSE;
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_DEBUG_PORT_ADDRESS,
+ MALIBU_DEBUG_PHY_POWER_SAVING_CTRL);
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_DEBUG_PORT_DATA);
+
+ if (phy_data & 0x8000)
+ *enable = A_TRUE;
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_set_802.3az
+*
+* set 802.3az status
+*/
+sw_error_t
+malibu_phy_set_8023az(a_uint32_t dev_id, a_uint32_t phy_id, a_bool_t enable)
+{
+ a_uint16_t phy_data;
+ if (phy_id == COMBO_PHY_ID) {
+ if (MALIBU_PHY_MEDIUM_COPPER !=
+ __phy_active_medium_get(dev_id, phy_id))
+ return SW_NOT_SUPPORTED;
+ }
+
+ phy_data = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD7_NUM,
+ MALIBU_PHY_MMD7_ADDR_8023AZ_EEE_CTRL);
+
+ if (enable == A_TRUE) {
+ phy_data |= 0x0006;
+ } else {
+ phy_data &= ~0x0006;
+ }
+
+ malibu_phy_mmd_write(dev_id, phy_id, MALIBU_PHY_MMD7_NUM,
+ MALIBU_PHY_MMD7_ADDR_8023AZ_EEE_CTRL, phy_data);
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_get_8023az status
+*
+* get 8023az status
+*/
+sw_error_t
+malibu_phy_get_8023az(a_uint32_t dev_id, a_uint32_t phy_id, a_bool_t * enable)
+{
+ a_uint16_t phy_data;
+ if (phy_id == COMBO_PHY_ID) {
+ if (MALIBU_PHY_MEDIUM_COPPER !=
+ __phy_active_medium_get(dev_id, phy_id))
+ return SW_NOT_SUPPORTED;
+ }
+
+ *enable = A_FALSE;
+
+ phy_data = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD7_NUM,
+ MALIBU_PHY_MMD7_ADDR_8023AZ_EEE_CTRL);
+
+ if ((phy_data & 0x0004) && (phy_data & 0x0002))
+ *enable = A_TRUE;
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_set_hibernate - set hibernate status
+*
+* set hibernate status
+*/
+sw_error_t
+malibu_phy_set_hibernate(a_uint32_t dev_id, a_uint32_t phy_id, a_bool_t enable)
+{
+ a_uint16_t phy_data;
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_DEBUG_PORT_ADDRESS,
+ MALIBU_DEBUG_PHY_HIBERNATION_CTRL);
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_DEBUG_PORT_DATA);
+
+ if (enable == A_TRUE) {
+ phy_data |= 0x8000;
+ } else {
+ phy_data &= ~0x8000;
+ }
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_DEBUG_PORT_DATA, phy_data);
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_get_hibernate - get hibernate status
+*
+* get hibernate status
+*/
+sw_error_t
+malibu_phy_get_hibernate(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_bool_t * enable)
+{
+ a_uint16_t phy_data;
+
+ *enable = A_FALSE;
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_DEBUG_PORT_ADDRESS,
+ MALIBU_DEBUG_PHY_HIBERNATION_CTRL);
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_DEBUG_PORT_DATA);
+
+ if (phy_data & 0x8000)
+ *enable = A_TRUE;
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
* malibu_phy_set combo medium type
*
* set combo medium fiber or copper
@@ -458,6 +656,331 @@
return SW_OK;
}
+
+/******************************************************************************
+*
+* malibu_phy_set_local_loopback
+*
+* set phy local loopback
+*/
+sw_error_t
+malibu_phy_set_local_loopback(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_bool_t enable)
+{
+ a_uint16_t phy_data;
+
+ if (phy_id == COMBO_PHY_ID) {
+
+ __phy_reg_pages_sel_by_active_medium(dev_id, phy_id);
+
+ }
+
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_CONTROL);
+
+ if (enable == A_TRUE) {
+ phy_data |= MALIBU_LOCAL_LOOPBACK_ENABLE;
+ phy_data &= ~MALIBU_CTRL_AUTONEGOTIATION_ENABLE;
+ } else {
+ phy_data |= MALIBU_CTRL_AUTONEGOTIATION_ENABLE;
+ phy_data &= ~MALIBU_LOCAL_LOOPBACK_ENABLE;
+ }
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_PHY_CONTROL, phy_data);
+ return SW_OK;
+
+}
+
+/******************************************************************************
+*
+* malibu_phy_get_local_loopback
+*
+* get phy local loopback
+*/
+sw_error_t
+malibu_phy_get_local_loopback(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_bool_t * enable)
+{
+ a_uint16_t phy_data;
+
+ if (phy_id == COMBO_PHY_ID) {
+
+ __phy_reg_pages_sel_by_active_medium(dev_id, phy_id);
+
+ }
+
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_CONTROL);
+
+ if (phy_data & MALIBU_LOCAL_LOOPBACK_ENABLE) {
+ *enable = A_TRUE;
+ } else {
+ *enable = A_FALSE;
+ }
+
+ return SW_OK;
+
+}
+
+/******************************************************************************
+*
+* malibu_phy_set_remote_loopback
+*
+* set phy remote loopback
+*/
+sw_error_t
+malibu_phy_set_remote_loopback(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_bool_t enable)
+{
+ a_uint16_t phy_data;
+
+ phy_data == malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_ADDR_REMOTE_LOOPBACK_CTRL);
+
+ if (enable == A_TRUE) {
+ phy_data |= 0x0001;
+ } else {
+ phy_data &= ~0x0001;
+ }
+
+ malibu_phy_mmd_write(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_ADDR_REMOTE_LOOPBACK_CTRL,
+ phy_data);
+ return SW_OK;
+
+}
+
+/******************************************************************************
+*
+* malibu_phy_get_remote_loopback
+*
+* get phy remote loopback
+*/
+sw_error_t
+malibu_phy_get_remote_loopback(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_bool_t * enable)
+{
+ a_uint16_t phy_data;
+
+ phy_data == malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_ADDR_REMOTE_LOOPBACK_CTRL);
+
+ if (phy_data & 0x0001) {
+ *enable = A_TRUE;
+ } else {
+ *enable = A_FALSE;
+ }
+
+ return SW_OK;
+
+}
+
+/******************************************************************************
+*
+* malibu_phy_cdt - cable diagnostic test
+*
+* cable diagnostic test
+*/
+
+static inline fal_cable_status_t _phy_cdt_status_mapping(a_uint16_t status)
+{
+ fal_cable_status_t status_mapping = FAL_CABLE_STATUS_INVALID;
+
+ if (0 == status)
+ status_mapping = FAL_CABLE_STATUS_INVALID;
+ else if (1 == status)
+ status_mapping = FAL_CABLE_STATUS_NORMAL;
+ else if (2 == status)
+ status_mapping = FAL_CABLE_STATUS_OPENED;
+ else if (3 == status)
+ status_mapping = FAL_CABLE_STATUS_SHORT;
+
+ return status_mapping;
+}
+
+static sw_error_t malibu_phy_cdt_start(a_uint32_t dev_id, a_uint32_t phy_id)
+{
+ a_uint16_t status = 0;
+ a_uint16_t ii = 100;
+
+ if (phy_id == COMBO_PHY_ID) {
+
+ if (MALIBU_PHY_MEDIUM_COPPER !=
+ __phy_active_medium_get(dev_id, phy_id))
+ return SW_NOT_SUPPORTED;
+
+ __phy_reg_pages_sel(dev_id, phy_id, MALIBU_PHY_COPPER_PAGES);
+ }
+
+ /* RUN CDT */
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_PHY_CDT_CONTROL,
+ RUN_CDT | CABLE_LENGTH_UNIT);
+ do {
+ aos_mdelay(30);
+ status =
+ malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_CDT_CONTROL);
+ }
+ while ((status & RUN_CDT) && (--ii));
+
+ return SW_OK;
+}
+
+sw_error_t
+malibu_phy_cdt_get(a_uint32_t dev_id, a_uint32_t phy_id,
+ fal_port_cdt_t * port_cdt)
+{
+ a_uint16_t status = 0;
+ a_uint16_t cable_delta_time = 0;
+ a_uint16_t org_debug_value = 0;
+ int ii = 100;
+ a_bool_t link_st = A_FALSE;
+ a_uint16_t reg806e = 0;
+ int i;
+
+ if ((!port_cdt) || (phy_id > 4)) {
+ return SW_FAIL;
+ }
+#if 0
+ /*disable clock gating */
+ org_debug_value = f1_phy_debug_read(dev_id, phy_id, 0x3f);
+ f1_phy_debug_write(dev_id, phy_id, 0x3f, 0);
+#endif
+
+ malibu_phy_cdt_start(dev_id, phy_id);
+
+ /* Get cable status */
+ status = malibu_phy_mmd_read(dev_id, phy_id, 3, 0x8064);
+
+#if 0
+ /* Workaround for cable lenth less than 20M */
+ port_cdt->pair_c_status = (status >> 4) & 0x3;
+ /* Get Cable Length value */
+ cable_delta_time = f1_phy_mmd_read(dev_id, phy_id, 3, 0x8067);
+ /* the actual cable length equals to CableDeltaTime * 0.824 */
+ port_cdt->pair_c_len = (cable_delta_time * 824) / 1000;
+ if ((1 == port_cdt->pair_c_status) &&
+ (port_cdt->pair_c_len > 0) && (port_cdt->pair_c_len <= 20)) {
+ reg806e = f1_phy_mmd_read(dev_id, phy_id, 3, 0x806e);
+ f1_phy_mmd_write(dev_id, phy_id, 3, 0x806e,
+ reg806e & (~0x8000));
+
+ f1_phy_reset(dev_id, phy_id);
+ f1_phy_reset_done(dev_id, phy_id);
+ do {
+ link_st = f1_phy_get_link_status(dev_id, phy_id);
+ aos_mdelay(100);
+ } while ((A_FALSE == link_st) && (--ii));
+
+ f1_phy_cdt_start(dev_id, phy_id);
+ /* Get cable status */
+ status = f1_phy_mmd_read(dev_id, phy_id, 3, 0x8064);
+ }
+#endif
+
+ for (i = 0; i < 4; i++) {
+ switch (i) {
+ case 0:
+ port_cdt->pair_a_status = (status >> 12) & 0x3;
+ /* Get Cable Length value */
+ cable_delta_time =
+ malibu_phy_mmd_read(dev_id, phy_id, 3, 0x8065);
+ /* the actual cable length equals to CableDeltaTime * 0.824 */
+ port_cdt->pair_a_len =
+ ((cable_delta_time & 0xff) * 800) / 1000;
+
+ break;
+ case 1:
+ port_cdt->pair_b_status = (status >> 8) & 0x3;
+ /* Get Cable Length value */
+ cable_delta_time =
+ malibu_phy_mmd_read(dev_id, phy_id, 3, 0x8066);
+ /* the actual cable length equals to CableDeltaTime * 0.824 */
+ port_cdt->pair_b_len =
+ ((cable_delta_time & 0xff) * 800) / 1000;
+ break;
+ case 2:
+ port_cdt->pair_c_status = (status >> 4) & 0x3;
+ /* Get Cable Length value */
+ cable_delta_time =
+ malibu_phy_mmd_read(dev_id, phy_id, 3, 0x8067);
+ /* the actual cable length equals to CableDeltaTime * 0.824 */
+ port_cdt->pair_c_len =
+ ((cable_delta_time & 0xff) * 800) / 1000;
+ break;
+ case 3:
+ port_cdt->pair_d_status = status & 0x3;
+ /* Get Cable Length value */
+ cable_delta_time =
+ malibu_phy_mmd_read(dev_id, phy_id, 3, 0x8068);
+ /* the actual cable length equals to CableDeltaTime * 0.824 */
+ port_cdt->pair_d_len =
+ ((cable_delta_time & 0xff) * 800) / 1000;
+ break;
+ default:
+ break;
+ }
+ }
+
+#if 0
+ /*restore debug port value */
+ f1_phy_debug_write(dev_id, phy_id, 0x3f, org_debug_value);
+#endif
+
+ return SW_OK;
+}
+
+sw_error_t
+malibu_phy_cdt(a_uint32_t dev_id, a_uint32_t phy_id, a_uint32_t mdi_pair,
+ fal_cable_status_t * cable_status, a_uint32_t * cable_len)
+{
+ fal_port_cdt_t malibu_port_cdt;
+
+ if (phy_id == COMBO_PHY_ID) {
+
+ if (MALIBU_PHY_MEDIUM_COPPER !=
+ __phy_active_medium_get(dev_id, phy_id))
+ return SW_NOT_SUPPORTED;
+
+ __phy_reg_pages_sel(dev_id, phy_id, MALIBU_PHY_COPPER_PAGES);
+ }
+
+ if ((mdi_pair >= 4) || (phy_id > 4)) {
+ //There are only 4 mdi pairs in 1000BASE-T
+ return SW_BAD_PARAM;
+ }
+
+ malibu_phy_cdt_get(dev_id, phy_id, &malibu_port_cdt);
+
+ switch (mdi_pair) {
+ case 0:
+ *cable_status =
+ _phy_cdt_status_mapping(malibu_port_cdt.pair_a_status);
+ /* Get Cable Length value */
+ *cable_len = malibu_port_cdt.pair_a_len;
+ break;
+ case 1:
+ *cable_status =
+ _phy_cdt_status_mapping(malibu_port_cdt.pair_b_status);
+ /* Get Cable Length value */
+ *cable_len = malibu_port_cdt.pair_b_len;
+ break;
+ case 2:
+ *cable_status =
+ _phy_cdt_status_mapping(malibu_port_cdt.pair_c_status);
+ /* Get Cable Length value */
+ *cable_len = malibu_port_cdt.pair_c_len;
+ break;
+ case 3:
+ *cable_status =
+ _phy_cdt_status_mapping(malibu_port_cdt.pair_d_status);
+ /* Get Cable Length value */
+ *cable_len = malibu_port_cdt.pair_d_len;
+ break;
+ default:
+ break;
+ }
+
+ return SW_OK;
+}
+
/******************************************************************************
*
* malibu_phy_reset_done - reset the phy
@@ -1360,18 +1883,377 @@
return SW_OK;
}
+
+/******************************************************************************
+*
+* malibu_phy_set wol frame mac address
+*
+* set phy wol frame mac address
+*/
+sw_error_t
+malibu_phy_set_magic_frame_mac(a_uint32_t dev_id, a_uint32_t phy_id,
+ fal_mac_addr_t * mac)
+{
+ a_uint16_t phy_data1;
+ a_uint16_t phy_data2;
+ a_uint16_t phy_data3;
+
+ phy_data1 = (mac->uc[0] << 8) | mac->uc[1];
+ phy_data2 = (mac->uc[2] << 8) | mac->uc[3];
+ phy_data3 = (mac->uc[4] << 8) | mac->uc[5];
+
+ malibu_phy_mmd_write(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_MAGIC_MAC_CTRL1, phy_data1);
+
+ malibu_phy_mmd_write(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_MAGIC_MAC_CTRL2, phy_data2);
+
+ malibu_phy_mmd_write(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_MAGIC_MAC_CTRL3, phy_data3);
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_get wol frame mac address
+*
+* get phy wol frame mac address
+*/
+sw_error_t
+malibu_phy_get_magic_frame_mac(a_uint32_t dev_id, a_uint32_t phy_id,
+ fal_mac_addr_t * mac)
+{
+ a_uint16_t phy_data1;
+ a_uint16_t phy_data2;
+ a_uint16_t phy_data3;
+
+ phy_data1 = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_MAGIC_MAC_CTRL1);
+
+ phy_data2 = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_MAGIC_MAC_CTRL2);
+
+ phy_data3 = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_MAGIC_MAC_CTRL3);
+
+ mac->uc[0] = (phy_data1 >> 8);
+ mac->uc[1] = (phy_data1 & 0x00ff);
+ mac->uc[2] = (phy_data2 >> 8);
+ mac->uc[3] = (phy_data2 & 0x00ff);
+ mac->uc[4] = (phy_data3 >> 8);
+ mac->uc[5] = (phy_data3 & 0x00ff);
+ phy_data2 = (mac->uc[2] << 8) | mac->uc[3];
+ phy_data3 = (mac->uc[4] << 8) | mac->uc[5];
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_set wol enable or disable
+*
+* set phy wol enable or disable
+*/
+sw_error_t
+malibu_phy_set_wol_status(a_uint32_t dev_id, a_uint32_t phy_id, a_bool_t enable)
+{
+ a_uint16_t phy_data;
+ phy_data = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_CTRL);
+
+ if (enable == A_TRUE) {
+ phy_data |= 0x0020;
+ } else {
+ phy_data &= ~0x0020;
+ }
+
+ malibu_phy_mmd_write(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_CTRL, phy_data);
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_get_wol status
+*
+* get wol status
+*/
+sw_error_t
+malibu_phy_get_wol_status(a_uint32_t dev_id, a_uint32_t phy_id, a_bool_t * enable)
+{
+ a_uint16_t phy_data;
+
+ *enable = A_FALSE;
+
+ phy_data = malibu_phy_mmd_read(dev_id, phy_id, MALIBU_PHY_MMD3_NUM,
+ MALIBU_PHY_MMD3_WOL_CTRL);
+
+ if (phy_data & 0x0020)
+ *enable = A_TRUE;
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_interface mode set
+*
+* set malibu phy interface mode
+*/
+sw_error_t
+malibu_phy_interface_set_mode(a_uint32_t dev_id, a_uint32_t phy_id, fal_port_interface_mode_t interface_mode)
+{
+ a_uint16_t phy_data;
+ if (phy_id != COMBO_PHY_ID)
+ return SW_NOT_SUPPORTED;
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_CHIP_CONFIG);
+ phy_data &= 0xfff0;
+
+ if (interface_mode == PHY_PSGMII_BASET) {
+ phy_data |= MALIBU_PHY_PSGMII_BASET;
+ } else if (interface_mode == PHY_PSGMII_BX1000) {
+ phy_data |= MALIBU_PHY_PSGMII_BX1000;
+ } else if (interface_mode == PHY_PSGMII_FX100) {
+ phy_data |= MALIBU_PHY_PSGMII_FX100;
+ } else if (interface_mode == PHY_PSGMII_AMDET) {
+ phy_data |= MALIBU_PHY_PSGMII_AMDET;
+ } else if (interface_mode == PHY_SGMII_BASET) {
+ phy_data |= MALIBU_PHY_SGMII_BASET;
+ } else {
+ return SW_BAD_PARAM;
+ }
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_PHY_CHIP_CONFIG, phy_data);
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_interface mode get
+*
+* get malibu phy interface mode
+*/
+sw_error_t
+malibu_phy_interface_get_mode(a_uint32_t dev_id, a_uint32_t phy_id, fal_port_interface_mode_t *interface_mode)
+{
+ a_uint16_t phy_data;
+ if (phy_id != COMBO_PHY_ID)
+ return SW_NOT_SUPPORTED;
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_CHIP_CONFIG);
+ phy_data &= 0x000f;
+ *interface_mode = phy_data;
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_interface mode status get
+*
+* get malibu phy interface mode status
+*/
+sw_error_t
+malibu_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;
+ if (phy_id != COMBO_PHY_ID)
+ return SW_NOT_SUPPORTED;
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_CHIP_CONFIG);
+ phy_data &= 0x00f0;
+ phy_data = (phy_data >>4);
+ *interface_mode_status = phy_data;
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_intr_mask_set - Set interrupt mask with the
+* specified device.
+*/
+sw_error_t
+malibu_phy_intr_mask_set(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_uint32_t intr_mask_flag)
+{
+ a_uint16_t phy_data = 0;
+
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_INTR_MASK);
+
+ if (FAL_PHY_INTR_STATUS_UP_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_STATUS_UP_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_STATUS_UP_CHANGE);
+ }
+
+ if (FAL_PHY_INTR_STATUS_DOWN_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_STATUS_DOWN_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_STATUS_DOWN_CHANGE);
+ }
+
+ if (FAL_PHY_INTR_SPEED_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_SPEED_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_SPEED_CHANGE);
+ }
+
+ if (FAL_PHY_INTR_DUPLEX_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_DUPLEX_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_DUPLEX_CHANGE);
+ }
+
+ if (FAL_PHY_INTR_BX_FX_STATUS_UP_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_BX_FX_STATUS_UP_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_BX_FX_STATUS_UP_CHANGE);
+ }
+
+ if (FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE);
+ }
+
+ malibu_phy_reg_write(dev_id, phy_id, MALIBU_PHY_INTR_MASK, phy_data);
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_intr_mask_get - Get interrupt mask with the
+* specified device.
+*/
+sw_error_t
+malibu_phy_intr_mask_get(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_uint32_t * intr_mask_flag)
+{
+ a_uint16_t phy_data = 0;
+
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_INTR_MASK);
+
+ *intr_mask_flag = 0;
+ if (MALIBU_INTR_STATUS_UP_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_STATUS_UP_CHANGE;
+ }
+
+ if (MALIBU_INTR_STATUS_DOWN_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_STATUS_DOWN_CHANGE;
+ }
+
+ if (MALIBU_INTR_SPEED_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_SPEED_CHANGE;
+ }
+
+ if (MALIBU_INTR_DUPLEX_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_DUPLEX_CHANGE;
+ }
+
+ if (MALIBU_INTR_BX_FX_STATUS_UP_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_BX_FX_STATUS_UP_CHANGE;
+ }
+
+ if (MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE;
+ }
+
+ return SW_OK;
+}
+
+/******************************************************************************
+*
+* malibu_phy_intr_status_get - Get interrupt status with the
+* specified device.
+*/
+sw_error_t
+malibu_phy_intr_status_get(a_uint32_t dev_id, a_uint32_t phy_id,
+ a_uint32_t * intr_status_flag)
+{
+ a_uint16_t phy_data = 0;
+
+ phy_data = malibu_phy_reg_read(dev_id, phy_id, MALIBU_PHY_INTR_STATUS);
+
+ *intr_status_flag = 0;
+ if (MALIBU_INTR_STATUS_UP_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_STATUS_UP_CHANGE;
+ }
+
+ if (MALIBU_INTR_STATUS_DOWN_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_STATUS_DOWN_CHANGE;
+ }
+
+ if (MALIBU_INTR_SPEED_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_SPEED_CHANGE;
+ }
+
+ if (MALIBU_INTR_DUPLEX_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_DUPLEX_CHANGE;
+ }
+
+ if (MALIBU_INTR_BX_FX_STATUS_UP_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_BX_FX_STATUS_UP_CHANGE;
+ }
+
+ if (MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE;
+ }
+
+ return SW_OK;
+}
+
static int malibu_phy_probe(struct phy_device *pdev)
{
int ret;
hsl_phy_ops_t malibu_phy_api_ops = { 0 };
-#if 0
- malibu_phy_api_ops.phy_powersave_set = malibu_phy_set_powersave;
- malibu_phy_api_ops.phy_powersave_get = malibu_phy_get_powersave;
malibu_phy_api_ops.phy_hibernation_set = malibu_phy_set_hibernate;
malibu_phy_api_ops.phy_hibernation_get = malibu_phy_get_hibernate;
+ malibu_phy_api_ops.phy_speed_get = malibu_phy_get_speed;
+ malibu_phy_api_ops.phy_speed_set = malibu_phy_set_speed;
+ malibu_phy_api_ops.phy_duplex_get = malibu_phy_get_duplex;
+ malibu_phy_api_ops.phy_duplex_set = malibu_phy_set_duplex;
+ malibu_phy_api_ops.phy_autoneg_enable_set = malibu_phy_enable_autoneg;
+ malibu_phy_api_ops.phy_restart_autoneg = malibu_phy_restart_autoneg;
+ malibu_phy_api_ops.phy_autoneg_status_get = malibu_phy_autoneg_status;
+ malibu_phy_api_ops.phy_autoneg_adv_set = malibu_phy_set_autoneg_adv;
+ malibu_phy_api_ops.phy_autoneg_adv_get = malibu_phy_get_autoneg_adv;
+ malibu_phy_api_ops.phy_powersave_set = malibu_phy_set_powersave;
+ malibu_phy_api_ops.phy_powersave_get = malibu_phy_get_powersave;
malibu_phy_api_ops.phy_cdt = malibu_phy_cdt;
-#endif
+ malibu_phy_api_ops.phy_link_status_get = malibu_phy_get_link_status;
+ malibu_phy_api_ops.phy_mdix_set = malibu_phy_set_mdix;
+ malibu_phy_api_ops.phy_mdix_get = malibu_phy_get_mdix;
+ malibu_phy_api_ops.phy_mdix_status_get = malibu_phy_get_mdix_status;
+ malibu_phy_api_ops.phy_8023az_set = malibu_phy_set_8023az;
+ malibu_phy_api_ops.phy_8023az_get = malibu_phy_get_8023az;
+ malibu_phy_api_ops.phy_local_loopback_set = malibu_phy_set_local_loopback;
+ malibu_phy_api_ops.phy_local_loopback_get = malibu_phy_get_local_loopback;
+ malibu_phy_api_ops.phy_remote_loopback_set = malibu_phy_set_remote_loopback;
+ malibu_phy_api_ops.phy_remote_loopback_get = malibu_phy_get_remote_loopback;
+ malibu_phy_api_ops.phy_combo_prefer_medium_set = malibu_phy_set_combo_prefer_medium;
+ malibu_phy_api_ops.phy_combo_prefer_medium_get = malibu_phy_get_combo_prefer_medium;
+ malibu_phy_api_ops.phy_combo_medium_status_get = malibu_phy_get_combo_current_medium_type;
+ malibu_phy_api_ops.phy_combo_fiber_mode_set = malibu_phy_set_combo_fiber_mode;
+ malibu_phy_api_ops.phy_combo_fiber_mode_get = malibu_phy_get_combo_fiber_mode;
+ malibu_phy_api_ops.phy_reset = malibu_phy_reset;
+ malibu_phy_api_ops.phy_power_off = malibu_phy_poweroff;
+ malibu_phy_api_ops.phy_power_on = malibu_phy_poweron;
+ malibu_phy_api_ops.phy_id_get = malibu_phy_get_phy_id;
+ malibu_phy_api_ops.phy_reg_write = malibu_phy_reg_write;
+ malibu_phy_api_ops.phy_reg_read = malibu_phy_reg_read;
+ malibu_phy_api_ops.phy_debug_write = malibu_phy_debug_write;
+ malibu_phy_api_ops.phy_debug_read = malibu_phy_debug_read;
+ malibu_phy_api_ops.phy_mmd_write = malibu_phy_mmd_write;
+ malibu_phy_api_ops.phy_mmd_read = malibu_phy_mmd_read;
+ malibu_phy_api_ops.phy_magic_frame_mac_set = malibu_phy_set_magic_frame_mac;
+ malibu_phy_api_ops.phy_magic_frame_mac_get = malibu_phy_get_magic_frame_mac;
+ malibu_phy_api_ops.phy_wol_status_set = malibu_phy_set_wol_status;
+ malibu_phy_api_ops.phy_wol_status_get = malibu_phy_set_wol_status;
+ malibu_phy_api_ops.phy_interface_mode_set = malibu_phy_interface_set_mode;
+ malibu_phy_api_ops.phy_interface_mode_get = malibu_phy_interface_get_mode;
+ malibu_phy_api_ops.phy_interface_mode_status_get = malibu_phy_interface_get_mode_status;
+
ret = hsl_phy_api_ops_register(&malibu_phy_api_ops);
return ret;
@@ -1384,7 +2266,6 @@
hsl_phy_ops_t malibu_phy_api_ops;
ret = hsl_phy_api_ops_unregister(&malibu_phy_api_ops);
- return ret;
}
/******************************************************************************
diff --git a/src/shell_lib/shell_config.c b/src/shell_lib/shell_config.c
index b9dfdbf..15584b6 100755
--- a/src/shell_lib/shell_config.c
+++ b/src/shell_lib/shell_config.c
@@ -49,8 +49,32 @@
{"bpstatus", "set", "set back pressure status of a port", "<port_id> <enable|disable>", SW_API_BP_STATUS_SET, NULL},
{"linkforcemode", "set", "set link force mode of a port", "<port_id> <enable|disable>", SW_API_PT_LINK_MODE_SET, NULL},
{"macLoopback", "set", "set mac level loop back mode of port", "<port_id> <enable|disable>", SW_API_PT_MAC_LOOPBACK_SET, NULL},
- {"congedrop", "set", "set congestion drop of port queue", "<port_id> <queue_id> <enable|disable>", SW_API_PT_CONGESTION_DROP_SET, NULL},
- {"ringfcthresh", "set", "set flwo ctrl thres of ring", "<ring_id> <on_thres> <off_thres>", SW_API_PT_RING_FLOW_CTRL_THRES_SET, NULL},
+ {"congedrop", "set", "set congestion drop of port queue", "<port_id> <queue_id> <enable|disable>", SW_API_PT_CONGESTION_DROP_SET, NULL},
+ {"ringfcthresh", "set", "set flwo ctrl thres of ring", "<ring_id> <on_thres> <off_thres>", SW_API_PT_RING_FLOW_CTRL_THRES_SET, NULL},
+ {"8023az", "set", "set 8023az status of a port", "<port_id> <enable|disable>", SW_API_PT_8023AZ_SET, NULL},
+ {"crossover", "set", "set crossover mode of a port", "<port_id> <auto|mdi|mdix>", SW_API_PT_MDIX_SET, NULL},
+ {"crossover", "get", "get crossover mode of a port", "<port_id>", SW_API_PT_MDIX_GET, NULL},
+ {"crossover", "status", "get current crossover status of a port", "<port_id>", SW_API_PT_MDIX_STATUS_GET, NULL},
+ {"preferMedium", "set", "set prefer medium of a combo port", "<port_id> <copper|fiber>", SW_API_PT_COMBO_PREFER_MEDIUM_SET, NULL},
+ {"preferMedium", "get", "get prefer medium of a combo port", "<port_id>", SW_API_PT_COMBO_PREFER_MEDIUM_GET, NULL},
+ {"mediumType", "get", "get current medium status of a combo port", "<port_id>", SW_API_PT_COMBO_MEDIUM_STATUS_GET, NULL},
+ {"fiberMode", "set", "set fiber mode of a combo fiber port", "<port_id> <100fx|1000bx>", SW_API_PT_COMBO_FIBER_MODE_SET, NULL},
+ {"fiberMode", "get", "get fiber mode of a combo fiber port", "<port_id>", SW_API_PT_COMBO_FIBER_MODE_GET, NULL},
+ {"localLoopback", "set", "set local loopback of a port", "<port_id> <enable|disable>", SW_API_PT_LOCAL_LOOPBACK_SET, NULL},
+ {"localLoopback", "get", "get local loopback of a port", "<port_id>", SW_API_PT_LOCAL_LOOPBACK_GET, NULL},
+ {"remoteLoopback", "set", "set remote loopback of a port", "<port_id> <enable|disable>", SW_API_PT_REMOTE_LOOPBACK_SET, NULL},
+ {"remoteLoopback", "get", "get remote loopback of a port", "<port_id>", SW_API_PT_REMOTE_LOOPBACK_GET, NULL},
+ {"reset", "start", "reset phy of a port", "<port_id>", SW_API_PT_RESET, NULL},
+ {"power", "off", "power off phy of a port", "<port_id>", SW_API_PT_POWER_OFF, NULL},
+ {"power", "on", "power on phy of a port", "<port_id>", SW_API_PT_POWER_ON, NULL},
+ {"magicFrameMac", "set", "set magic frame mac address of a port", "<port_id> <mac_address>", SW_API_PT_MAGIC_FRAME_MAC_SET, NULL},
+ {"magicFrameMac", "get", "get magic frame mac address of a port", "<port_id>", SW_API_PT_MAGIC_FRAME_MAC_GET, NULL},
+ {"phyId", "get", "get phy id of a port", "<port_id>", SW_API_PT_PHY_ID_GET, NULL},
+ {"wolstatus", "set", "set wol status of a port", "<port_id> <enable|disable>", SW_API_PT_WOL_STATUS_SET, NULL},
+ {"wolstatus", "get", "get wol status of a port", "<port_id>", SW_API_PT_WOL_STATUS_GET, NULL},
+ {"interfaceMode", "set", "set interface mode of phy", "<port_id> <psgmii_baset|psgmii_bx1000|psgmii_fx100|psgmii_amdet|sgmii_baset>", SW_API_PT_INTERFACE_MODE_SET, NULL},
+ {"interfaceMode", "get", "get interface mode of phy", "<port_id>", SW_API_PT_INTERFACE_MODE_GET, NULL},
+ {"interfaceMode", "status", "get current interface mode of phy", "<port_id>", SW_API_PT_INTERFACE_MODE_STATUS_GET, NULL},
{NULL, NULL, NULL, NULL, (int)NULL, NULL},/*end of desc*/
},
},
diff --git a/src/shell_lib/shell_io.c b/src/shell_lib/shell_io.c
index f3ed01a..2173a8b 100755
--- a/src/shell_lib/shell_io.c
+++ b/src/shell_lib/shell_io.c
@@ -168,6 +168,11 @@
SW_TYPE_DEF(SW_HOST_ROUTE_ENTRY, cmd_data_check_host_route_entry, NULL),
SW_TYPE_DEF(SW_IP_RFS_IP4, cmd_data_check_ip4_rfs_entry, NULL),
SW_TYPE_DEF(SW_IP_RFS_IP6, cmd_data_check_ip6_rfs_entry, NULL),
+ SW_TYPE_DEF(SW_CROSSOVER_MODE, cmd_data_check_crossover_mode, NULL),
+ SW_TYPE_DEF(SW_CROSSOVER_STATUS, cmd_data_check_crossover_status, NULL),
+ SW_TYPE_DEF(SW_PREFER_MEDIUM, cmd_data_check_prefer_medium, NULL),
+ SW_TYPE_DEF(SW_FIBER_MODE, cmd_data_check_fiber_mode, NULL),
+ SW_TYPE_DEF(SW_INTERFACE_MODE, cmd_data_check_interface_mode, NULL),
};
sw_data_type_t *
@@ -434,6 +439,105 @@
return SW_OK;
}
+sw_error_t
+cmd_data_check_crossover_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strncasecmp(cmd_str, "auto", 5))
+ *arg_val = PHY_MDIX_AUTO;
+ else if (!strncasecmp(cmd_str, "mdi", 4))
+ *arg_val = PHY_MDIX_MDI;
+ else if (!strncasecmp(cmd_str, "mdix", 5))
+ *arg_val = PHY_MDIX_MDIX;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_crossover_status(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+ if (!strncasecmp(cmd_str, "mdi", 4))
+ *arg_val = PHY_MDIX_STATUS_MDI;
+ else if (!strncasecmp(cmd_str, "mdix", 5))
+ *arg_val = PHY_MDIX_STATUS_MDIX;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_prefer_medium(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+ if (!strncasecmp(cmd_str, "copper", 7))
+ *arg_val = PHY_MEDIUM_COPPER;
+ else if (!strncasecmp(cmd_str, "fiber", 6))
+ *arg_val = PHY_MEDIUM_FIBER;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_fiber_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+ if (!strncasecmp(cmd_str, "100fx", 6))
+ *arg_val = PHY_FIBER_100FX;
+ else if (!strncasecmp(cmd_str, "1000bx", 7))
+ *arg_val = PHY_FIBER_1000BX;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_interface_mode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)
+{
+ if (cmd_str == NULL)
+ return SW_BAD_PARAM;
+
+ if (!strncasecmp(cmd_str, "psgmii_baset", 13))
+ *arg_val = PHY_PSGMII_BASET;
+ else if (!strncasecmp(cmd_str, "psgmii_bx1000", 14))
+ *arg_val = PHY_PSGMII_BX1000;
+ else if (!strncasecmp(cmd_str, "psgmii_fx100", 13))
+ *arg_val = PHY_PSGMII_FX100;
+ else if (!strncasecmp(cmd_str, "psgmii_amdet", 13))
+ *arg_val = PHY_PSGMII_AMDET;
+ else if (!strncasecmp(cmd_str, "sgmii_baset", 13))
+ *arg_val = PHY_SGMII_BASET;
+ else
+ {
+ //dprintf("input error \n");
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
/*portvlan*/
sw_error_t
cmd_data_check_1qmode(char *cmd_str, a_uint32_t * arg_val, a_uint32_t size)