2022-03-08 14:19:21

by Vincent Whitchurch

[permalink] [raw]
Subject: [PATCH 2/4] dt-bindings: reserved-memory: Add phram

Add bindings to allow MTD/block devices to be created in reserved-memory
regions using the "phram" driver.

This allows things like partitioning to be specified via the existing
devicetree bindings.

Signed-off-by: Vincent Whitchurch <[email protected]>
---
.../bindings/reserved-memory/phram.yaml | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 Documentation/devicetree/bindings/reserved-memory/phram.yaml

diff --git a/Documentation/devicetree/bindings/reserved-memory/phram.yaml b/Documentation/devicetree/bindings/reserved-memory/phram.yaml
new file mode 100644
index 000000000000..92e7a80ee87a
--- /dev/null
+++ b/Documentation/devicetree/bindings/reserved-memory/phram.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reserved-memory/phram.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MTD/block device in RAM
+
+description: |
+ Use the reserved memory region as an MTD or block device.
+
+ If no-map is not set, cached mappings will be used for the memory region.
+
+maintainers:
+ - Vincent Whitchurch <[email protected]>
+
+allOf:
+ - $ref: "reserved-memory.yaml"
+ - $ref: "../mtd/mtd.yaml"
+
+properties:
+ compatible:
+ const: phram
+
+ reg:
+ description: region of memory that contains the MTD/block device
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ reserved-memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ phram: flash@12340000 {
+ compatible = "phram";
+ label = "rootfs";
+ reg = <0x12340000 0x00800000>;
+ };
+ };
--
2.34.1


2022-03-11 22:16:26

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 2/4] dt-bindings: reserved-memory: Add phram

On Mon, Mar 07, 2022 at 03:15:47PM +0100, Vincent Whitchurch wrote:
> Add bindings to allow MTD/block devices to be created in reserved-memory
> regions using the "phram" driver.

What does 'ph' mean? Please define somewhere for the binding.

>
> This allows things like partitioning to be specified via the existing
> devicetree bindings.
>
> Signed-off-by: Vincent Whitchurch <[email protected]>
> ---
> .../bindings/reserved-memory/phram.yaml | 45 +++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/reserved-memory/phram.yaml
>
> diff --git a/Documentation/devicetree/bindings/reserved-memory/phram.yaml b/Documentation/devicetree/bindings/reserved-memory/phram.yaml
> new file mode 100644
> index 000000000000..92e7a80ee87a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reserved-memory/phram.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/reserved-memory/phram.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MTD/block device in RAM
> +
> +description: |
> + Use the reserved memory region as an MTD or block device.
> +
> + If no-map is not set, cached mappings will be used for the memory region.
> +
> +maintainers:
> + - Vincent Whitchurch <[email protected]>
> +
> +allOf:
> + - $ref: "reserved-memory.yaml"
> + - $ref: "../mtd/mtd.yaml"

/schemas/mtd/mtd.yaml

> +
> +properties:
> + compatible:
> + const: phram
> +
> + reg:
> + description: region of memory that contains the MTD/block device
> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + reserved-memory {
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + phram: flash@12340000 {
> + compatible = "phram";
> + label = "rootfs";

That's an odd example...

> + reg = <0x12340000 0x00800000>;
> + };
> + };
> --
> 2.34.1
>
>

2022-03-11 23:28:06

by Vincent Whitchurch

[permalink] [raw]
Subject: Re: [PATCH 2/4] dt-bindings: reserved-memory: Add phram

On Thu, Mar 10, 2022 at 09:58:58PM +0100, Rob Herring wrote:
> On Mon, Mar 07, 2022 at 03:15:47PM +0100, Vincent Whitchurch wrote:
> > Add bindings to allow MTD/block devices to be created in reserved-memory
> > regions using the "phram" driver.
>
> What does 'ph' mean? Please define somewhere for the binding.

Judging from the Kconfig description it means "physical", as in
"physical memory" (as opposed to virtual memory I guess). I will added
a note in the next version.

[...]
> > +examples:
> > + - |
> > + reserved-memory {
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> > +
> > + phram: flash@12340000 {
> > + compatible = "phram";
> > + label = "rootfs";
>
> That's an odd example...

If it's the "flash" name which is odd for RAM, that's mandated by the
mtd schema.

If it's the "rootfs" label which is odd, I'm not sure I understand why.
I use this feature to pass the rootfs to the kernel when booting from
RAM. It is much faster and requires less memory than initrd (which is
on top of that being deprecated), and it allows the same disk images to
be used when booting from RAM, unlike initramfs.