Enable access to memory resources not only via I/O address using reg,
but also through a portion of main memory using memory-region. To
achieve this, new compatible strings have been introduced: mtd-mem and
mtd-memro.
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
.../devicetree/bindings/mtd/mtd-physmap.yaml | 59 +++++++++++++++-------
1 file changed, 40 insertions(+), 19 deletions(-)
diff --git a/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml b/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
index 1b375dee83b0c..323e89aacaacd 100644
--- a/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
+++ b/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
@@ -13,10 +13,6 @@ description: |
Flash chips (Memory Technology Devices) are often used for solid state
file systems on embedded devices.
-allOf:
- - $ref: mtd.yaml#
- - $ref: /schemas/memory-controllers/mc-peripheral-props.yaml#
-
properties:
compatible:
oneOf:
@@ -61,6 +57,8 @@ properties:
- jedec-flash
- mtd-ram
- mtd-rom
+ - mtd-mem
+ - mtd-memro
reg:
description: |
@@ -116,6 +114,10 @@ properties:
minItems: 1
maxItems: 8
+ memory-region:
+ items:
+ - description: Memory regions to map into mtd
+
'#address-cells':
const: 1
@@ -129,21 +131,25 @@ properties:
required:
- compatible
- - reg
-
-if:
- properties:
- compatible:
- contains:
- const: cortina,gemini-flash
-then:
- properties:
- syscon:
- $ref: /schemas/types.yaml#/definitions/phandle
- description:
- Phandle to the syscon controller
- required:
- - syscon
+
+allOf:
+ - $ref: mtd.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - mtd-mem
+ - mtd-memro
+ then:
+ required:
+ - memory-region
+ properties:
+ addr-gpios: false
+ else:
+ $ref: /schemas/memory-controllers/mc-peripheral-props.yaml#
+ required:
+ - reg
unevaluatedProperties: false
@@ -223,4 +229,19 @@ examples:
reg = <0 0x04000000>;
};
};
+
+ - |
+ /* An example using mtd-mem */
+ mem_logs: mem_logs@10000800 {
+ reg = <0x1 0x0000800 0x0 0x000f800>;
+ no-map;
+ };
+
+ memlog {
+ compatible = "mtd-mem";
+ memory-region = <&mem_log>;
+ bank-width = <4>;
+ device-width = <1>;
+ };
+
...
--
2.51.0
On Fri, Nov 21, 2025 at 04:42:36PM +0100, Gregory CLEMENT wrote:
> Enable access to memory resources not only via I/O address using reg,
> but also through a portion of main memory using memory-region. To
> achieve this, new compatible strings have been introduced: mtd-mem and
> mtd-memro.
>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
> .../devicetree/bindings/mtd/mtd-physmap.yaml | 59 +++++++++++++++-------
> 1 file changed, 40 insertions(+), 19 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml b/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
> index 1b375dee83b0c..323e89aacaacd 100644
> --- a/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
> +++ b/Documentation/devicetree/bindings/mtd/mtd-physmap.yaml
> @@ -13,10 +13,6 @@ description: |
> Flash chips (Memory Technology Devices) are often used for solid state
> file systems on embedded devices.
>
> -allOf:
> - - $ref: mtd.yaml#
> - - $ref: /schemas/memory-controllers/mc-peripheral-props.yaml#
> -
> properties:
> compatible:
> oneOf:
> @@ -61,6 +57,8 @@ properties:
> - jedec-flash
> - mtd-ram
> - mtd-rom
> + - mtd-mem
> + - mtd-memro
>
> reg:
> description: |
> @@ -116,6 +114,10 @@ properties:
> minItems: 1
> maxItems: 8
>
> + memory-region:
> + items:
> + - description: Memory regions to map into mtd
> +
> '#address-cells':
> const: 1
>
> @@ -129,21 +131,25 @@ properties:
>
> required:
> - compatible
> - - reg
> -
> -if:
> - properties:
> - compatible:
> - contains:
> - const: cortina,gemini-flash
> -then:
> - properties:
> - syscon:
> - $ref: /schemas/types.yaml#/definitions/phandle
> - description:
> - Phandle to the syscon controller
> - required:
> - - syscon
> +
> +allOf:
> + - $ref: mtd.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - mtd-mem
> + - mtd-memro
> + then:
> + required:
> + - memory-region
> + properties:
> + addr-gpios: false
> + else:
> + $ref: /schemas/memory-controllers/mc-peripheral-props.yaml#
> + required:
> + - reg
>
> unevaluatedProperties: false
>
> @@ -223,4 +229,19 @@ examples:
> reg = <0 0x04000000>;
> };
> };
> +
> + - |
> + /* An example using mtd-mem */
> + mem_logs: mem_logs@10000800 {
> + reg = <0x1 0x0000800 0x0 0x000f800>;
> + no-map;
> + };
> +
> + memlog {
> + compatible = "mtd-mem";
> + memory-region = <&mem_log>;
> + bank-width = <4>;
> + device-width = <1>;
> + };
To repeat v1 comment:
> If we do keep this, I'd rather just add the properties below into the
> /reserved-memory node itself. Devices are created for those nodes if
> they have 'compatible'.
To put it another way, see the ramoops binding and copy that.
Rob
On Fri, 21 Nov 2025 16:42:36 +0100, Gregory CLEMENT wrote: > Enable access to memory resources not only via I/O address using reg, > but also through a portion of main memory using memory-region. To > achieve this, new compatible strings have been introduced: mtd-mem and > mtd-memro. > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> > --- > .../devicetree/bindings/mtd/mtd-physmap.yaml | 59 +++++++++++++++------- > 1 file changed, 40 insertions(+), 19 deletions(-) > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/mtd-physmap.example.dtb: memlog (mtd-mem): $nodename:0: 'memlog' does not match '^(flash|.*sram|nand)(@.*)?$' from schema $id: http://devicetree.org/schemas/mtd/mtd-physmap.yaml doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20251121-mtd-memregion-v2-2-c5535fdcebe4@bootlin.com The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
© 2016 - 2025 Red Hat, Inc.