Skip to contentSkip to conversation

mtd: parsers: add support for Sercomm partitions

PATCH Superseded Mikhail Zhilkin 2 participants 6 messages Mar 29, 2022 – May 12, 2022 Memory technology devices (MTD)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: parsers: add support for Sercomm partitions

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.

Device tree example:

partitions {
	compatible = "sercomm,sc-partitions", "fixed-partitions";
	#address-cells = <1>;
	#size-cells = <1>;

	partition@0 {
		label = "u-boot";
		reg = <0x0 0x100000>;
		scpart-id = <0>;
		read-only;
	};
};

This is essentially the same code as proposed by NOGUCHI Hiroshi <[email protected]> here:
https://github.com/openwrt/openwrt/pull/1318#issuecomment-420607394

---
 drivers/mtd/parsers/Kconfig  |   9 ++
 drivers/mtd/parsers/Makefile |   1 +
 drivers/mtd/parsers/scpart.c | 243 +++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+)
 create mode 100644 drivers/mtd/parsers/scpart.c
drivers/mtd/parsers/Kconfig +9 -0
index 23763d16e4f9..92a95297ca84 100644
@@ -180,6 +180,15 @@ config MTD_REDBOOT_PARTS_READONLY
 
 endif # MTD_REDBOOT_PARTS
 
+config MTD_SERCOMM_PARTS
+	tristate "Sercomm flash partition parser"
+	depends on MTD_OF_PARTS
+	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.
+
 config MTD_QCOMSMEM_PARTS
 	tristate "Qualcomm SMEM flash partition parser"
 	depends on QCOM_SMEM
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 +243 -0

243 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#1 lore raw

Hi Mikhail,

[email protected] wrote on Tue, 29 Mar 2022 12:20:16 +0000:

Quoted 8 lines

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.

Device tree example:

Quoted 12 lines
partitions {
	compatible = "sercomm,sc-partitions", "fixed-partitions";
	#address-cells = <1>;
	#size-cells = <1>;

	partition@0 {
		label = "u-boot";
		reg = <0x0 0x100000>;
		scpart-id = <0>;
		read-only;
	};
};

You'll need a DT binding patch and Rob's ack!

Quoted 3 lines

This is essentially the same code as proposed by NOGUCHI Hiroshi <[email protected]> here:

I would credit Hiroshi with a Suggested-by at least

Quoted 1 line

https://github.com/openwrt/openwrt/pull/1318#issuecomment-420607394

And use a Link: tag for this.

Quoted 3 lines

---

Thanks,
Miquèl

#2 lore raw

Hi Miquel,

Quoted 17 lines · Miquel Raynal

Hi Mikhail,

[email protected] wrote on Tue, 29 Mar 2022 12:20:16 +0000:

Quoted 13 lines

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.

Device tree example:

partitions {
	compatible = "sercomm,sc-partitions", "fixed-partitions";
	#address-cells = <1>;
	#size-cells = <1>;
Quoted 8 lines
Quoted 7 lines
	partition@0 {
		label = "u-boot";
		reg = <0x0 0x100000>;
		scpart-id = <0>;
		read-only;
	};
};

You'll need a DT binding patch and Rob's ack!

I hope that I near to finish with DT binding...

Link:
https://lore.kernel.org/all/[email protected]/

Link:
https://lore.kernel.org/all/[email protected]/

Quoted 3 lines
Quoted 2 lines

This is essentially the same code as proposed by NOGUCHI Hiroshi <[email protected]> here:

I would credit Hiroshi with a Suggested-by at least

I read submitting patches rules again and thought that Signed-off-by is suitable for this case. Is this ok?

Link:
https://lore.kernel.org/all/[email protected]/

Quoted 3 lines
Quoted 1 line

https://github.com/openwrt/openwrt/pull/1318#issuecomment-420607394

And use a Link: tag for this.

Fixed, thanks!

Link:
https://lore.kernel.org/all/[email protected]/

Quoted 2 lines

Thanks,
Miquèl

Signature · 2 lines
Best regards,
Mikhail
maintainer
#3 lore raw

Hi Mikhail,

[email protected] wrote on Tue, 10 May 2022 23:07:23 +0300:

Quoted 37 lines

Hi Miquel,

Quoted 17 lines · Miquel Raynal

Hi Mikhail,

[email protected] wrote on Tue, 29 Mar 2022 12:20:16 +0000:

Quoted 13 lines

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.

Device tree example:

partitions {
	compatible = "sercomm,sc-partitions", "fixed-partitions";
	#address-cells = <1>;
	#size-cells = <1>;
Quoted 8 lines
Quoted 7 lines
	partition@0 {
		label = "u-boot";
		reg = <0x0 0x100000>;
		scpart-id = <0>;
		read-only;
	};
};  

You'll need a DT binding patch and Rob's ack!

I hope that I near to finish with DT binding...

Link:
https://lore.kernel.org/all/[email protected]/

Link:
https://lore.kernel.org/all/[email protected]/

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This is essentially the same code as proposed by NOGUCHI Hiroshi <[email protected]> here:

I would credit Hiroshi with a Suggested-by at least

I read submitting patches rules again and thought that Signed-off-by is suitable for this case. Is this ok?

Either you take his work almost like it is and he must be the author *and* the first signed-off-by line, or you take the authorship if you think you did enough modifications to the code and in this case you can either credit him with a suggested-by before your signed-off, or you can credit him with a co-developed-by + his signed-off and then yours.

Quoted 4 lines

Link:
https://lore.kernel.org/all/[email protected]/

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

https://github.com/openwrt/openwrt/pull/1318#issuecomment-420607394

And use a Link: tag for this.

Fixed, thanks!

Link:
https://lore.kernel.org/all/[email protected]/

Quoted 2 lines

Thanks,
Miquèl

Thanks,
Miquèl

#4 lore raw
Quoted 10 lines · Miquel Raynal
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

This is essentially the same code as proposed by NOGUCHI Hiroshi <[email protected]> here:

I would credit Hiroshi with a Suggested-by at least

I read submitting patches rules again and thought that Signed-off-by is suitable for this case. Is this ok?

Either you take his work almost like it is and he must be the author *and* the first signed-off-by line, or you take the authorship if you think you did enough modifications to the code and in this case you can either credit him with a suggested-by before your signed-off, or you can credit him with a co-developed-by + his signed-off and then yours.

Thank you for clarification! My modifications were quite small:
- 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()

Therefore, I prefer to keep the authorship of the original author (NOGUCHI Hiroshi).

Patch is really good and was successfully tested on the hundreds of Sercomm devices (5.4, 5.10, 5.15 Kernel). My motivation for upstreaming is work under official support for these devices in OpenWrt.

What are the next steps from my side in this case? Should I wait for review of this patch here (Link: https://lore.kernel.org/linux-mtd/[email protected]/T/#u
) or do I need to do something additionally (for example, send updated set v5 with Acked-by from Krzysztof in the first patch)?

And sorry for the many questions... I haven't fully mastered the Linux change management process and best practices yet.

Quoted 2 lines

Thanks,
Miquèl

Signature · 2 lines
Best regards,
Mikhail
maintainer
#5 lore raw

Hi Mikhail,

[email protected] wrote on Wed, 11 May 2022 23:36:18 +0300:

Quoted 20 lines · Miquel Raynal
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

This is essentially the same code as proposed by NOGUCHI Hiroshi <[email protected]> here:

I would credit Hiroshi with a Suggested-by at least

I read submitting patches rules again and thought that Signed-off-by is suitable for this case. Is this ok?

Either you take his work almost like it is and he must be the author *and* the first signed-off-by line, or you take the authorship if you think you did enough modifications to the code and in this case you can either credit him with a suggested-by before your signed-off, or you can credit him with a co-developed-by + his signed-off and then yours.

Thank you for clarification! My modifications were quite small:
- 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()

Quoted 8 lines

Therefore, I prefer to keep the authorship of the original author (NOGUCHI Hiroshi).

Patch is really good and was successfully tested on the hundreds of Sercomm devices (5.4, 5.10, 5.15 Kernel). My motivation for upstreaming is work under official support for these devices in OpenWrt.

What are the next steps from my side in this case? Should I wait for review of this patch here (Link: https://lore.kernel.org/linux-mtd/[email protected]/T/#u
) or do I need to do something additionally (for example, send updated set v5 with Acked-by from Krzysztof in the first patch)?

And sorry for the many questions... I haven't fully mastered the Linux change management process and best practices yet.

We are used to incremental changes, so please send another version with the tags collected, the changes that I requested regarding the authorship and we'll see what happens to the next version.

Thanks,
Miquèl