Skip to contentSkip to conversation

Add support for Sercomm partitions

PATCH Superseded Mikhail Zhilkin 3 participants 6 messages May 10, 2022 – May 13, 2022

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add support for Sercomm partitions

This patch series add support for Sercomm mtd partition table parser. It's used in some Beeline, Netgear and Sercomm routers. The Sercomm partition map table contains real partition offsets, which may differ from device to device depending on the number and location of bad blocks on NAND.

Changes since:
v3:
- Fix commit message of the first patch
- Add Reviewed-by to the second patch

v2:
- Fix mistakes in dt-binding
- Add patch for new vendor prefix
- Add vendor prefix to scpart-id property

v1:
- Add dt-binding in a separate patch
- Remove redundant braces and logical NOT operator
- Define pr_fmt
- Replace kcalloc by kzalloc
- Use of_get_child_count() and alloc big enough array before the for_each_child_of_node()

Mikhail Zhilkin (3):
dt-bindings: Add Sercomm (Suzhou) Corporation vendor prefix
dt-bindings: mtd: partitions: Extend fixed-partitions binding
mtd: parsers: add support for Sercomm partitions

 .../mtd/partitions/fixed-partitions.yaml      |  55 +++-
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/mtd/parsers/Kconfig                   |   9 +
 drivers/mtd/parsers/Makefile                  |   1 +
 drivers/mtd/parsers/scpart.c                  | 240 ++++++++++++++++++
 5 files changed, 305 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mtd/parsers/scpart.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/3 dt-bindings: Add Sercomm (Suzhou) Corporation vendor prefix

Add "sercomm" vendor prefix for "Sercomm (Suzhou) Corporation".

Company website:

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 01430973ecec..65ff22364fb3 100644
@@ -1082,6 +1082,8 @@ patternProperties:
     description: Sensirion AG
   "^sensortek,.*":
     description: Sensortek Technology Corporation
+  "^sercomm,.*":
+    description: Sercomm (Suzhou) Corporation
   "^sff,.*":
     description: Small Form Factor Committee
   "^sgd,.*":
Signature · 1 line
2.25.1
Acked-by on v4 1/3
#2 lore raw

Re: [PATCH v4 1/3] dt-bindings: Add Sercomm (Suzhou) Corporation vendor prefix

Quoted 9 lines · Mikhail Zhilkin

Add "sercomm" vendor prefix for "Sercomm (Suzhou) Corporation".

Company website:

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

Best regards,
Krzysztof

#3 lore raw

PATCH v4 2/3 dt-bindings: mtd: partitions: Extend fixed-partitions binding

In reply to Mikhail Zhilkin

Extend fixed-partitions binding for support of Sercomm partition parser (add "sercomm,sc-partitions" compatible).

---
 .../mtd/partitions/fixed-partitions.yaml      | 55 ++++++++++++++++++-
 1 file changed, 53 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +53 -2
index ea4cace6a955..ad3ccd250802 100644
@@ -19,7 +19,11 @@ maintainers:
 
 properties:
   compatible:
-    const: fixed-partitions
+    oneOf:
+      - const: fixed-partitions
+      - items:
+          - const: sercomm,sc-partitions
+          - const: fixed-partitions
 
   "#address-cells": true
 
@@ -27,7 +31,24 @@ properties:
 
 patternProperties:
   "@[0-9a-f]+$":
-    $ref: "partition.yaml#"
+    allOf:
+      - $ref: "partition.yaml#"
+      - if:
+          properties:
+            compatible:
+              contains:
+                const: sercomm,sc-partitions
+        then:
+          properties:
+            sercomm,scpart-id:
+              description: Partition id in Sercomm partition map. Mtd
+                parser uses this id to find a record in the partition map
+                containing offset and size of the current partition. The
+                values from partition map overrides partition offset and
+                size defined in reg property of the dts. Frequently these
+                values are the same, but may differ if device has bad
+                eraseblocks on a flash.
+              $ref: /schemas/types.yaml#/definitions/uint32
 
 required:
   - "#address-cells"
@@ -52,6 +73,7 @@ examples:
             reg = <0x0100000 0x200000>;
         };
     };
+
   - |
     partitions {
         compatible = "fixed-partitions";
@@ -64,6 +86,7 @@ examples:
             reg = <0x00000000 0x1 0x00000000>;
         };
     };
+
   - |
     partitions {
         compatible = "fixed-partitions";
@@ -82,6 +105,7 @@ examples:
             reg = <0x2 0x00000000 0x1 0x00000000>;
         };
     };
+
   - |
     partitions {
         compatible = "fixed-partitions";
@@ -119,3 +143,30 @@ examples:
             };
         };
     };
+
+  - |
+    partitions {
+        compatible = "sercomm,sc-partitions", "fixed-partitions";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        partition@0 {
+            label = "u-boot";
+            reg = <0x0 0x100000>;
+            sercomm,scpart-id = <0>;
+            read-only;
+        };
+
+        partition@100000 {
+            label = "dynamic partition map";
+            reg = <0x100000 0x100000>;
+            sercomm,scpart-id = <1>;
+        };
+
+        partition@200000 {
+            label = "Factory";
+            reg = <0x200000 0x100000>;
+            sercomm,scpart-id = <2>;
+            read-only;
+        };
+    };
Signature · 1 line
2.25.1
#4 lore raw

PATCH v4 3/3 mtd: parsers: add support for Sercomm partitions

In reply to Mikhail Zhilkin

This adds an MTD partition parser for the Sercomm partition table that is used in some Beeline, Netgear and Sercomm routers.

The Sercomm partition map table contains real partition offsets, which may differ from device to device depending on the number and location of bad blocks on NAND.

This is essentially the same code as proposed by NOGUCHI Hiroshi:

---
 drivers/mtd/parsers/Kconfig  |   9 ++
 drivers/mtd/parsers/Makefile |   1 +
 drivers/mtd/parsers/scpart.c | 240 +++++++++++++++++++++++++++++++++++
 3 files changed, 250 insertions(+)
 create mode 100644 drivers/mtd/parsers/scpart.c
drivers/mtd/parsers/Kconfig +9 -0
index 23763d16e4f9..851f4670d89b 100644
@@ -186,3 +186,12 @@ config MTD_QCOMSMEM_PARTS
 	help
 	  This provides support for parsing partitions from Shared Memory (SMEM)
 	  for NAND and SPI flash on Qualcomm platforms.
+
+config MTD_SERCOMM_PARTS
+	tristate "Sercomm partition table parser"
+	depends on MTD
+	help
+	  This provides partitions table parser for devices with Sercomm
+	  partition map. This partition table contains real partition
+	  offsets, which may differ from device to device depending on the
+	  number and location of bad blocks on NAND.
drivers/mtd/parsers/Makefile +1 -0
index 2e98aa048278..2fcf0ab9e7da 100644
@@ -10,6 +10,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o
 obj-$(CONFIG_MTD_PARSER_IMAGETAG)	+= parser_imagetag.o
 obj-$(CONFIG_MTD_AFS_PARTS)		+= afs.o
 obj-$(CONFIG_MTD_PARSER_TRX)		+= parser_trx.o
+obj-$(CONFIG_MTD_SERCOMM_PARTS)		+= scpart.o
 obj-$(CONFIG_MTD_SHARPSL_PARTS)		+= sharpslpart.o
 obj-$(CONFIG_MTD_REDBOOT_PARTS)		+= redboot.o
 obj-$(CONFIG_MTD_QCOMSMEM_PARTS)	+= qcomsmempart.o
drivers/mtd/parsers/scpart.c new file +240 -0

240 lines not on this page · raw message

Signature · 6 lines
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#5 lore raw

Re: [PATCH v4 3/3] mtd: parsers: add support for Sercomm partitions

Thank you for the patch! Yet something to improve:

Hi Mikhail,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on mtd/mtd/fixes v5.18-rc6 next-20220512] [cannot apply to mtd/mtd/next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Mikhail-Zhilkin/Add-support-for-Sercomm-partitions/20220511-003050
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-buildonly-randconfig-r004-20220512 (https://download.01.org/0day-ci/archive/20220513/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9519dacab7b8afd537811fc2abaceb4d14f4e16a)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/4e746c022f0e23b585b21e8b9f42a1ee6a75471f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mikhail-Zhilkin/Add-support-for-Sercomm-partitions/20220511-003050 git checkout 4e746c022f0e23b585b21e8b9f42a1ee6a75471f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

ld.lld: warning: lld uses blx instruction, no object with architecture supporting feature detected ld.lld: warning: lld uses blx instruction, no object with architecture supporting feature detected

>> ld.lld: error: undefined symbol: __aeabi_uldivmod
   >>> referenced by scpart.c:72 (drivers/mtd/parsers/scpart.c:72)
   >>>               mtd/parsers/scpart.o:(scpart_parse) in archive drivers/built-in.a
   >>> did you mean: __aeabi_uidivmod
   >>> defined in: arch/arm/lib/lib.a(lib1funcs.o)
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp