dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188
Subsystems (3)
v4 cover dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188
This patch updates the mtk,scp dt-binding schema to support MT8188's requirement for 1-2 memory regions while maintaining strict backward compatibility for other MediaTek SoCs.
The MT8188 SCP requires a main SRAM region and optionally supports an L1TCM (Level 1 Tightly Coupled Memory) region for performance optimization. L1TCM is optional because basic SCP functionality works with only SRAM, but L1TCM provides faster memory access when the board hardware configuration includes it.
The base schema uses minItems: 1, maxItems: 2 (permissive range), following the pattern established in other MediaTek dt-bindings like mediatek,vcodec-encoder.yaml where the base accommodates all variants. Conditionals then narrow the constraints per device.
Changes in v4:
- Improved commit message clarity per kernel submission guidelines:
* Added bullet-point explanation of the two memory regions
* Explained WHY L1TCM is optional (performance optimization, not required for basic functionality)
* Explicitly listed which SoCs remain single-region
* Clarified the two-conditional approach
* Explained how minItems: 1 allows board-specific configuration
- Cover letter updated to explain L1TCM optional reasoning
Changes in v3:
- Removed "Tested on..." line (bindings cannot be tested)
- Added minItems: 1 to MT8188 conditional to make L1TCM truly optional
- Referenced mediatek,vcodec-encoder.yaml iommus pattern explicitly
- Base schema: minItems: 1, maxItems: 2 (permissive range)
- Non-MT8188: explicitly restricted to maxItems: 1
- MT8188: documented with item descriptions for both regions
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
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
PATCH v4 1/1 dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188
The MT8188 SCP can use either one or two reserved memory regions:
- Required: Main SCP SRAM memory region (mandatory for SCP operation)
- Optional: SCP L1TCM memory region (Level 1 Tightly Coupled Memory, used for performance optimization when available, but not required for basic SCP functionality)
Other MediaTek SoCs (MT8183, MT8186, MT8192, MT8195) use only a single memory region and must remain restricted to one region for backward compatibility.
Update the base schema to allow 1-2 memory regions (minItems: 1,
maxItems: 2), following the pattern used by other MediaTek dt-bindings like mediatek,vcodec-encoder.yaml where the base property defines a permissive range accommodating all device variants.
Add two conditionals:
1. Explicitly restrict non-MT8188 devices to maxItems: 1
2. Document MT8188's two regions with descriptions (minItems: 1 makes the L1TCM region optional, allowing boards to specify 1-2 regions based on hardware configuration)
This approach maintains backward compatibility while enabling MT8188 to specify 1-2 memory regions depending on board design and performance requirements.
--- .../bindings/remoteproc/mtk,scp.yaml | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +43 -2
@@ -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
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The dt-bindings are updated to allow MT8188 to provide L1TCM via a second `memory-region`, but…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The dt-bindings are updated to allow MT8188 to provide L1TCM via a second memory-region, but the mtk_scp driver does not support parsing L1TCM from memory-region. --
commit a5d9a931f3a31fccb0fec319f48f7f29be5209e8
Author: Arnab Layek <[email protected]>
dt-bindings: remoteproc: mtk,scp: Allow multiple memory regions for MT8188
This commit updates the MT8188 SCP binding to allow an optional second memory region for Level 1 Tightly Coupled Memory. The base schema is updated to allow up to two memory regions, keeping other devices restricted to one region for backward compatibility.
Quoted 4 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +0
-0
[ ... ]
Quoted 1 line
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +0
-0@@ -205,6 +207,45 @@ allOf:
[ ... ]
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml allOf: · line 240
Quoted 13 lines
Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +13
-0+ - 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
[Severity: Medium]
Are there regressions when the L1TCM region is specified as a memory-region instead of a reg property?
Looking at the mtk_scp driver implementation, it appears to fetch L1TCM exclusively by looking up an IORESOURCE_MEM resource named l1tcm, which corresponds to the reg property rather than memory-region:
drivers/remoteproc/mtk_scp.c:scp_probe() {
...
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
if (res) {
scp->l1tcm_base = devm_ioremap_resource(dev, res);
...
}Since of_reserved_mem_device_init() typically only maps the first memory region, and the driver checks the reg properties for l1tcm, could this cause a regression where the second memory-region is silently ignored at runtime, leaving the L1TCM performance optimizations non-functional?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 21 lines · Arnab Layek
The MT8188 SCP can use either one or two reserved memory regions:
- Required: Main SCP SRAM memory region (mandatory for SCP operation)
- Optional: SCP L1TCM memory region (Level 1 Tightly Coupled Memory, used for performance optimization when available, but not required for basic SCP functionality)Other MediaTek SoCs (MT8183, MT8186, MT8192, MT8195) use only a single memory region and must remain restricted to one region for backward compatibility.
Update the base schema to allow 1-2 memory regions (minItems: 1,
maxItems: 2), following the pattern used by other MediaTek dt-bindings like mediatek,vcodec-encoder.yaml where the base property defines a permissive range accommodating all device variants.Add two conditionals:
1. Explicitly restrict non-MT8188 devices to maxItems: 1
2. Document MT8188's two regions with descriptions (minItems: 1 makes the L1TCM region optional, allowing boards to specify 1-2 regions based on hardware configuration)
Quoted 5 lines
This approach maintains backward compatibility while enabling MT8188 to specify 1-2 memory regions depending on board design and performance requirements.
Signed-off-by Arnab Layek <[email protected]>
pw-bot: not-applicable
Cheers,
Conor.
Quoted 76 lines
--- .../bindings/remoteproc/mtk,scp.yaml | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +43
-2@@ -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: falseSignature · 1 line
2.45.2