Skip to contentSkip to conversation

dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions

PATCH Superseded Arnab Layek 4 participants 11 messages May 6 – May 14

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions

Update the memory-region property to support 1-2 reserved memory regions instead of exactly one. This is needed for newer MediaTek SoCs like MT8188 which require additional memory regions for SCP operation.

Tested on MT8188 Geralt platform.

---
 .../devicetree/bindings/remoteproc/mtk,scp.yaml        | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +8 -2
index bdbb12118da4..9f6dca94ff40 100644
@@ -55,7 +55,10 @@ properties:
       initializing SCP.
 
   memory-region:
-    maxItems: 1
+    description:
+      Phandle to the reserved memory regions.
+    minItems: 1
+    maxItems: 2
 
   cros-ec-rpmsg:
     $ref: /schemas/embedded-controller/google,cros-ec.yaml
@@ -123,7 +126,10 @@ patternProperties:
           initializing sub cores of multi-core SCP.
 
       memory-region:
-        maxItems: 1
+        description:
+          Phandle to the reserved memory regions.
+        minItems: 1
+        maxItems: 2
 
       cros-ec-rpmsg:
         $ref: /schemas/embedded-controller/google,cros-ec.yaml
Signature · 1 line
2.45.2
#1 lore raw
Quoted 4 lines · Arnab Layek

Update the memory-region property to support 1-2 reserved memory regions instead of exactly one. This is needed for newer MediaTek SoCs like MT8188 which require additional memory regions for SCP operation.

So where is the compatible? Already there?

Quoted 2 lines

Tested on MT8188 Geralt platform.

You cannot test binding.

Quoted 11 lines
---
 .../devicetree/bindings/remoteproc/mtk,scp.yaml        | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +0 -0
index bdbb12118da4..9f6dca94ff40 100644

Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml properties: · line 61

Quoted 8 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +4 -1
@@ -55,7 +55,10 @@ properties:
       initializing SCP.
 
   memory-region:
-    maxItems: 1
+    description:
+      Phandle to the reserved memory regions.
+    minItems: 1
+    maxItems: 2

Just like I sent some patches long time ago for iommus Mediatek media bindings - fix it the same way. Pity the patches were not picked up, even though sending twice, but that does not give you easier way to get incorrect code in. You just multiple poor patterns...

Best regards,
Krzysztof

#2 lore raw

v2 cover dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

In reply to Arnab Layek

This patch updates the MediaTek SCP device tree binding to support multiple memory regions for MT8188 SoCs, addressing review feedback from v1.

The MT8188 SCP requires two memory regions (SRAM + L1TCM) while other MediaTek SoCs use only one. This patch follows the proper pattern of using conditional schemas with explicit descriptions.

Changes in v2:
- Use conditional schema (if/then in allOf) to restrict multiple memory regions only to MT8188 variants, keeping maxItems: 1 as default for other SoCs (addresses Krzysztof's review)
- Add explicit item descriptions for each memory region (Main SRAM and optional L1TCM) instead of just setting minItems/maxItems
- Apply to both top-level and patternProperties

Based on linux-next, tag: next-20260505

Arnab Layek (1):
dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for

    MT8188
 .../bindings/remoteproc/mtk,scp.yaml          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
Signature · 1 line
2.45.2
#3 lore raw

PATCH v2 1/1 dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

The MT8188 SCP requires two reserved memory regions:
1. Main SCP SRAM memory region (required)
2. SCP L1TCM memory region (optional, for additional memory)

Some other MediaTek SoCs only use a single memory region. This patch adds a conditional schema using if/then to allow 1-2 memory regions specifically for mediatek,mt8188-scp and mediatek,mt8188-scp-dual compatibles, while keeping the default maxItems: 1 for other SoCs.

Each memory region is documented with descriptions to clarify their purpose, following the pattern used in other bindings.

---
 .../bindings/remoteproc/mtk,scp.yaml          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +21 -0
index bdbb12118da4..df13be2026a6 100644
@@ -205,6 +205,27 @@ allOf:
           items:
             - const: cfg
             - const: l1tcm
+  - if:
+      properties:
+        compatible:
+          enum:
+            - mediatek,mt8188-scp
+            - mediatek,mt8188-scp-dual
+    then:
+      properties:
+        memory-region:
+          minItems: 1
+          items:
+            - description: Main SCP SRAM memory region
+            - description: Optional SCP L1TCM memory region
+      patternProperties:
+        "^scp@[a-f0-9]+$":
+          properties:
+            memory-region:
+              minItems: 1
+              items:
+                - description: Main SCP SRAM memory region
+                - description: Optional SCP L1TCM memory region
 
 additionalProperties: false
 
Signature · 1 line
2.45.2
#4 lore raw

Re: [PATCH v2 1/1] dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

Quoted 37 lines · Arnab Layek

The MT8188 SCP requires two reserved memory regions:
1. Main SCP SRAM memory region (required)
2. SCP L1TCM memory region (optional, for additional memory)

Some other MediaTek SoCs only use a single memory region. This patch adds a conditional schema using if/then to allow 1-2 memory regions specifically for mediatek,mt8188-scp and mediatek,mt8188-scp-dual compatibles, while keeping the default maxItems: 1 for other SoCs.

Each memory region is documented with descriptions to clarify their purpose, following the pattern used in other bindings.

---
 .../bindings/remoteproc/mtk,scp.yaml          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +11 -0
index bdbb12118da4..df13be2026a6 100644
@@ -205,6 +205,27 @@ allOf:
           items:
             - const: cfg
             - const: l1tcm
+  - if:
+      properties:
+        compatible:
+          enum:
+            - mediatek,mt8188-scp
+            - mediatek,mt8188-scp-dual
+    then:
+      properties:
+        memory-region:
+          minItems: 1
+          items:

Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml allOf: · line 228

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +10 -0
+            - description: Main SCP SRAM memory region
+            - description: Optional SCP L1TCM memory region
+      patternProperties:
+        "^scp@[a-f0-9]+$":
+          properties:
+            memory-region:
+              minItems: 1
+              items:
+                - description: Main SCP SRAM memory region
+                - description: Optional SCP L1TCM memory region

Does this even work, given that memory-region has maxItems: 1 outside the conditional section?

Cheers,
Conor.

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +0 -0
 additionalProperties: false
 
Signature · 1 line
2.45.2
#5 lore raw

Re: [PATCH v2 1/1] dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

In reply to Arnab Layek
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Schema constraint override failure for `memory-region` maxItems --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Schema constraint override failure for memory-region maxItems --

commit 609e858e4a4e669b55ac4136f210e50fe09b79a7
Author: Arnab Layek <[email protected]>

dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

This commit attempts to allow up to two memory regions for MT8188 compatibles by adding an if/then block. The new regions are documented with descriptions for the main SCP SRAM and the optional SCP L1TCM.

Quoted 4 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +0 -0
index bdbb12118da43..df13be2026a67 100644

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +3 -0
@@ -205,6 +205,27 @@ allOf:
           items:
             - const: cfg
             - const: l1tcm
+  - if:
+      properties:
+        compatible:

Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml allOf: · line 220

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +10 -0
+          enum:
+            - mediatek,mt8188-scp
+            - mediatek,mt8188-scp-dual
+    then:
+      properties:
+        memory-region:
+          minItems: 1
+          items:
+            - description: Main SCP SRAM memory region
+            - description: Optional SCP L1TCM memory region

Does this code introduce a regression where 2 items are not actually allowed for these compatibles?

In dt-schema, constraints are evaluated additively. The base schema explicitly defines maxItems: 1 for memory-region. Because an if/then block cannot override or relax a stricter constraint from the base schema, a device tree specifying 2 memory regions for mediatek,mt8188-scp will still violate the base maxItems: 1 constraint and fail dt_binding_check.

Does the global constraint need to be increased to maxItems: 2, and then
maxItems: 1 enforced selectively for other SoCs via conditional blocks?

Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml allOf: · line 228

Quoted 8 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +8 -0
+      patternProperties:
+        "^scp@[a-f0-9]+$":
+          properties:
+            memory-region:
+              minItems: 1
+              items:
+                - description: Main SCP SRAM memory region
+                - description: Optional SCP L1TCM memory region

Does this patternProperties block have the same regression?

The base patternProperties block for ^scp@[a-f0-9]+$ also defines
maxItems: 1 for memory-region, which would likewise prevent this conditional block from allowing multiple items.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#6 lore raw

Re: [PATCH v2 1/1] dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

In reply to Arnab Layek
Quoted 5 lines · Arnab Layek

The MT8188 SCP requires two reserved memory regions:
1. Main SCP SRAM memory region (required)
2. SCP L1TCM memory region (optional, for additional memory)

Some other MediaTek SoCs only use a single memory region. This patch adds

Please do not use "This commit/patch/change", but imperative mood. See longer explanation here:
https://elixir.bootlin.com/linux/v6.16/source/Documentation/process/submitting-patches.rst#L94

Quoted 4 lines

a conditional schema using if/then to allow 1-2 memory regions specifically for mediatek,mt8188-scp and mediatek,mt8188-scp-dual compatibles, while keeping the default maxItems: 1 for other SoCs.

Stop explaining what you did. Explain WHY. Why second entry is optional? Why are you changing existing binding? Was it working? Not? Why not? Why yes?

Quoted 3 lines

Each memory region is documented with descriptions to clarify their purpose, following the pattern used in other bindings.

Redundant. We can read the diff.

Quoted 17 lines
---
 .../bindings/remoteproc/mtk,scp.yaml          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +3 -0
index bdbb12118da4..df13be2026a6 100644
@@ -205,6 +205,27 @@ allOf:
           items:
             - const: cfg
             - const: l1tcm
+  - if:
+      properties:
+        compatible:

Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml allOf: · line 220

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +10 -0
+          enum:
+            - mediatek,mt8188-scp
+            - mediatek,mt8188-scp-dual
+    then:
+      properties:
+        memory-region:
+          minItems: 1
+          items:
+            - description: Main SCP SRAM memory region
+            - description: Optional SCP L1TCM memory region

Conflicts top level.

Quoted 14 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +8 -0
+      patternProperties:
+        "^scp@[a-f0-9]+$":
+          properties:
+            memory-region:
+              minItems: 1
+              items:
+                - description: Main SCP SRAM memory region
+                - description: Optional SCP L1TCM memory region
 
 additionalProperties: false
 
Signature · 1 line
2.45.2
#7 lore raw

v3 cover dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

In reply to Arnab Layek

This series updates the mtk,scp dt-binding schema to support MT8188's requirement for two memory regions while maintaining backward compatibility for other MediaTek SoCs.

The schema uses a permissive base with restrictive conditionals:
1) Base schema allows all devices minItems: 1, maxItems: 2
2) Non-MT8188 devices (mt8183, mt8186, mt8192, mt8195, mt8195-dual) are restricted to maxItems: 1, overriding the base
3) MT8188 devices (mt8188, mt8188-dual) set minItems: 1 with item descriptions, inheriting maxItems: 2 from base, making the second L1TCM region optional

Changes in v3:
- Removed "Tested on..." line per Krzysztof's feedback (bindings cannot be tested)
- Added minItems: 1 to MT8188 conditional to make L1TCM region truly optional
- Clarified commit message to specifically reference mediatek,jpeg-encoder.yaml pattern
- Restructured schema per Conor's feedback: base allows maxItems: 2, conditionals restrict
- Added explicit restrictions for non-MT8188 devices (maxItems: 1)
- Added technical explanation of the permissive base + restrictive conditionals pattern

Changes in v2:
- Added conditional schema for MT8188 to allow 1-2 memory regions
- Added descriptions for each memory region
- Did not work: base maxItems: 1 conflicted with conditional trying to allow 2

Arnab Layek (1):
dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for

    MT8188
 .../bindings/remoteproc/mtk,scp.yaml          | 45 ++++++++++++++++++-
 1 file changed, 43 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
#8 lore raw

PATCH v3 1/1 dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

The MT8188 SCP requires support for 1-2 reserved memory regions, while other MediaTek SoCs use only a single memory region.

The schema uses a permissive base with restrictive conditionals:
1) Base schema allows all devices minItems: 1, maxItems: 2
2) Non-MT8188 devices (mt8183, mt8186, mt8192, mt8195, mt8195-dual) are restricted to maxItems: 1, overriding the base
3) MT8188 devices (mt8188, mt8188-dual) set minItems: 1 with item descriptions, inheriting maxItems: 2 from base, making the second L1TCM region optional

This follows the same pattern as other MediaTek dt-bindings such as mediatek,jpeg-encoder.yaml which uses conditional schemas to support different numbers of iommus per device variant.

---
 .../bindings/remoteproc/mtk,scp.yaml          | 45 ++++++++++++++++++-
 1 file changed, 43 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +43 -2
index bdbb12118da4..fca9b0675eae 100644
@@ -55,7 +55,8 @@ properties:
       initializing SCP.
 
   memory-region:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   cros-ec-rpmsg:
     $ref: /schemas/embedded-controller/google,cros-ec.yaml
@@ -123,7 +124,8 @@ patternProperties:
           initializing sub cores of multi-core SCP.
 
       memory-region:
-        maxItems: 1
+        minItems: 1
+        maxItems: 2
 
       cros-ec-rpmsg:
         $ref: /schemas/embedded-controller/google,cros-ec.yaml
@@ -205,6 +207,45 @@ allOf:
           items:
             - const: cfg
             - const: l1tcm
+  - if:
+      properties:
+        compatible:
+          enum:
+            - mediatek,mt8183-scp
+            - mediatek,mt8186-scp
+            - mediatek,mt8192-scp
+            - mediatek,mt8195-scp
+            - mediatek,mt8195-scp-dual
+    then:
+      properties:
+        memory-region:
+          maxItems: 1
+      patternProperties:
+        "^scp@[a-f0-9]+$":
+          properties:
+            memory-region:
+              maxItems: 1
+  - if:
+      properties:
+        compatible:
+          enum:
+            - mediatek,mt8188-scp
+            - mediatek,mt8188-scp-dual
+    then:
+      properties:
+        memory-region:
+          minItems: 1
+          items:
+            - description: Main SCP SRAM memory region
+            - description: Optional SCP L1TCM memory region
+      patternProperties:
+        "^scp@[a-f0-9]+$":
+          properties:
+            memory-region:
+              minItems: 1
+              items:
+                - description: Main SCP SRAM memory region
+                - description: Optional SCP L1TCM memory region
 
 additionalProperties: false
 
Signature · 1 line
2.45.2
#9 lore raw

Re: [PATCH v3 1/1] dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

Quoted 11 lines · Arnab Layek

The MT8188 SCP requires support for 1-2 reserved memory regions, while other MediaTek SoCs use only a single memory region.

The schema uses a permissive base with restrictive conditionals:
1) Base schema allows all devices minItems: 1, maxItems: 2
2) Non-MT8188 devices (mt8183, mt8186, mt8192, mt8195, mt8195-dual) are restricted to maxItems: 1, overriding the base
3) MT8188 devices (mt8188, mt8188-dual) set minItems: 1 with item descriptions, inheriting maxItems: 2 from base, making the second L1TCM region optional

Quoted 4 lines

This follows the same pattern as other MediaTek dt-bindings such as mediatek,jpeg-encoder.yaml which uses conditional schemas to support different numbers of iommus per device variant.

So I just reviewed v2, because it appeared in patchwork thread... because you just threaded v3 there.

No, really, this was repeated also to Mediatek so many times.

Implement v2 review.

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH v3 1/1] dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188

Quoted 17 lines · Krzysztof Kozlowski
Quoted 11 lines · Arnab Layek

The MT8188 SCP requires support for 1-2 reserved memory regions, while other MediaTek SoCs use only a single memory region.

The schema uses a permissive base with restrictive conditionals:
1) Base schema allows all devices minItems: 1, maxItems: 2
2) Non-MT8188 devices (mt8183, mt8186, mt8192, mt8195, mt8195-dual) are restricted to maxItems: 1, overriding the base
3) MT8188 devices (mt8188, mt8188-dual) set minItems: 1 with item descriptions, inheriting maxItems: 2 from base, making the second L1TCM region optional

Quoted 4 lines

This follows the same pattern as other MediaTek dt-bindings such as mediatek,jpeg-encoder.yaml which uses conditional schemas to support different numbers of iommus per device variant.

Quoted 7 lines

So I just reviewed v2, because it appeared in patchwork thread... because you just threaded v3 there.

No, really, this was repeated also to Mediatek so many times.

Implement v2 review.

Heh, and now I noticed that you just merged THREE versions in one thread leading to complete mess in this entire thread.

Best regards,
Krzysztof