Merge "[qca-ssdk] suport hk02 port bmp change"
diff --git a/include/hsl/phy/malibu_phy.h b/include/hsl/phy/malibu_phy.h
index d9943f8..7747747 100755
--- a/include/hsl/phy/malibu_phy.h
+++ b/include/hsl/phy/malibu_phy.h
@@ -47,7 +47,7 @@
#define MALIBU_1_0 0x004DD0B0
#define MALIBU_1_1 0x004DD0B1
#define MALIBU_1_1_2PORT 0x004DD0B2
-
+#define MALIBU_ORG_ID_OFFSET_LEN 16
/* PHY Registers */
#define MALIBU_PHY_CONTROL 0
diff --git a/src/hsl/hppe/hppe_init.c b/src/hsl/hppe/hppe_init.c
index 838e017..d20318c 100755
--- a/src/hsl/hppe/hppe_init.c
+++ b/src/hsl/hppe/hppe_init.c
@@ -55,55 +55,45 @@
bitmap = qca_ssdk_port_bmp_get(dev_id);
/* for port property set, SSDK should not generate some limitations */
- for (port_id = 0; port_id < pdev->nr_ports; port_id++)
+ for (port_id = 0; port_id < SW_MAX_NR_PORT; port_id++)
{
- hsl_port_prop_portmap_set(dev_id, port_id);
-
- for (p_type = HSL_PP_PHY; p_type < HSL_PP_BUTT; p_type++)
+ if ((port_id == pdev->cpu_port_nr) || (bitmap & (0x1 << port_id)))
{
- switch (p_type)
+ hsl_port_prop_portmap_set(dev_id, port_id);
+
+ for (p_type = HSL_PP_PHY; p_type < HSL_PP_BUTT; p_type++)
{
- case HSL_PP_PHY:
- /* Only port0 without PHY device */
- if (port_id != pdev->cpu_port_nr)
- {
- if(SW_IS_PBMP_MEMBER(bitmap, port_id))
- SW_RTN_ON_ERROR(hsl_port_prop_set(dev_id, port_id, p_type));
- }
- break;
+ switch (p_type)
+ {
+ case HSL_PP_PHY:
+ /* Only port0 without PHY device */
+ if (port_id != pdev->cpu_port_nr)
+ SW_RTN_ON_ERROR
+ (hsl_port_prop_set(dev_id, port_id, p_type));
+ break;
- case HSL_PP_INCL_CPU:
- /* include cpu port but exclude wan port in some cases */
- /* but which port is wan port, we are no meaning */
- if (port_id == pdev->cpu_port_nr)
- SW_RTN_ON_ERROR(hsl_port_prop_set(dev_id, port_id, p_type));
- if(SW_IS_PBMP_MEMBER(bitmap, port_id))
- SW_RTN_ON_ERROR(hsl_port_prop_set(dev_id, port_id, p_type));
- break;
+ case HSL_PP_INCL_CPU:
+ /* include cpu port but exclude wan port in some cases */
+ /* but which port is wan port, we are no meaning */
+ SW_RTN_ON_ERROR
+ (hsl_port_prop_set(dev_id, port_id, p_type));
+ break;
- case HSL_PP_EXCL_CPU:
- /* exclude cpu port and wan port in some cases */
- /* which port is wan port, we are no meaning but port0 is
- always CPU port */
- if (port_id != pdev->cpu_port_nr)
- {
- if(SW_IS_PBMP_MEMBER(bitmap, port_id))
- SW_RTN_ON_ERROR(hsl_port_prop_set(dev_id, port_id, p_type));
- }
- break;
+ case HSL_PP_EXCL_CPU:
+ /* exclude cpu port and wan port in some cases */
+ /* which port is wan port, we are no meaning but port0
+ is always CPU port */
+ if (port_id != pdev->cpu_port_nr)
+ SW_RTN_ON_ERROR
+ (hsl_port_prop_set(dev_id, port_id, p_type));
+ break;
- default:
- break;
+ default:
+ break;
+ }
}
}
-
- if (port_id != pdev->cpu_port_nr)
- {
- SW_RTN_ON_ERROR(hsl_port_prop_set_phyid
- (dev_id, port_id, port_id - 1));
- }
}
-
return SW_OK;
}
diff --git a/src/hsl/phy/malibu_phy.c b/src/hsl/phy/malibu_phy.c
index 67b6abf..3bdde0f 100755
--- a/src/hsl/phy/malibu_phy.c
+++ b/src/hsl/phy/malibu_phy.c
@@ -2357,7 +2357,8 @@
malibu_phy_hw_init(a_uint32_t dev_id, a_uint32_t port_bmp)
{
a_uint32_t port_id = 0, phy_addr = 0, phy_cnt = 0, first_phy_addr = 0;
- a_uint16_t dac_value,led_status, phy_data;
+ a_uint16_t dac_value,led_status, phy_data, org_id = 0, rev_id = 0;
+ a_uint32_t phy_id = 0;
for (port_id = 0; port_id < SW_MAX_NR_PORT; port_id ++)
{
@@ -2368,6 +2369,11 @@
if (phy_cnt == 1)
{
first_phy_addr = phy_addr;
+ malibu_phy_get_phy_id(dev_id, first_phy_addr, &org_id, &rev_id);
+ phy_id = (org_id << MALIBU_ORG_ID_OFFSET_LEN) | rev_id;
+ /* software get 8072 phy chip's firstly address to init phy chip*/
+ if ((phy_id == MALIBU_1_1_2PORT) && (first_phy_addr >= 0x3))
+ first_phy_addr = first_phy_addr - 0x3;
}
/*enable phy power saving function by default */
malibu_phy_set_8023az(dev_id, phy_addr, A_TRUE);