devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes
@ 2023-03-31 13:12 Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 01/10] net: ethernet: mtk_wed: rename mtk_wed_get_memory_region in mtk_wed_get_reserved_memory_region Lorenzo Bianconi
                   ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since cpuboot, ilm and dlm memory region are not part of MT7986 SoC RAM,
move them in dedicated mt7986a syscon dts nodes.
At the same time we keep backward-compatibility with older dts version where
cpuboot, ilm and dlm were defined as reserved-memory child nodes.

Changes since v1:
- fix dts schema compilation error
- rebase on top of net-next

Lorenzo Bianconi (10):
  net: ethernet: mtk_wed: rename mtk_wed_get_memory_region in
    mtk_wed_get_reserved_memory_region
  net: ethernet: mtk_wed: move cpuboot in a dedicated dts node
  dt-bindings: soc: mediatek: move cpuboot in a dedicated dts node
  arm64: dts: mt7986: move cpuboot in a dedicated node
  net: ethernet: mtk_wed: move ilm a dedicated dts node
  dt-bindings: soc: mediatek: move ilm in a dedicated dts node
  arm64: dts: mt7986: move ilm in a dedicated node
  net: ethernet: mtk_wed: move dlm a dedicated dts node
  dt-bindings: soc: mediatek: move dlm in a dedicated dts node
  arm64: dts: mt7986: move dlm in a dedicated node

 .../arm/mediatek/mediatek,mt7622-wed.yaml     | 30 ++++---
 .../mediatek/mediatek,mt7986-wo-cpuboot.yaml  | 45 ++++++++++
 .../soc/mediatek/mediatek,mt7986-wo-dlm.yaml  | 46 ++++++++++
 .../soc/mediatek/mediatek,mt7986-wo-ilm.yaml  | 45 ++++++++++
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi     | 69 +++++++-------
 drivers/net/ethernet/mediatek/mtk_wed.c       | 19 ++++
 drivers/net/ethernet/mediatek/mtk_wed_mcu.c   | 89 ++++++++++++++++---
 drivers/net/ethernet/mediatek/mtk_wed_wo.h    |  3 +-
 8 files changed, 289 insertions(+), 57 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-cpuboot.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-dlm.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml

-- 
2.39.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 01/10] net: ethernet: mtk_wed: rename mtk_wed_get_memory_region in mtk_wed_get_reserved_memory_region
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node Lorenzo Bianconi
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

This is a preliminary patch to move Wireless Ethernet Dispatch (WED)
ilm/dlm and cpuboot properties in dedicated dts nodes.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
index 6bad0d262f28..6624f6d6abdd 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
@@ -215,8 +215,8 @@ int mtk_wed_mcu_msg_update(struct mtk_wed_device *dev, int id, void *data,
 }
 
 static int
-mtk_wed_get_memory_region(struct mtk_wed_wo *wo,
-			  struct mtk_wed_wo_memory_region *region)
+mtk_wed_get_reserved_memory_region(struct mtk_wed_wo *wo,
+				   struct mtk_wed_wo_memory_region *region)
 {
 	struct reserved_mem *rmem;
 	struct device_node *np;
@@ -311,13 +311,13 @@ mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
 
 	/* load firmware region metadata */
 	for (i = 0; i < ARRAY_SIZE(mem_region); i++) {
-		ret = mtk_wed_get_memory_region(wo, &mem_region[i]);
+		ret = mtk_wed_get_reserved_memory_region(wo, &mem_region[i]);
 		if (ret)
 			return ret;
 	}
 
 	wo->boot.name = "wo-boot";
-	ret = mtk_wed_get_memory_region(wo, &wo->boot);
+	ret = mtk_wed_get_reserved_memory_region(wo, &wo->boot);
 	if (ret)
 		return ret;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 01/10] net: ethernet: mtk_wed: rename mtk_wed_get_memory_region in mtk_wed_get_reserved_memory_region Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-04-04  7:44   ` Paolo Abeni
  2023-03-31 13:12 ` [PATCH v2 net-next 03/10] dt-bindings: soc: mediatek: " Lorenzo Bianconi
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the cpuboot memory region is not part of the RAM MT7986 SoC,
move cpuboot in a deidicated syscon node.
Keep backward-compatibility with older dts version where cpuboot was
defined as reserved-memory child node.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 34 +++++++++++++++++----
 drivers/net/ethernet/mediatek/mtk_wed_wo.h  |  3 +-
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
index 6624f6d6abdd..797c3b412ab6 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
@@ -18,12 +18,23 @@
 
 static u32 wo_r32(struct mtk_wed_wo *wo, u32 reg)
 {
-	return readl(wo->boot.addr + reg);
+	u32 val;
+
+	if (!wo->boot_regmap)
+		return readl(wo->boot.addr + reg);
+
+	if (regmap_read(wo->boot_regmap, reg, &val))
+		val = ~0;
+
+	return val;
 }
 
 static void wo_w32(struct mtk_wed_wo *wo, u32 reg, u32 val)
 {
-	writel(val, wo->boot.addr + reg);
+	if (wo->boot_regmap)
+		regmap_write(wo->boot_regmap, reg, val);
+	else
+		writel(val, wo->boot.addr + reg);
 }
 
 static struct sk_buff *
@@ -316,10 +327,21 @@ mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
 			return ret;
 	}
 
-	wo->boot.name = "wo-boot";
-	ret = mtk_wed_get_reserved_memory_region(wo, &wo->boot);
-	if (ret)
-		return ret;
+	wo->boot_regmap = syscon_regmap_lookup_by_phandle(wo->hw->node,
+							  "mediatek,wo-cpuboot");
+	if (IS_ERR(wo->boot_regmap)) {
+		if (wo->boot_regmap != ERR_PTR(-ENODEV))
+			return PTR_ERR(wo->boot_regmap);
+
+		/* For backward compatibility, we need to check if cpu_boot
+		 * is defined through reserved memory property.
+		 */
+		wo->boot_regmap = NULL;
+		wo->boot.name = "wo-boot";
+		ret = mtk_wed_get_reserved_memory_region(wo, &wo->boot);
+		if (ret)
+			return ret;
+	}
 
 	/* set dummy cr */
 	wed_w32(wo->hw->wed_dev, MTK_WED_SCR0 + 4 * MTK_WED_DUMMY_CR_FWDL,
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.h b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
index dbcf42ce9173..c03071203cc0 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
@@ -227,7 +227,8 @@ struct mtk_wed_wo_queue {
 
 struct mtk_wed_wo {
 	struct mtk_wed_hw *hw;
-	struct mtk_wed_wo_memory_region boot;
+	struct mtk_wed_wo_memory_region boot; /* backward compatibility */
+	struct regmap *boot_regmap;
 
 	struct mtk_wed_wo_queue q_tx;
 	struct mtk_wed_wo_queue q_rx;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 03/10] dt-bindings: soc: mediatek: move cpuboot in a dedicated dts node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 01/10] net: ethernet: mtk_wed: rename mtk_wed_get_memory_region in mtk_wed_get_reserved_memory_region Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 04/10] arm64: dts: mt7986: move cpuboot in a dedicated node Lorenzo Bianconi
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the cpuboot memory region is not part of the MT7986 RAM SoC,
move cpuboot in a deidicated syscon node.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../arm/mediatek/mediatek,mt7622-wed.yaml     | 12 +++--
 .../mediatek/mediatek,mt7986-wo-cpuboot.yaml  | 45 +++++++++++++++++++
 2 files changed, 53 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-cpuboot.yaml

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
index 5c223cb063d4..7f6638d43854 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
@@ -35,7 +35,6 @@ properties:
       - description: firmware ILM region
       - description: firmware DLM region
       - description: firmware CPU DATA region
-      - description: firmware BOOT region
 
   memory-region-names:
     items:
@@ -43,12 +42,15 @@ properties:
       - const: wo-ilm
       - const: wo-dlm
       - const: wo-data
-      - const: wo-boot
 
   mediatek,wo-ccif:
     $ref: /schemas/types.yaml#/definitions/phandle
     description: mediatek wed-wo controller interface.
 
+  mediatek,wo-cpuboot:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: mediatek wed-wo cpuboot controller interface.
+
 allOf:
   - if:
       properties:
@@ -60,6 +62,7 @@ allOf:
         memory-region-names: false
         memory-region: false
         mediatek,wo-ccif: false
+        mediatek,wo-cpuboot: false
 
 required:
   - compatible
@@ -95,9 +98,10 @@ examples:
         interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
 
         memory-region = <&wo_emi>, <&wo_ilm>, <&wo_dlm>,
-                        <&wo_data>, <&wo_boot>;
+                        <&wo_data>;
         memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
-                              "wo-data", "wo-boot";
+                              "wo-data";
         mediatek,wo-ccif = <&wo_ccif0>;
+        mediatek,wo-cpuboot = <&wo_cpuboot>;
       };
     };
diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-cpuboot.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-cpuboot.yaml
new file mode 100644
index 000000000000..1b45c8a86989
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-cpuboot.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,mt7986-wo-cpuboot.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Wireless Ethernet Dispatch (WED) WO Boot firmware interface for MT7986
+
+maintainers:
+  - Lorenzo Bianconi <lorenzo@kernel.org>
+  - Felix Fietkau <nbd@nbd.name>
+
+description:
+  The MediaTek wo-cpuboot provides a configuration interface for WED WO
+  controller boot firmware. WED is used to perform offload rx packet
+  processing (e.g. 802.11 aggregation packet reordering or rx header
+  translation) on MT7986 soc.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt7986-wo-cpuboot
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      syscon@15194000 {
+        compatible = "mediatek,mt7986-wo-cpuboot", "syscon";
+        reg = <0 0x15194000 0 0x1000>;
+      };
+    };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 04/10] arm64: dts: mt7986: move cpuboot in a dedicated node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (2 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 03/10] dt-bindings: soc: mediatek: " Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 05/10] net: ethernet: mtk_wed: move ilm a dedicated dts node Lorenzo Bianconi
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the cpuboot memory region is not part of the MT7986 RAM SoC,
move cpuboot in a deidicated syscon node.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index 51944690e790..668b6cfa6a3d 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -113,12 +113,6 @@ wo_dlm1: wo-dlm@151f8000 {
 			reg = <0 0x151f8000 0 0x2000>;
 			no-map;
 		};
-
-		wo_boot: wo-boot@15194000 {
-			reg = <0 0x15194000 0 0x1000>;
-			no-map;
-		};
-
 	};
 
 	timer {
@@ -461,10 +455,11 @@ wed0: wed@15010000 {
 			interrupt-parent = <&gic>;
 			interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
 			memory-region = <&wo_emi0>, <&wo_ilm0>, <&wo_dlm0>,
-					<&wo_data>, <&wo_boot>;
+					<&wo_data>;
 			memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
-					      "wo-data", "wo-boot";
+					      "wo-data";
 			mediatek,wo-ccif = <&wo_ccif0>;
+			mediatek,wo-cpuboot = <&wo_cpuboot>;
 		};
 
 		wed1: wed@15011000 {
@@ -474,10 +469,11 @@ wed1: wed@15011000 {
 			interrupt-parent = <&gic>;
 			interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
 			memory-region = <&wo_emi1>, <&wo_ilm1>, <&wo_dlm1>,
-					<&wo_data>, <&wo_boot>;
+					<&wo_data>;
 			memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
-					      "wo-data", "wo-boot";
+					      "wo-data";
 			mediatek,wo-ccif = <&wo_ccif1>;
+			mediatek,wo-cpuboot = <&wo_cpuboot>;
 		};
 
 		wo_ccif0: syscon@151a5000 {
@@ -494,6 +490,11 @@ wo_ccif1: syscon@151ad000 {
 			interrupts = <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		wo_cpuboot: syscon@15194000 {
+			compatible = "mediatek,mt7986-wo-cpuboot", "syscon";
+			reg = <0 0x15194000 0 0x1000>;
+		};
+
 		eth: ethernet@15100000 {
 			compatible = "mediatek,mt7986-eth";
 			reg = <0 0x15100000 0 0x80000>;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 05/10] net: ethernet: mtk_wed: move ilm a dedicated dts node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (3 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 04/10] arm64: dts: mt7986: move cpuboot in a dedicated node Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 06/10] dt-bindings: soc: mediatek: move ilm in " Lorenzo Bianconi
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the ilm memory region is not part of the MT7986 RAM SoC, move ilm
in a deidicated syscon node.
Keep backward-compatibility with older dts version where ilm was defined
as reserved-memory child node.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 55 ++++++++++++++++++---
 1 file changed, 49 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
index 797c3b412ab6..a19db914ebd2 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
@@ -299,6 +299,52 @@ mtk_wed_mcu_run_firmware(struct mtk_wed_wo *wo, const struct firmware *fw,
 	return -EINVAL;
 }
 
+static int
+mtk_wed_mcu_load_memory_regions(struct mtk_wed_wo *wo,
+				struct mtk_wed_wo_memory_region *region)
+{
+	struct device_node *np;
+	int ret;
+
+	/* firmware EMI memory region */
+	ret = mtk_wed_get_reserved_memory_region(wo,
+			&region[MTK_WED_WO_REGION_EMI]);
+	if (ret)
+		return ret;
+
+	/* firmware DATA memory region */
+	ret = mtk_wed_get_reserved_memory_region(wo,
+			&region[MTK_WED_WO_REGION_DATA]);
+	if (ret)
+		return ret;
+
+	np = of_parse_phandle(wo->hw->node, "mediatek,wo-ilm", 0);
+	if (np) {
+		struct mtk_wed_wo_memory_region *ilm_region;
+		struct resource res;
+
+		ret = of_address_to_resource(np, 0, &res);
+		of_node_put(np);
+
+		if (ret < 0)
+			return ret;
+
+		ilm_region = &region[MTK_WED_WO_REGION_ILM];
+		ilm_region->phy_addr = res.start;
+		ilm_region->size = resource_size(&res);
+		ilm_region->addr = devm_ioremap(wo->hw->dev, ilm_region->phy_addr,
+						ilm_region->size);
+
+		return ilm_region->addr ? 0 : -ENOMEM;
+	}
+
+	/* For backward compatibility, we need to check if ILM
+	 * node is defined through reserved memory property.
+	 */
+	return mtk_wed_get_reserved_memory_region(wo,
+			&region[MTK_WED_WO_REGION_ILM]);
+}
+
 static int
 mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
 {
@@ -320,12 +366,9 @@ mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
 	u32 val, boot_cr;
 	int ret, i;
 
-	/* load firmware region metadata */
-	for (i = 0; i < ARRAY_SIZE(mem_region); i++) {
-		ret = mtk_wed_get_reserved_memory_region(wo, &mem_region[i]);
-		if (ret)
-			return ret;
-	}
+	ret = mtk_wed_mcu_load_memory_regions(wo, mem_region);
+	if (ret)
+		return ret;
 
 	wo->boot_regmap = syscon_regmap_lookup_by_phandle(wo->hw->node,
 							  "mediatek,wo-cpuboot");
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 06/10] dt-bindings: soc: mediatek: move ilm in a dedicated dts node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (4 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 05/10] net: ethernet: mtk_wed: move ilm a dedicated dts node Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-04-06  8:50   ` Paolo Abeni
  2023-03-31 13:12 ` [PATCH v2 net-next 07/10] arm64: dts: mt7986: move ilm in a dedicated node Lorenzo Bianconi
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the ilm memory region is not part of the MT7986 RAM SoC, move ilm
in a deidicated syscon node.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../arm/mediatek/mediatek,mt7622-wed.yaml     | 14 +++---
 .../soc/mediatek/mediatek,mt7986-wo-ilm.yaml  | 45 +++++++++++++++++++
 2 files changed, 53 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
index 7f6638d43854..e63fb22447c6 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
@@ -32,14 +32,12 @@ properties:
   memory-region:
     items:
       - description: firmware EMI region
-      - description: firmware ILM region
       - description: firmware DLM region
       - description: firmware CPU DATA region
 
   memory-region-names:
     items:
       - const: wo-emi
-      - const: wo-ilm
       - const: wo-dlm
       - const: wo-data
 
@@ -51,6 +49,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/phandle
     description: mediatek wed-wo cpuboot controller interface.
 
+  mediatek,wo-ilm:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: mediatek wed-wo ilm interface.
+
 allOf:
   - if:
       properties:
@@ -63,6 +65,7 @@ allOf:
         memory-region: false
         mediatek,wo-ccif: false
         mediatek,wo-cpuboot: false
+        mediatek,wo-ilm: false
 
 required:
   - compatible
@@ -97,11 +100,10 @@ examples:
         reg = <0 0x15010000 0 0x1000>;
         interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
 
-        memory-region = <&wo_emi>, <&wo_ilm>, <&wo_dlm>,
-                        <&wo_data>;
-        memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
-                              "wo-data";
+        memory-region = <&wo_emi>, <&wo_dlm>, <&wo_data>;
+        memory-region-names = "wo-emi", "wo-dlm", "wo-data";
         mediatek,wo-ccif = <&wo_ccif0>;
         mediatek,wo-cpuboot = <&wo_cpuboot>;
+        mediatek,wo-ilm = <&wo_ilm>;
       };
     };
diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml
new file mode 100644
index 000000000000..2a3775cd941e
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,mt7986-wo-ilm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Wireless Ethernet Dispatch (WED) WO ILM firmware interface for MT7986
+
+maintainers:
+  - Lorenzo Bianconi <lorenzo@kernel.org>
+  - Felix Fietkau <nbd@nbd.name>
+
+description:
+  The MediaTek wo-ilm (Information Lifecycle Management) provides a configuration
+  interface for WiFi critical data used by WED WO firmware. WED WO controller is
+  used to perform offload rx packet processing (e.g. 802.11 aggregation packet
+  reordering or rx header translation) on MT7986 soc.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt7986-wo-ilm
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      syscon@151e0000 {
+        compatible = "mediatek,mt7986-wo-ilm", "syscon";
+        reg = <0 0x151e0000 0 0x8000>;
+      };
+    };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 07/10] arm64: dts: mt7986: move ilm in a dedicated node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (5 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 06/10] dt-bindings: soc: mediatek: move ilm in " Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 08/10] net: ethernet: mtk_wed: move dlm a dedicated dts node Lorenzo Bianconi
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the ilm memory region is not part of the MT7986 RAM SoC, move ilm
in a deidicated syscon node.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 34 +++++++++++------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index 668b6cfa6a3d..a0d96d232ee5 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -89,16 +89,6 @@ wo_emi1: wo-emi@4fd40000 {
 			no-map;
 		};
 
-		wo_ilm0: wo-ilm@151e0000 {
-			reg = <0 0x151e0000 0 0x8000>;
-			no-map;
-		};
-
-		wo_ilm1: wo-ilm@151f0000 {
-			reg = <0 0x151f0000 0 0x8000>;
-			no-map;
-		};
-
 		wo_data: wo-data@4fd80000 {
 			reg = <0 0x4fd80000 0 0x240000>;
 			no-map;
@@ -454,11 +444,10 @@ wed0: wed@15010000 {
 			reg = <0 0x15010000 0 0x1000>;
 			interrupt-parent = <&gic>;
 			interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
-			memory-region = <&wo_emi0>, <&wo_ilm0>, <&wo_dlm0>,
-					<&wo_data>;
-			memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
-					      "wo-data";
+			memory-region = <&wo_emi0>, <&wo_dlm0>, <&wo_data>;
+			memory-region-names = "wo-emi", "wo-dlm", "wo-data";
 			mediatek,wo-ccif = <&wo_ccif0>;
+			mediatek,wo-ilm = <&wo_ilm0>;
 			mediatek,wo-cpuboot = <&wo_cpuboot>;
 		};
 
@@ -468,11 +457,10 @@ wed1: wed@15011000 {
 			reg = <0 0x15011000 0 0x1000>;
 			interrupt-parent = <&gic>;
 			interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
-			memory-region = <&wo_emi1>, <&wo_ilm1>, <&wo_dlm1>,
-					<&wo_data>;
-			memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
-					      "wo-data";
+			memory-region = <&wo_emi1>, <&wo_dlm1>, <&wo_data>;
+			memory-region-names = "wo-emi", "wo-dlm", "wo-data";
 			mediatek,wo-ccif = <&wo_ccif1>;
+			mediatek,wo-ilm = <&wo_ilm1>;
 			mediatek,wo-cpuboot = <&wo_cpuboot>;
 		};
 
@@ -490,6 +478,16 @@ wo_ccif1: syscon@151ad000 {
 			interrupts = <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		wo_ilm0: syscon@151e0000 {
+			compatible = "mediatek,mt7986-wo-ilm", "syscon";
+			reg = <0 0x151e0000 0 0x8000>;
+		};
+
+		wo_ilm1: syscon@151f0000 {
+			compatible = "mediatek,mt7986-wo-ilm", "syscon";
+			reg = <0 0x151f0000 0 0x8000>;
+		};
+
 		wo_cpuboot: syscon@15194000 {
 			compatible = "mediatek,mt7986-wo-cpuboot", "syscon";
 			reg = <0 0x15194000 0 0x1000>;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 08/10] net: ethernet: mtk_wed: move dlm a dedicated dts node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (6 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 07/10] arm64: dts: mt7986: move ilm in a dedicated node Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 09/10] dt-bindings: soc: mediatek: move dlm in " Lorenzo Bianconi
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the dlm memory region is not part of the MT7986 RAM SoC, move dlm
in a deidicated syscon node.
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(+)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 95d890870984..e479ff924ed6 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -799,6 +799,24 @@ mtk_wed_rro_alloc(struct mtk_wed_device *dev)
 	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)
@@ -815,6 +833,7 @@ mtk_wed_rro_alloc(struct mtk_wed_device *dev)
 		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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 09/10] dt-bindings: soc: mediatek: move dlm in a dedicated dts node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (7 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 08/10] net: ethernet: mtk_wed: move dlm a dedicated dts node Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-03-31 13:12 ` [PATCH v2 net-next 10/10] arm64: dts: mt7986: move dlm in a dedicated node Lorenzo Bianconi
  2023-04-06 15:25 ` [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Rob Herring
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the dlm memory region is not part of the MT7986 RAM SoC, move dlm in
a deidicated syscon node.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../arm/mediatek/mediatek,mt7622-wed.yaml     | 12 +++--
 .../soc/mediatek/mediatek,mt7986-wo-dlm.yaml  | 46 +++++++++++++++++++
 2 files changed, 54 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-dlm.yaml

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
index e63fb22447c6..e4707880eca7 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
@@ -32,13 +32,11 @@ properties:
   memory-region:
     items:
       - description: firmware EMI region
-      - description: firmware DLM region
       - description: firmware CPU DATA region
 
   memory-region-names:
     items:
       - const: wo-emi
-      - const: wo-dlm
       - const: wo-data
 
   mediatek,wo-ccif:
@@ -53,6 +51,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/phandle
     description: mediatek wed-wo ilm interface.
 
+  mediatek,wo-dlm:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: mediatek wed-wo dlm interface.
+
 allOf:
   - if:
       properties:
@@ -66,6 +68,7 @@ allOf:
         mediatek,wo-ccif: false
         mediatek,wo-cpuboot: false
         mediatek,wo-ilm: false
+        mediatek,wo-dlm: false
 
 required:
   - compatible
@@ -100,10 +103,11 @@ examples:
         reg = <0 0x15010000 0 0x1000>;
         interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
 
-        memory-region = <&wo_emi>, <&wo_dlm>, <&wo_data>;
-        memory-region-names = "wo-emi", "wo-dlm", "wo-data";
+        memory-region = <&wo_emi>, <&wo_data>;
+        memory-region-names = "wo-emi", "wo-data";
         mediatek,wo-ccif = <&wo_ccif0>;
         mediatek,wo-cpuboot = <&wo_cpuboot>;
         mediatek,wo-ilm = <&wo_ilm>;
+        mediatek,wo-dlm = <&wo_dlm>;
       };
     };
diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-dlm.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-dlm.yaml
new file mode 100644
index 000000000000..2b9c6a8ef918
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-dlm.yaml
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,mt7986-wo-dlm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Wireless Ethernet Dispatch (WED) WO DLM firmware interface for MT7986
+
+maintainers:
+  - Lorenzo Bianconi <lorenzo@kernel.org>
+  - Felix Fietkau <nbd@nbd.name>
+
+description:
+  The MediaTek wo-dlm (Data Lifecycle Management) provides a configuration
+  interface for WED WO firmware rx rings, including firmware I/O descriptor
+  ring, feedback command ring. WED WO controller is used to perform offload
+  rx packet processing (e.g. 802.11 aggregation packet reordering or rx
+  header translation) on MT7986 soc.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt7986-wo-dlm
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      syscon@151e8000 {
+        compatible = "mediatek,mt7986-wo-dlm", "syscon";
+        reg = <0 0x151e8000 0 0x2000>;
+      };
+    };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 net-next 10/10] arm64: dts: mt7986: move dlm in a dedicated node
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (8 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 09/10] dt-bindings: soc: mediatek: move dlm in " Lorenzo Bianconi
@ 2023-03-31 13:12 ` Lorenzo Bianconi
  2023-04-06 15:25 ` [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Rob Herring
  10 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-03-31 13:12 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, pabeni, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

Since the dlm memory region is not part of the RAM SoC, move dlm in a
deidicated syscon node.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 30 ++++++++++++-----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index a0d96d232ee5..0ae6aa59d3c6 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -93,16 +93,6 @@ wo_data: wo-data@4fd80000 {
 			reg = <0 0x4fd80000 0 0x240000>;
 			no-map;
 		};
-
-		wo_dlm0: wo-dlm@151e8000 {
-			reg = <0 0x151e8000 0 0x2000>;
-			no-map;
-		};
-
-		wo_dlm1: wo-dlm@151f8000 {
-			reg = <0 0x151f8000 0 0x2000>;
-			no-map;
-		};
 	};
 
 	timer {
@@ -444,10 +434,11 @@ wed0: wed@15010000 {
 			reg = <0 0x15010000 0 0x1000>;
 			interrupt-parent = <&gic>;
 			interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
-			memory-region = <&wo_emi0>, <&wo_dlm0>, <&wo_data>;
-			memory-region-names = "wo-emi", "wo-dlm", "wo-data";
+			memory-region = <&wo_emi0>, <&wo_data>;
+			memory-region-names = "wo-emi", "wo-data";
 			mediatek,wo-ccif = <&wo_ccif0>;
 			mediatek,wo-ilm = <&wo_ilm0>;
+			mediatek,wo-dlm = <&wo_dlm0>;
 			mediatek,wo-cpuboot = <&wo_cpuboot>;
 		};
 
@@ -457,10 +448,11 @@ wed1: wed@15011000 {
 			reg = <0 0x15011000 0 0x1000>;
 			interrupt-parent = <&gic>;
 			interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
-			memory-region = <&wo_emi1>, <&wo_dlm1>, <&wo_data>;
-			memory-region-names = "wo-emi", "wo-dlm", "wo-data";
+			memory-region = <&wo_emi1>, <&wo_data>;
+			memory-region-names = "wo-emi", "wo-data";
 			mediatek,wo-ccif = <&wo_ccif1>;
 			mediatek,wo-ilm = <&wo_ilm1>;
+			mediatek,wo-dlm = <&wo_dlm1>;
 			mediatek,wo-cpuboot = <&wo_cpuboot>;
 		};
 
@@ -488,6 +480,16 @@ wo_ilm1: syscon@151f0000 {
 			reg = <0 0x151f0000 0 0x8000>;
 		};
 
+		wo_dlm0: syscon@151e8000 {
+			compatible = "mediatek,mt7986-wo-dlm", "syscon";
+			reg = <0 0x151e8000 0 0x2000>;
+		};
+
+		wo_dlm1: syscon@151f8000 {
+			compatible = "mediatek,mt7986-wo-dlm", "syscon";
+			reg = <0 0x151f8000 0 0x2000>;
+		};
+
 		wo_cpuboot: syscon@15194000 {
 			compatible = "mediatek,mt7986-wo-cpuboot", "syscon";
 			reg = <0 0x15194000 0 0x1000>;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node
  2023-03-31 13:12 ` [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node Lorenzo Bianconi
@ 2023-04-04  7:44   ` Paolo Abeni
  2023-04-04  8:06     ` Lorenzo Bianconi
  0 siblings, 1 reply; 16+ messages in thread
From: Paolo Abeni @ 2023-04-04  7:44 UTC (permalink / raw)
  To: Lorenzo Bianconi, netdev
  Cc: davem, edumazet, kuba, matthias.bgg, linux-mediatek, nbd, john,
	sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

On Fri, 2023-03-31 at 15:12 +0200, Lorenzo Bianconi wrote:
> Since the cpuboot memory region is not part of the RAM MT7986 SoC,
> move cpuboot in a deidicated syscon node.
> Keep backward-compatibility with older dts version where cpuboot was
> defined as reserved-memory child node.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 34 +++++++++++++++++----
>  drivers/net/ethernet/mediatek/mtk_wed_wo.h  |  3 +-
>  2 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> index 6624f6d6abdd..797c3b412ab6 100644
> --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> @@ -18,12 +18,23 @@
>  
>  static u32 wo_r32(struct mtk_wed_wo *wo, u32 reg)
>  {
> -	return readl(wo->boot.addr + reg);
> +	u32 val;
> +
> +	if (!wo->boot_regmap)
> +		return readl(wo->boot.addr + reg);
> +
> +	if (regmap_read(wo->boot_regmap, reg, &val))
> +		val = ~0;
> +
> +	return val;
>  }
>  
>  static void wo_w32(struct mtk_wed_wo *wo, u32 reg, u32 val)
>  {
> -	writel(val, wo->boot.addr + reg);
> +	if (wo->boot_regmap)
> +		regmap_write(wo->boot_regmap, reg, val);
> +	else
> +		writel(val, wo->boot.addr + reg);

Very minor nit: it would be more consistent with the read function
above if you invert the 2 branches, e.g.:

	if (!wo->boot_regmap)
		writel(val, wo->boot.addr + reg);
	else
		regmap_write(wo->boot_regmap, reg, val);

No need to repost just for the above, just take into consideration if a
new version will be needed for other reasons (DT)

Cheers,

Paolo


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node
  2023-04-04  7:44   ` Paolo Abeni
@ 2023-04-04  8:06     ` Lorenzo Bianconi
  0 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-04-04  8:06 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: netdev, davem, edumazet, kuba, matthias.bgg, linux-mediatek, nbd,
	john, sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel,
	krzysztof.kozlowski+dt, robh+dt, devicetree

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

> On Fri, 2023-03-31 at 15:12 +0200, Lorenzo Bianconi wrote:
> > Since the cpuboot memory region is not part of the RAM MT7986 SoC,
> > move cpuboot in a deidicated syscon node.
> > Keep backward-compatibility with older dts version where cpuboot was
> > defined as reserved-memory child node.
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >  drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 34 +++++++++++++++++----
> >  drivers/net/ethernet/mediatek/mtk_wed_wo.h  |  3 +-
> >  2 files changed, 30 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> > index 6624f6d6abdd..797c3b412ab6 100644
> > --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> > +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> > @@ -18,12 +18,23 @@
> >  
> >  static u32 wo_r32(struct mtk_wed_wo *wo, u32 reg)
> >  {
> > -	return readl(wo->boot.addr + reg);
> > +	u32 val;
> > +
> > +	if (!wo->boot_regmap)
> > +		return readl(wo->boot.addr + reg);
> > +
> > +	if (regmap_read(wo->boot_regmap, reg, &val))
> > +		val = ~0;
> > +
> > +	return val;
> >  }
> >  
> >  static void wo_w32(struct mtk_wed_wo *wo, u32 reg, u32 val)
> >  {
> > -	writel(val, wo->boot.addr + reg);
> > +	if (wo->boot_regmap)
> > +		regmap_write(wo->boot_regmap, reg, val);
> > +	else
> > +		writel(val, wo->boot.addr + reg);
> 
> Very minor nit: it would be more consistent with the read function
> above if you invert the 2 branches, e.g.:
> 
> 	if (!wo->boot_regmap)
> 		writel(val, wo->boot.addr + reg);
> 	else
> 		regmap_write(wo->boot_regmap, reg, val);
> 
> No need to repost just for the above, just take into consideration if a
> new version will be needed for other reasons (DT)

ack, will do.

Regards,
Lorenzo

> 
> Cheers,
> 
> Paolo
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 net-next 06/10] dt-bindings: soc: mediatek: move ilm in a dedicated dts node
  2023-03-31 13:12 ` [PATCH v2 net-next 06/10] dt-bindings: soc: mediatek: move ilm in " Lorenzo Bianconi
@ 2023-04-06  8:50   ` Paolo Abeni
  0 siblings, 0 replies; 16+ messages in thread
From: Paolo Abeni @ 2023-04-06  8:50 UTC (permalink / raw)
  To: krzysztof.kozlowski+dt, robh+dt
  Cc: davem, edumazet, kuba, matthias.bgg, linux-mediatek, nbd, john,
	sean.wang, Mark-MC.Lee, lorenzo.bianconi, daniel, devicetree,
	Lorenzo Bianconi, netdev

On Fri, 2023-03-31 at 15:12 +0200, Lorenzo Bianconi wrote:
> Since the ilm memory region is not part of the MT7986 RAM SoC, move ilm
> in a deidicated syscon node.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  .../arm/mediatek/mediatek,mt7622-wed.yaml     | 14 +++---
>  .../soc/mediatek/mediatek,mt7986-wo-ilm.yaml  | 45 +++++++++++++++++++
>  2 files changed, 53 insertions(+), 6 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml
> 
> diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
> index 7f6638d43854..e63fb22447c6 100644
> --- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
> +++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
> @@ -32,14 +32,12 @@ properties:
>    memory-region:
>      items:
>        - description: firmware EMI region
> -      - description: firmware ILM region
>        - description: firmware DLM region
>        - description: firmware CPU DATA region
>  
>    memory-region-names:
>      items:
>        - const: wo-emi
> -      - const: wo-ilm
>        - const: wo-dlm
>        - const: wo-data
>  
> @@ -51,6 +49,10 @@ properties:
>      $ref: /schemas/types.yaml#/definitions/phandle
>      description: mediatek wed-wo cpuboot controller interface.
>  
> +  mediatek,wo-ilm:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: mediatek wed-wo ilm interface.
> +
>  allOf:
>    - if:
>        properties:
> @@ -63,6 +65,7 @@ allOf:
>          memory-region: false
>          mediatek,wo-ccif: false
>          mediatek,wo-cpuboot: false
> +        mediatek,wo-ilm: false
>  
>  required:
>    - compatible
> @@ -97,11 +100,10 @@ examples:
>          reg = <0 0x15010000 0 0x1000>;
>          interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
>  
> -        memory-region = <&wo_emi>, <&wo_ilm>, <&wo_dlm>,
> -                        <&wo_data>;
> -        memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
> -                              "wo-data";
> +        memory-region = <&wo_emi>, <&wo_dlm>, <&wo_data>;
> +        memory-region-names = "wo-emi", "wo-dlm", "wo-data";
>          mediatek,wo-ccif = <&wo_ccif0>;
>          mediatek,wo-cpuboot = <&wo_cpuboot>;
> +        mediatek,wo-ilm = <&wo_ilm>;
>        };
>      };
> diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml
> new file mode 100644
> index 000000000000..2a3775cd941e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt7986-wo-ilm.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/mediatek/mediatek,mt7986-wo-ilm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek Wireless Ethernet Dispatch (WED) WO ILM firmware interface for MT7986
> +
> +maintainers:
> +  - Lorenzo Bianconi <lorenzo@kernel.org>
> +  - Felix Fietkau <nbd@nbd.name>
> +
> +description:
> +  The MediaTek wo-ilm (Information Lifecycle Management) provides a configuration
> +  interface for WiFi critical data used by WED WO firmware. WED WO controller is
> +  used to perform offload rx packet processing (e.g. 802.11 aggregation packet
> +  reordering or rx header translation) on MT7986 soc.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - mediatek,mt7986-wo-ilm
> +      - const: syscon
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    soc {
> +      #address-cells = <2>;
> +      #size-cells = <2>;
> +
> +      syscon@151e0000 {
> +        compatible = "mediatek,mt7986-wo-ilm", "syscon";
> +        reg = <0 0x151e0000 0 0x8000>;
> +      };
> +    };

Hi Rob,

it's not clear to me if this version and Lorenzo's replies on the
previous one address your doubts here. Do you have any further
comments?

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes
  2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
                   ` (9 preceding siblings ...)
  2023-03-31 13:12 ` [PATCH v2 net-next 10/10] arm64: dts: mt7986: move dlm in a dedicated node Lorenzo Bianconi
@ 2023-04-06 15:25 ` Rob Herring
  2023-04-10 14:54   ` Lorenzo Bianconi
  10 siblings, 1 reply; 16+ messages in thread
From: Rob Herring @ 2023-04-06 15:25 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, davem, edumazet, pabeni, kuba, matthias.bgg,
	linux-mediatek, nbd, john, sean.wang, Mark-MC.Lee,
	lorenzo.bianconi, daniel, krzysztof.kozlowski+dt, devicetree

On Fri, Mar 31, 2023 at 03:12:36PM +0200, Lorenzo Bianconi wrote:
> Since cpuboot, ilm and dlm memory region are not part of MT7986 SoC RAM,

That's not really a requirement. Is that the only "problem" here?

Certainly going from a standard binding to a custom phandle reference is 
not an improvement.

> move them in dedicated mt7986a syscon dts nodes.

What makes them a syscon? Are they memory or h/w registers? Can't be 
both...

Perhaps mmio-sram?

> At the same time we keep backward-compatibility with older dts version where
> cpuboot, ilm and dlm were defined as reserved-memory child nodes.

Doesn't really seem big enough issue to justify carrying this.

Rob

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes
  2023-04-06 15:25 ` [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Rob Herring
@ 2023-04-10 14:54   ` Lorenzo Bianconi
  0 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Bianconi @ 2023-04-10 14:54 UTC (permalink / raw)
  To: Rob Herring
  Cc: netdev, davem, edumazet, pabeni, kuba, matthias.bgg,
	linux-mediatek, nbd, john, sean.wang, Mark-MC.Lee,
	lorenzo.bianconi, daniel, krzysztof.kozlowski+dt, devicetree

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

> On Fri, Mar 31, 2023 at 03:12:36PM +0200, Lorenzo Bianconi wrote:
> > Since cpuboot, ilm and dlm memory region are not part of MT7986 SoC RAM,
> 
> That's not really a requirement. Is that the only "problem" here?

I would say this series allows to be closer to a standard binding and at the
same time helps with uboot compatibility.

> 
> Certainly going from a standard binding to a custom phandle reference is 
> not an improvement.
> 
> > move them in dedicated mt7986a syscon dts nodes.
> 
> What makes them a syscon? Are they memory or h/w registers? Can't be 
> both...

> 
> Perhaps mmio-sram?

ilm and dlm do not have h/w registers afaik, they are chip memory used
to store firmware information, syscon is just the closest binding I found.
I did not find mmio-sram, my fault.

Regards,
Lorenzo

> 
> > At the same time we keep backward-compatibility with older dts version where
> > cpuboot, ilm and dlm were defined as reserved-memory child nodes.
> 
> Doesn't really seem big enough issue to justify carrying this.
> 
> Rob

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-04-10 14:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 13:12 [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 01/10] net: ethernet: mtk_wed: rename mtk_wed_get_memory_region in mtk_wed_get_reserved_memory_region Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 02/10] net: ethernet: mtk_wed: move cpuboot in a dedicated dts node Lorenzo Bianconi
2023-04-04  7:44   ` Paolo Abeni
2023-04-04  8:06     ` Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 03/10] dt-bindings: soc: mediatek: " Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 04/10] arm64: dts: mt7986: move cpuboot in a dedicated node Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 05/10] net: ethernet: mtk_wed: move ilm a dedicated dts node Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 06/10] dt-bindings: soc: mediatek: move ilm in " Lorenzo Bianconi
2023-04-06  8:50   ` Paolo Abeni
2023-03-31 13:12 ` [PATCH v2 net-next 07/10] arm64: dts: mt7986: move ilm in a dedicated node Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 08/10] net: ethernet: mtk_wed: move dlm a dedicated dts node Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 09/10] dt-bindings: soc: mediatek: move dlm in " Lorenzo Bianconi
2023-03-31 13:12 ` [PATCH v2 net-next 10/10] arm64: dts: mt7986: move dlm in a dedicated node Lorenzo Bianconi
2023-04-06 15:25 ` [PATCH v2 net-next 00/10] mtk: wed: move cpuboot, ilm and dlm in dedicated dts nodes Rob Herring
2023-04-10 14:54   ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).