[PATCH v2 net-next 4/9] net: ethernet: mtk_eth_soc: increase MAX_DEVS to 3

From: Daniel Golle
Date: Wed Jul 12 2023 - 22:19:17 EST


From: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>

This is a preliminary patch to add MT7988 SoC support since it runs 3
macs instead of 2.

Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +++++-
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 7014e0d108b27..7f191e4337dd8 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4030,8 +4030,12 @@ static void mtk_sgmii_destroy(struct mtk_eth *eth)
{
int i;

- for (i = 0; i < MTK_MAX_DEVS; i++)
+ for (i = 0; i < MTK_MAX_DEVS; i++) {
+ if (!eth->sgmii_pcs[i])
+ continue;
+
mtk_pcs_lynxi_destroy(eth->sgmii_pcs[i]);
+ }
}

static int mtk_cleanup(struct mtk_eth *eth)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index c74c3918113a5..b18ce4430d437 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -1049,8 +1049,8 @@ struct mtk_soc_data {

#define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000)

-/* currently no SoC has more than 2 macs */
-#define MTK_MAX_DEVS 2
+/* currently no SoC has more than 3 macs */
+#define MTK_MAX_DEVS 3

/* struct mtk_eth - This is the main datasructure for holding the state
* of the driver
--
2.41.0