[qca-ssdk] fix malibu phy combo port bx1000 half duplex
fix malibu phy port 4 bx1000 half duplex
Change-Id: I21cc8ec1579235b8612f28f6adba7d4c0dc65e11
Signed-off-by: esong <song@codeaurora.org>
diff --git a/include/fal/fal_port_ctrl.h b/include/fal/fal_port_ctrl.h
index 8c34bf9..7a6f1e2 100755
--- a/include/fal/fal_port_ctrl.h
+++ b/include/fal/fal_port_ctrl.h
@@ -79,6 +79,9 @@
#define FAL_PHY_GE_ADV_ALL \
(FAL_PHY_ADV_GE_SPEED_ALL | FAL_PHY_ADV_PAUSE | FAL_PHY_ADV_ASY_PAUSE)
+#define FAL_PHY_COMBO_ADV_ALL \
+ (FAL_PHY_ADV_BX_SPEED_ALL | FAL_PHY_ADV_GE_SPEED_ALL | FAL_PHY_ADV_PAUSE | FAL_PHY_ADV_ASY_PAUSE)
+
//phy capablity
#define FAL_PHY_AUTONEG_CAPS 0x01
#define FAL_PHY_100T2_HD_CAPS 0x02
@@ -106,8 +109,11 @@
#define FAL_PHY_INTR_DUPLEX_CHANGE 0x2
#define FAL_PHY_INTR_STATUS_UP_CHANGE 0x4
#define FAL_PHY_INTR_STATUS_DOWN_CHANGE 0x8
-#define FAL_PHY_INTR_BX_FX_STATUS_UP_CHANGE 0x40
-#define FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE 0x80
+#define FAL_PHY_INTR_BX_FX_STATUS_UP_CHANGE 0x10
+#define FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE 0x20
+#define FAL_PHY_INTR_MEDIA_STATUS_CHANGE 0x40
+#define FAL_PHY_INTR_WOL_STATUS 0x80
+#define FAL_PHY_INTR_POE_STATUS 0x100
typedef enum {
FAL_NO_HEADER_EN = 0,
diff --git a/include/hsl/phy/malibu_phy.h b/include/hsl/phy/malibu_phy.h
index c0113e4..c3456cf 100755
--- a/include/hsl/phy/malibu_phy.h
+++ b/include/hsl/phy/malibu_phy.h
@@ -481,6 +481,9 @@
#define MALIBU_INTR_STATUS_DOWN_CHANGE 0x0800
#define MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE 0x0100
#define MALIBU_INTR_BX_FX_STATUS_UP_CHANGE 0x0080
+#define MALIBU_INTR_MEDIA_STATUS_CHANGE 0x1000
+#define MALIBU_INTR_WOL 0x0001
+#define MALIBU_INTR_POE 0x0002
#define RUN_CDT 0x8000
#define CABLE_LENGTH_UNIT 0x0400
diff --git a/src/hsl/phy/malibu_phy.c b/src/hsl/phy/malibu_phy.c
index 8e06d23..4ff394a 100755
--- a/src/hsl/phy/malibu_phy.c
+++ b/src/hsl/phy/malibu_phy.c
@@ -958,42 +958,14 @@
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) {
@@ -1039,10 +1011,6 @@
}
}
-#if 0
- /*restore debug port value */
- f1_phy_debug_write(dev_id, phy_id, 0x3f, org_debug_value);
-#endif
return SW_OK;
}
@@ -1443,6 +1411,9 @@
if (autoneg & FAL_PHY_ADV_1000BX_FD)
phy_data |= MALIBU_BX_ADVERTISE_1000FULL;
+ if (autoneg & FAL_PHY_ADV_1000BX_HD)
+ phy_data |= MALIBU_BX_ADVERTISE_1000HALF;
+
if (autoneg & FAL_PHY_ADV_PAUSE)
phy_data |= MALIBU_BX_ADVERTISE_PAUSE;
@@ -1566,6 +1537,9 @@
if (phy_data & MALIBU_BX_ADVERTISE_ASYM_PAUSE)
*autoneg |= FAL_PHY_ADV_ASY_PAUSE;
+ if (phy_data & MALIBU_BX_ADVERTISE_1000HALF)
+ *autoneg |= FAL_PHY_ADV_1000BX_HD;
+
if (phy_data & MALIBU_BX_ADVERTISE_1000FULL)
*autoneg |= FAL_PHY_ADV_1000BX_FD;
}
@@ -2120,6 +2094,24 @@
phy_data &= (~MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE);
}
+ if (FAL_PHY_INTR_MEDIA_STATUS_CHANGE & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_MEDIA_STATUS_CHANGE;
+ } else {
+ phy_data &= (~MALIBU_INTR_MEDIA_STATUS_CHANGE);
+ }
+
+ if (FAL_PHY_INTR_WOL_STATUS & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_WOL;
+ } else {
+ phy_data &= (~MALIBU_INTR_WOL);
+ }
+
+ if (FAL_PHY_INTR_POE_STATUS & intr_mask_flag) {
+ phy_data |= MALIBU_INTR_POE;
+ } else {
+ phy_data &= (~MALIBU_INTR_POE);
+ }
+
malibu_phy_reg_write(dev_id, phy_id, MALIBU_PHY_INTR_MASK, phy_data);
return SW_OK;
}
@@ -2162,6 +2154,18 @@
*intr_mask_flag |= FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE;
}
+ if (MALIBU_INTR_MEDIA_STATUS_CHANGE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_MEDIA_STATUS_CHANGE;
+ }
+
+ if (MALIBU_INTR_WOL & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_WOL_STATUS;
+ }
+
+ if (MALIBU_INTR_POE & phy_data) {
+ *intr_mask_flag |= FAL_PHY_INTR_POE_STATUS;
+ }
+
return SW_OK;
}
@@ -2202,6 +2206,17 @@
if (MALIBU_INTR_BX_FX_STATUS_DOWN_CHANGE & phy_data) {
*intr_status_flag |= FAL_PHY_INTR_BX_FX_STATUS_DOWN_CHANGE;
}
+ if (MALIBU_INTR_MEDIA_STATUS_CHANGE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_MEDIA_STATUS_CHANGE;
+ }
+
+ if (MALIBU_INTR_WOL & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_WOL_STATUS;
+ }
+
+ if (MALIBU_INTR_POE & phy_data) {
+ *intr_status_flag |= FAL_PHY_INTR_POE_STATUS;
+ }
return SW_OK;
}
diff --git a/src/shell_lib/shell_io.c b/src/shell_lib/shell_io.c
index cad75e7..a9557a0 100755
--- a/src/shell_lib/shell_io.c
+++ b/src/shell_lib/shell_io.c
@@ -430,7 +430,7 @@
return SW_BAD_PARAM;
cmd_strtol(cmd_str, arg_val);
- if (*arg_val & (~FAL_PHY_GE_ADV_ALL))
+ if (*arg_val & (~FAL_PHY_COMBO_ADV_ALL))
{
//dprintf("input error should be within 0x3f\n");
return SW_BAD_VALUE;