Merge "[qca-ssdk] Add malibu phy driver register"
diff --git a/include/hsl/phy/malibu_phy.h b/include/hsl/phy/malibu_phy.h
index c3456cf..c6c9235 100755
--- a/include/hsl/phy/malibu_phy.h
+++ b/include/hsl/phy/malibu_phy.h
@@ -576,7 +576,7 @@
malibu_phy_intr_status_get (a_uint32_t dev_id, a_uint32_t phy_id,
a_uint32_t * intr_status_flag);
- int malibu_phy_test (void);
+ int malibu_phy_init(void);
#ifdef __cplusplus
}
diff --git a/include/init/ssdk_init.h b/include/init/ssdk_init.h
index 80fdc9b..5026230 100755
--- a/include/init/ssdk_init.h
+++ b/include/init/ssdk_init.h
@@ -133,6 +133,12 @@
hsl_reg_mode psgmii_reg_access_mode;
} ssdk_dt_cfg;
+typedef struct phy_identification {
+ a_uint16_t phy_addr;
+ a_uint32_t phy_id;
+ int (*init)(void);
+} phy_identification_t;
+
#if defined ATHENA
#define def_init_cfg {.reg_mode = HSL_MDIO, .cpu_mode = HSL_CPU_2};
#elif defined GARUDA
diff --git a/src/hsl/phy/malibu_phy.c b/src/hsl/phy/malibu_phy.c
index d7dea58..f4072d2 100755
--- a/src/hsl/phy/malibu_phy.c
+++ b/src/hsl/phy/malibu_phy.c
@@ -2315,7 +2315,7 @@
* malibu_phy_init -
*
*/
-a_bool_t malibu_phy_init(void)
+a_bool_t malibu_phy_register(void)
{
static struct phy_driver qca_malibu_phy_driver = {
@@ -2331,9 +2331,9 @@
return phy_driver_register(&qca_malibu_phy_driver);
}
-int malibu_phy_test(void)
+int malibu_phy_init(void)
{
-
phy_api_ops_init(0);
return malibu_phy_probe((struct phy_device *)NULL);
}
+
diff --git a/src/init/ssdk_init.c b/src/init/ssdk_init.c
index 7015f47..b8e9b68 100755
--- a/src/init/ssdk_init.c
+++ b/src/init/ssdk_init.c
@@ -40,6 +40,7 @@
#include <linux/phy.h>
#include <linux/delay.h>
#include <linux/string.h>
+#include <malibu_phy.h>
#if defined(CONFIG_OF) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
#include <linux/switch.h>
#include <linux/of.h>
@@ -85,6 +86,10 @@
u8 __iomem *psgmii_hw_addr = NULL;
static struct mutex switch_mdio_lock;
+phy_identification_t phy_array[] =
+{
+ {0x0, 0x004DD0B0, malibu_phy_init},
+};
static void
qca_phy_read_port_link(struct qca_phy_priv *priv, int port,
@@ -1390,6 +1395,29 @@
}
+
+int ssdk_phy_init(ssdk_init_cfg *cfg)
+{
+
+ int size = sizeof(phy_array)/sizeof(phy_identification_t);
+ a_uint32_t phy_id = 0;
+ a_uint16_t org_id = 0, rev_id = 0;
+ int i = 0;
+
+ for(i=0;i<size;i++)
+ {
+ cfg->reg_func.mdio_get(0, phy_array[i].phy_addr, 2, &org_id);
+ cfg->reg_func.mdio_get(0, phy_array[i].phy_addr, 3, &rev_id);
+ phy_id = (org_id<<16) | rev_id;
+
+ if(phy_array[i].phy_id == phy_id)
+ return phy_array[i].init();
+ }
+
+ return SW_FAIL;
+}
+
+
sw_error_t
ssdk_init(a_uint32_t dev_id, ssdk_init_cfg * cfg)
{
@@ -1405,6 +1433,7 @@
#endif
#endif
rv = ssdk_switch_init(dev_id);
+ ssdk_phy_init(cfg);
return rv;
}