Skip to contentSkip to conversation

xilinx: zynq: add FDT_FIXUP_PARTITIONS support

PATCH In review James Hilliard 2 participants 4 messages Apr 1, 2024 – Apr 3, 2024 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xilinx: zynq: add FDT_FIXUP_PARTITIONS support

There are situations where we may want to let U-Boot modify the FDT nand partitions for the kernel, such as when supporting multiple sizes of NAND chips.

---
Changes v1 -> v2:
- move partition fixups to board/xilinx/common/board.c

---
 board/xilinx/common/board.c | 9 +++++++++
 1 file changed, 9 insertions(+)
board/xilinx/common/board.c +9 -0
index 9641ed307b..20a6f00e45 100644
@@ -12,6 +12,7 @@
 #include <env.h>
 #include <image.h>
 #include <init.h>
+#include <jffs2/load_kernel.h>
 #include <lmb.h>
 #include <log.h>
 #include <asm/global_data.h>
@@ -20,6 +21,7 @@
 #include <i2c.h>
 #include <linux/sizes.h>
 #include <malloc.h>
+#include <mtd_node.h>
 #include "board.h"
 #include <dm.h>
 #include <i2c_eeprom.h>
@@ -693,6 +695,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 	u8 buf[MAX_RAND_SIZE];
 	int nodeoffset, ret;
 
+	static const struct node_info nodes[] = {
+		{ "arm,pl353-nand-r2p1", MTD_DEV_TYPE_NAND, },
+	};
+
+	if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS) && IS_ENABLED(CONFIG_NAND_ZYNQ))
+		fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+
 	if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) {
 		debug("No RNG device\n");
 		return 0;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 17 lines · James Hilliard

There are situations where we may want to let U-Boot modify the FDT nand partitions for the kernel, such as when supporting multiple sizes of NAND chips.

---
Changes v1 -> v2:
- move partition fixups to board/xilinx/common/board.c

---
  board/xilinx/common/board.c | 9 +++++++++
  1 file changed, 9 insertions(+)
board/xilinx/common/board.c +0 -0
index 9641ed307b..20a6f00e45 100644

board/xilinx/common/board.c line 15

Quoted 4 lines
board/xilinx/common/board.c +1 -0
@@ -12,6 +12,7 @@
  #include <env.h>
  #include <image.h>
  #include <init.h>
+#include <jffs2/load_kernel.h>

What is this header used for?

Quoted 15 lines
board/xilinx/common/board.c +1 -0
  #include <lmb.h>
  #include <log.h>
  #include <asm/global_data.h>
@@ -20,6 +21,7 @@
  #include <i2c.h>
  #include <linux/sizes.h>
  #include <malloc.h>
+#include <mtd_node.h>
  #include "board.h"
  #include <dm.h>
  #include <i2c_eeprom.h>
@@ -693,6 +695,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
  	u8 buf[MAX_RAND_SIZE];
  	int nodeoffset, ret;
 

board/xilinx/common/board.c int ft_board_setup(void *blob, struct bd_info *bd) · line 707

Quoted 10 lines
board/xilinx/common/board.c +7 -0
+	static const struct node_info nodes[] = {
+		{ "arm,pl353-nand-r2p1", MTD_DEV_TYPE_NAND, },
+	};
+
+	if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS) && IS_ENABLED(CONFIG_NAND_ZYNQ))
+		fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+
  	if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) {
  		debug("No RNG device\n");
  		return 0;

M

#2 lore raw
Quoted 16 lines · Michal Simek
Quoted 12 lines · James Hilliard

There are situations where we may want to let U-Boot modify the FDT nand partitions for the kernel, such as when supporting multiple sizes of NAND chips.

---
Changes v1 -> v2:
- move partition fixups to board/xilinx/common/board.c

---
  board/xilinx/common/board.c | 9 +++++++++
  1 file changed, 9 insertions(+)
Quoted 11 lines

board/xilinx/common/board.c line 15

Quoted 9 lines
board/xilinx/common/board.c +1 -0
index 9641ed307b..20a6f00e45 100644
@@ -12,6 +12,7 @@
  #include <env.h>
  #include <image.h>
  #include <init.h>
+#include <jffs2/load_kernel.h>

What is this header used for?

It's needed for MTD_DEV_TYPE_NAND.

Quoted 28 lines
Quoted 16 lines
board/xilinx/common/board.c +1 -0
  #include <lmb.h>
  #include <log.h>
  #include <asm/global_data.h>
@@ -20,6 +21,7 @@
  #include <i2c.h>
  #include <linux/sizes.h>
  #include <malloc.h>
+#include <mtd_node.h>
  #include "board.h"
  #include <dm.h>
  #include <i2c_eeprom.h>
@@ -693,6 +695,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
      u8 buf[MAX_RAND_SIZE];
      int nodeoffset, ret;
 

board/xilinx/common/board.c int ft_board_setup(void *blob, struct bd_info *bd) · line 707

Quoted 10 lines
board/xilinx/common/board.c +7 -0
+     static const struct node_info nodes[] = {
+             { "arm,pl353-nand-r2p1", MTD_DEV_TYPE_NAND, },
+     };
+
+     if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS) && IS_ENABLED(CONFIG_NAND_ZYNQ))
+             fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+
      if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) {
              debug("No RNG device\n");
              return 0;

M

maintainer
#3 lore raw
Quoted 29 lines · James Hilliard
Quoted 16 lines · Michal Simek
Quoted 12 lines · James Hilliard

There are situations where we may want to let U-Boot modify the FDT nand partitions for the kernel, such as when supporting multiple sizes of NAND chips.

---
Changes v1 -> v2:
- move partition fixups to board/xilinx/common/board.c

---
   board/xilinx/common/board.c | 9 +++++++++
   1 file changed, 9 insertions(+)
Quoted 11 lines

board/xilinx/common/board.c line 15

Quoted 9 lines
board/xilinx/common/board.c +1 -0
index 9641ed307b..20a6f00e45 100644
@@ -12,6 +12,7 @@
   #include <env.h>
   #include <image.h>
   #include <init.h>
+#include <jffs2/load_kernel.h>

What is this header used for?

Quoted 1 line

It's needed for MTD_DEV_TYPE_NAND.

Location is weird. Anyway applied.

Thanks,
Michal