diff mbox series

[08/12] board: stm32mp1: use fdt_copy_fixed_partitions

Message ID 20230608171614.8.I7bf81c0580c1c801def7453d5d05c323a1b8d620@changeid
State Accepted
Commit 8a8efacf5f2b518f56db53dbf3ac9f6ad431c4e5
Delegated to: Patrice Chotard
Headers show
Series stm32mp1: use U-Boot device tree to configure MTD partitions | expand

Commit Message

Patrick DELAUNAY June 8, 2023, 3:16 p.m. UTC
Copy the fixed partition nodes from U-Boot device tree to Linux kernel
device tree to dynamically configure the MTD partitions.

fdt_copy_fixed_partitions is only based on device tree
and replace the function fdt_fixup_mtdparts based on mtdparts variable;
the variable mtdid and mtdparts are not more required.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 board/st/stm32mp1/stm32mp1.c        | 16 +---------------
 configs/stm32mp13_defconfig         |  1 -
 configs/stm32mp15_basic_defconfig   |  1 -
 configs/stm32mp15_defconfig         |  1 -
 configs/stm32mp15_trusted_defconfig |  1 -
 5 files changed, 1 insertion(+), 19 deletions(-)

Comments

Patrice CHOTARD June 13, 2023, 6:23 a.m. UTC | #1
On 6/8/23 17:16, Patrick Delaunay wrote:
> Copy the fixed partition nodes from U-Boot device tree to Linux kernel
> device tree to dynamically configure the MTD partitions.
> 
> fdt_copy_fixed_partitions is only based on device tree
> and replace the function fdt_fixup_mtdparts based on mtdparts variable;
> the variable mtdid and mtdparts are not more required.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  board/st/stm32mp1/stm32mp1.c        | 16 +---------------
>  configs/stm32mp13_defconfig         |  1 -
>  configs/stm32mp15_basic_defconfig   |  1 -
>  configs/stm32mp15_defconfig         |  1 -
>  configs/stm32mp15_trusted_defconfig |  1 -
>  5 files changed, 1 insertion(+), 19 deletions(-)
> 
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 1a1b1844c8c0..be850151e5fc 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -25,7 +25,6 @@
>  #include <log.h>
>  #include <malloc.h>
>  #include <misc.h>
> -#include <mtd_node.h>
>  #include <net.h>
>  #include <netdev.h>
>  #include <phy.h>
> @@ -915,20 +914,7 @@ int mmc_get_env_dev(void)
>  #if defined(CONFIG_OF_BOARD_SETUP)
>  int ft_board_setup(void *blob, struct bd_info *bd)
>  {
> -	static const struct node_info nodes[] = {
> -		{ "jedec,spi-nor",		MTD_DEV_TYPE_NOR,  },
> -		{ "spi-nand",			MTD_DEV_TYPE_SPINAND},
> -		{ "st,stm32mp15-fmc2",		MTD_DEV_TYPE_NAND, },
> -		{ "st,stm32mp1-fmc2-nfc",	MTD_DEV_TYPE_NAND, },
> -	};
> -	char *boot_device;
> -
> -	/* Check the boot-source and don't update MTD for serial or usb boot */
> -	boot_device = env_get("boot_device");
> -	if (!boot_device ||
> -	    (strcmp(boot_device, "serial") && strcmp(boot_device, "usb")))
> -		if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS))
> -			fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
> +	fdt_copy_fixed_partitions(blob);
>  
>  	if (IS_ENABLED(CONFIG_FDT_SIMPLEFB))
>  		fdt_simplefb_enable_and_mem_rsv(blob);
> diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig
> index 02a29cd9f03a..a9cc7e4d0353 100644
> --- a/configs/stm32mp13_defconfig
> +++ b/configs/stm32mp13_defconfig
> @@ -74,7 +74,6 @@ CONFIG_TEE=y
>  CONFIG_OPTEE=y
>  # CONFIG_OPTEE_TA_AVB is not set
>  CONFIG_ERRNO_STR=y
> -CONFIG_FDT_FIXUP_PARTITIONS=y
>  # CONFIG_LMB_USE_MAX_REGIONS is not set
>  CONFIG_LMB_MEMORY_REGIONS=2
>  CONFIG_LMB_RESERVED_REGIONS=16
> diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
> index 273b72fdaf0a..7661159110e5 100644
> --- a/configs/stm32mp15_basic_defconfig
> +++ b/configs/stm32mp15_basic_defconfig
> @@ -188,7 +188,6 @@ CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  # CONFIG_BINMAN_FDT is not set
>  CONFIG_ERRNO_STR=y
> -CONFIG_FDT_FIXUP_PARTITIONS=y
>  # CONFIG_LMB_USE_MAX_REGIONS is not set
>  CONFIG_LMB_MEMORY_REGIONS=2
>  CONFIG_LMB_RESERVED_REGIONS=16
> diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig
> index b1f0f2f7c784..1ff9f73730d3 100644
> --- a/configs/stm32mp15_defconfig
> +++ b/configs/stm32mp15_defconfig
> @@ -164,7 +164,6 @@ CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  # CONFIG_BINMAN_FDT is not set
>  CONFIG_ERRNO_STR=y
> -CONFIG_FDT_FIXUP_PARTITIONS=y
>  # CONFIG_LMB_USE_MAX_REGIONS is not set
>  CONFIG_LMB_MEMORY_REGIONS=2
>  CONFIG_LMB_RESERVED_REGIONS=16
> diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
> index bcfd60e5a85a..e7bf2e171ace 100644
> --- a/configs/stm32mp15_trusted_defconfig
> +++ b/configs/stm32mp15_trusted_defconfig
> @@ -164,7 +164,6 @@ CONFIG_WDT=y
>  CONFIG_WDT_STM32MP=y
>  # CONFIG_BINMAN_FDT is not set
>  CONFIG_ERRNO_STR=y
> -CONFIG_FDT_FIXUP_PARTITIONS=y
>  # CONFIG_LMB_USE_MAX_REGIONS is not set
>  CONFIG_LMB_MEMORY_REGIONS=2
>  CONFIG_LMB_RESERVED_REGIONS=16
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 1a1b1844c8c0..be850151e5fc 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -25,7 +25,6 @@ 
 #include <log.h>
 #include <malloc.h>
 #include <misc.h>
-#include <mtd_node.h>
 #include <net.h>
 #include <netdev.h>
 #include <phy.h>
@@ -915,20 +914,7 @@  int mmc_get_env_dev(void)
 #if defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
-	static const struct node_info nodes[] = {
-		{ "jedec,spi-nor",		MTD_DEV_TYPE_NOR,  },
-		{ "spi-nand",			MTD_DEV_TYPE_SPINAND},
-		{ "st,stm32mp15-fmc2",		MTD_DEV_TYPE_NAND, },
-		{ "st,stm32mp1-fmc2-nfc",	MTD_DEV_TYPE_NAND, },
-	};
-	char *boot_device;
-
-	/* Check the boot-source and don't update MTD for serial or usb boot */
-	boot_device = env_get("boot_device");
-	if (!boot_device ||
-	    (strcmp(boot_device, "serial") && strcmp(boot_device, "usb")))
-		if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS))
-			fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+	fdt_copy_fixed_partitions(blob);
 
 	if (IS_ENABLED(CONFIG_FDT_SIMPLEFB))
 		fdt_simplefb_enable_and_mem_rsv(blob);
diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig
index 02a29cd9f03a..a9cc7e4d0353 100644
--- a/configs/stm32mp13_defconfig
+++ b/configs/stm32mp13_defconfig
@@ -74,7 +74,6 @@  CONFIG_TEE=y
 CONFIG_OPTEE=y
 # CONFIG_OPTEE_TA_AVB is not set
 CONFIG_ERRNO_STR=y
-CONFIG_FDT_FIXUP_PARTITIONS=y
 # CONFIG_LMB_USE_MAX_REGIONS is not set
 CONFIG_LMB_MEMORY_REGIONS=2
 CONFIG_LMB_RESERVED_REGIONS=16
diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index 273b72fdaf0a..7661159110e5 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -188,7 +188,6 @@  CONFIG_WDT=y
 CONFIG_WDT_STM32MP=y
 # CONFIG_BINMAN_FDT is not set
 CONFIG_ERRNO_STR=y
-CONFIG_FDT_FIXUP_PARTITIONS=y
 # CONFIG_LMB_USE_MAX_REGIONS is not set
 CONFIG_LMB_MEMORY_REGIONS=2
 CONFIG_LMB_RESERVED_REGIONS=16
diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig
index b1f0f2f7c784..1ff9f73730d3 100644
--- a/configs/stm32mp15_defconfig
+++ b/configs/stm32mp15_defconfig
@@ -164,7 +164,6 @@  CONFIG_WDT=y
 CONFIG_WDT_STM32MP=y
 # CONFIG_BINMAN_FDT is not set
 CONFIG_ERRNO_STR=y
-CONFIG_FDT_FIXUP_PARTITIONS=y
 # CONFIG_LMB_USE_MAX_REGIONS is not set
 CONFIG_LMB_MEMORY_REGIONS=2
 CONFIG_LMB_RESERVED_REGIONS=16
diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
index bcfd60e5a85a..e7bf2e171ace 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -164,7 +164,6 @@  CONFIG_WDT=y
 CONFIG_WDT_STM32MP=y
 # CONFIG_BINMAN_FDT is not set
 CONFIG_ERRNO_STR=y
-CONFIG_FDT_FIXUP_PARTITIONS=y
 # CONFIG_LMB_USE_MAX_REGIONS is not set
 CONFIG_LMB_MEMORY_REGIONS=2
 CONFIG_LMB_RESERVED_REGIONS=16