openwrt/target/linux/mediatek/patches-6.6/944-net-ethernet-mtk_wed-mo...

58 lines
1.9 KiB
Diff

From b74ba226be2c45091b93bd49192bdd6d2178729e Mon Sep 17 00:00:00 2001
Message-Id: <b74ba226be2c45091b93bd49192bdd6d2178729e.1678718888.git.lorenzo@kernel.org>
In-Reply-To: <f3565e6c2276411275e707a5442d3f69cc111273.1678718888.git.lorenzo@kernel.org>
References: <f3565e6c2276411275e707a5442d3f69cc111273.1678718888.git.lorenzo@kernel.org>
From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Mon, 13 Mar 2023 15:45:16 +0100
Subject: [PATCH net-next 3/3] net: ethernet: mtk_wed: move dlm a dedicated dts
node
Since the dlm memory region is not part of the RAM SoC, move dlm in a
deidicated syscon node.
This patch helps to keep backward-compatibility with older version of
uboot codebase where we have a limit of 8 reserved-memory dts child
nodes.
Keep backward-compatibility with older dts version where dlm was defined
as reserved-memory child node.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -1322,6 +1322,24 @@ mtk_wed_rro_alloc(struct mtk_wed_device
struct device_node *np;
int index;
+ np = of_parse_phandle(dev->hw->node, "mediatek,wo-dlm", 0);
+ if (np) {
+ struct resource res;
+ int ret;
+
+ ret = of_address_to_resource(np, 0, &res);
+ of_node_put(np);
+
+ if (ret < 0)
+ return ret;
+
+ dev->rro.miod_phys = res.start;
+ goto out;
+ }
+
+ /* For backward compatibility, we need to check if DLM
+ * node is defined through reserved memory property.
+ */
index = of_property_match_string(dev->hw->node, "memory-region-names",
"wo-dlm");
if (index < 0)
@@ -1338,6 +1356,7 @@ mtk_wed_rro_alloc(struct mtk_wed_device
return -ENODEV;
dev->rro.miod_phys = rmem->base;
+out:
dev->rro.fdbk_phys = MTK_WED_MIOD_COUNT + dev->rro.miod_phys;
return mtk_wed_rro_ring_alloc(dev, &dev->rro.ring,