This patch adds support for en7523/en7529/en7562 ethernet devices

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevets...@iopsys.eu>
---
 drivers/net/airoha_eth.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 6588eb3a806..bcbbd94d31a 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -22,10 +22,22 @@
 #include <linux/iopoll.h>
 #include <linux/time.h>
 
+#if defined(CONFIG_TARGET_EN7523)
+#define SWITCH_OFNODE  "airoha,en7523-switch"
+#define SCU_OFNODE     "airoha,en7523-scu"
+#elif defined(CONFIG_TARGET_AN7581)
+#define SWITCH_OFNODE  "airoha,en7581-switch"
+#define SCU_OFNODE     "airoha,en7581-scu"
+#endif
+
 #define AIROHA_MAX_NUM_GDM_PORTS       1
 #define AIROHA_MAX_NUM_QDMA            1
 #define AIROHA_MAX_NUM_RSTS            3
+#if defined(CONFIG_TARGET_EN7523)
+#define AIROHA_MAX_NUM_XSI_RSTS                3
+#elif defined(CONFIG_TARGET_AN7581)
 #define AIROHA_MAX_NUM_XSI_RSTS                4
+#endif
 
 #define AIROHA_MAX_PACKET_SIZE         2048
 #define AIROHA_NUM_TX_RING             1
@@ -685,7 +697,7 @@ static int airoha_switch_init(struct udevice *dev, struct 
airoha_eth *eth)
        ofnode switch_node;
        fdt_addr_t addr;
 
-       switch_node = ofnode_by_compatible(ofnode_null(), 
"airoha,en7581-switch");
+       switch_node = ofnode_by_compatible(ofnode_null(), SWITCH_OFNODE);
        if (!ofnode_valid(switch_node))
                return -EINVAL;
 
@@ -727,7 +739,7 @@ static int airoha_eth_probe(struct udevice *dev)
        ofnode scu_node;
        int ret;
 
-       scu_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu");
+       scu_node = ofnode_by_compatible(ofnode_null(), SCU_OFNODE);
        if (!ofnode_valid(scu_node))
                return -EINVAL;
 
@@ -781,9 +793,11 @@ static int airoha_eth_probe(struct udevice *dev)
        if (ret)
                return ret;
 
+#if !defined(CONFIG_TARGET_EN7523)
        ret = reset_get_by_name(dev, "xfp-mac", &eth->xsi_rsts.resets[3]);
        if (ret)
                return ret;
+#endif
 
        ret = airoha_hw_init(dev, eth);
        if (ret)
@@ -972,7 +986,11 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
 }
 
 static const struct udevice_id airoha_eth_ids[] = {
+#if defined(CONFIG_TARGET_EN7523)
+       { .compatible = "airoha,en7523-eth" },
+#elif defined(CONFIG_TARGET_AN7581)
        { .compatible = "airoha,en7581-eth" },
+#endif
        { }
 };
 
-- 
2.47.2

Reply via email to