[PATCH v2 1/2] dt-bindings: mtd: partitions: Add binding for Sercomm parser

From: Mikhail Zhilkin
Date: Sat Apr 09 2022 - 14:05:18 EST


On 4/9/2022 3:43 PM, Krzysztof Kozlowski wrote:

>> I'm not sure that "scpart-id" is necessary here. "sercomm,sc-partitions"
>> is necessary. I'm going to add vendor prefix in a separate patch. Is this
>> ok?
> Yes.

Thanks!

>>>> +required:
>>>> + - compatible
>>> Missing reg.
>> reg isn't required. Parser can read partition offsets and sizes from
>> SC PART MAP table. Or do you mean something else?  All is ok
>> without reg definition in "Example" (except the warns that reg property
>> is missing).
> reg might not be required for current implementation but it is required
> by devicetree for every node with unit address. Do you expect here nodes
> without unit addresses?
Only "partitions" node has no unit address. All subnodes  have unit
addresses and therefore have to have reg property. I've just realized
that "fixed-partitions.yaml" is almost my case. It looks like I can
copy'n'paste  "required" and "*properties".
Do you mind if I don't reinvent the wheel and reuse this good
practice?

Here's what I got (no any warnings appears):

---
 .../mtd/partitions/sercomm,sc-partitions.yaml | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/mtd/partitions/sercomm,sc-partitions.yaml

diff --git
a/Documentation/devicetree/bindings/mtd/partitions/sercomm,sc-partitions.yaml
b/Documentation/devicetree/bindings/mtd/partitions/sercomm,sc-partitions.yaml
new file mode 100644
index 000000000000..cb171a0383aa
--- /dev/null
+++
b/Documentation/devicetree/bindings/mtd/partitions/sercomm,sc-partitions.yaml
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id:
http://devicetree.org/schemas/mtd/partitions/sercomm,sc-partitions.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sercomm Partitions
+
+description: |
+  Sercomm is one of hardware manufacturers providing SoCs used in home
routers.
+  The Sercomm partition map table contains information about non-standard
+  partition offsets and sizes (depending on the bad blocks presence and
their
+  locations). Partition map is used by many Sercomm-based Ralink devices
+  (e.g. Beeline, Netgear).
+
+maintainers:
+  - Mikhail Zhilkin <csharper2005@xxxxxxxxx>
+
+properties:
+  compatible:
+    const: sercomm,sc-partitions
+
+  "#address-cells": true
+
+  "#size-cells": true
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: true
+
+examples:
+  - |
+    partitions {
+        compatible = "sercomm,sc-partitions";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        partition@0 {
+            label = "u-boot";
+            reg = <0x0 0x100000>;
+            scpart-id = <0>;
+            read-only;
+        };
+
+        partition@100000 {
+            label = "dynamic partition map";
+            reg = <0x100000 0x100000>;
+            scpart-id = <1>;
+        };
+
+        factory: partition@200000 {
+            label = "Factory";
+            reg = <0x200000 0x100000>;
+            scpart-id = <2>;
+            read-only;
+
+            compatible = "nvmem-cells";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            macaddr_factory_21000: macaddr@21000 {
+                reg = <0x21000 0x6>;
+            };
+        };
+
+        /* ... */
+
+    };
--

(...)

> Best regards,
> Krzysztof

--
Best regards,
Mikhail