Skip to contentSkip to conversation

arm: mvebu: turris_omnia: Fix MTD partitions order for Linux

PATCH In review Pali Rohár 2 participants 3 messages Oct 21, 2021 – Oct 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: mvebu: turris_omnia: Fix MTD partitions order for Linux

Linux enumerates MTD partitions in DTB order, while the fdt_add_subnode() function puts a new subnode at the beginning.

To fix this, put MTD partitions into DTB in reverse order.

Fixes 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB")
---
 board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/CZ.NIC/turris_omnia/turris_omnia.c +1 -1
index a48e1f5c305d..d2f510993449 100644
@@ -601,7 +601,7 @@ static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd)
 
 	mtd_probe_devices();
 
-	list_for_each_entry(slave, &mtd->partitions, node) {
+	list_for_each_entry_reverse(slave, &mtd->partitions, node) {
 		char name[32];
 		int part;
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Pali Rohár

Linux enumerates MTD partitions in DTB order, while the fdt_add_subnode() function puts a new subnode at the beginning.

To fix this, put MTD partitions into DTB in reverse order.

Fixes 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB")

Thanks,
Stefan

Quoted 10 lines
---
  board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
board/CZ.NIC/turris_omnia/turris_omnia.c +0 -0
index a48e1f5c305d..d2f510993449 100644

board/CZ.NIC/turris_omnia/turris_omnia.c static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd) · line 607

Quoted 8 lines
board/CZ.NIC/turris_omnia/turris_omnia.c +1 -1
@@ -601,7 +601,7 @@ static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd)
 
  	mtd_probe_devices();
 
-	list_for_each_entry(slave, &mtd->partitions, node) {
+	list_for_each_entry_reverse(slave, &mtd->partitions, node) {
  		char name[32];
  		int part;
 

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#2 lore raw
In reply to Pali Rohár
Quoted 8 lines · Pali Rohár

Linux enumerates MTD partitions in DTB order, while the fdt_add_subnode() function puts a new subnode at the beginning.

To fix this, put MTD partitions into DTB in reverse order.

Fixes 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB")

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 10 lines
---
  board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
board/CZ.NIC/turris_omnia/turris_omnia.c +0 -0
index a48e1f5c305d..d2f510993449 100644

board/CZ.NIC/turris_omnia/turris_omnia.c static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd) · line 607

Quoted 8 lines
board/CZ.NIC/turris_omnia/turris_omnia.c +1 -1
@@ -601,7 +601,7 @@ static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd)
 
  	mtd_probe_devices();
 
-	list_for_each_entry(slave, &mtd->partitions, node) {
+	list_for_each_entry_reverse(slave, &mtd->partitions, node) {
  		char name[32];
  		int part;
 

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]