[U-Boot] [PATCH 2/2] mtd: Get rid of board_mtdparts_default()

Ladislav Michl ladis at linux-mips.org
Tue Dec 11 22:55:26 UTC 2018


Hi Boris,

On Mon, Dec 10, 2018 at 04:38:50PM +0100, Boris Brezillon wrote:
> The only implementer of this function has been patched to use
> CONFIG_MTD{IDS,PARTS}_DEFAULT instead. Let's get rid of this function
> and the associated CONFIG_SYS_MTDPARTS_RUNTIME option.

the only implementer of this fuction did so for a good reason. What is
a motivation to remove it?

The requirement is to be able to use single u-boot binary on all igep2
boards ever produced. These comes with various NAND and OneNAND chips
and  I was not able to come with single static partition configuration
to support them all. Hence runtime detection. That code could be used
on all OMAP3 boards as BootROM reads up to first four sectors searching
for SPL (MLO).

Thank you,
	ladis

> Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>
> ---
>  board/isee/igep00x0/igep00x0.c   | 17 -----------------
>  cmd/mtdparts.c                   |  6 ------
>  drivers/mtd/mtd_uboot.c          | 10 ++--------
>  include/configs/omap3_igep00x0.h |  2 --
>  scripts/config_whitelist.txt     |  1 -
>  5 files changed, 2 insertions(+), 34 deletions(-)
> 
> diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
> index 367af82d4a16..3552be6f3902 100644
> --- a/board/isee/igep00x0/igep00x0.c
> +++ b/board/isee/igep00x0/igep00x0.c
> @@ -239,20 +239,3 @@ int misc_init_r(void)
>  
>  	return 0;
>  }
> -
> -void board_mtdparts_default(const char **mtdids, const char **mtdparts)
> -{
> -	struct mtd_info *mtd = get_mtd_device(NULL, 0);
> -	if (mtd) {
> -		static char ids[24];
> -		static char parts[48];
> -		const char *linux_name = "omap2-nand";
> -		if (strncmp(mtd->name, "onenand0", 8) == 0)
> -			linux_name = "omap2-onenand";
> -		snprintf(ids, sizeof(ids), "%s=%s", mtd->name, linux_name);
> -		snprintf(parts, sizeof(parts), "mtdparts=%s:%dk(SPL),-(UBI)",
> -		         linux_name, 4 * mtd->erasesize >> 10);
> -		*mtdids = ids;
> -		*mtdparts = parts;
> -	}
> -}
> diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
> index f7ed1a077974..6b5644523898 100644
> --- a/cmd/mtdparts.c
> +++ b/cmd/mtdparts.c
> @@ -122,9 +122,6 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define MTDPARTS_DEFAULT NULL
>  #endif
>  #endif
> -#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
> -extern void board_mtdparts_default(const char **mtdids, const char **mtdparts);
> -#endif
>  static const char *mtdids_default = MTDIDS_DEFAULT;
>  static const char *mtdparts_default = MTDPARTS_DEFAULT;
>  
> @@ -1733,9 +1730,6 @@ int mtdparts_init(void)
>  		memset(last_ids, 0, sizeof(last_ids));
>  		memset(last_parts, 0, sizeof(last_parts));
>  		memset(last_partition, 0, sizeof(last_partition));
> -#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
> -		board_mtdparts_default(&mtdids_default, &mtdparts_default);
> -#endif
>  		use_defaults = 1;
>  		initialized = 1;
>  	}
> diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
> index d638f700d041..ed619abac390 100644
> --- a/drivers/mtd/mtd_uboot.c
> +++ b/drivers/mtd/mtd_uboot.c
> @@ -13,8 +13,6 @@
>  
>  #define MTD_NAME_MAX_LEN 20
>  
> -void board_mtdparts_default(const char **mtdids, const char **mtdparts);
> -
>  static const char *get_mtdids(void)
>  {
>  	__maybe_unused const char *mtdparts = NULL;
> @@ -23,9 +21,7 @@ static const char *get_mtdids(void)
>  	if (mtdids)
>  		return mtdids;
>  
> -#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
> -	board_mtdparts_default(&mtdids, &mtdparts);
> -#elif defined(MTDIDS_DEFAULT)
> +#if defined(MTDIDS_DEFAULT)
>  	mtdids = MTDIDS_DEFAULT;
>  #elif defined(CONFIG_MTDIDS_DEFAULT)
>  	mtdids = CONFIG_MTDIDS_DEFAULT;
> @@ -133,9 +129,7 @@ static const char *get_mtdparts(void)
>  	if (mtdparts || !use_defaults)
>  		return mtdparts;
>  
> -#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
> -	board_mtdparts_default(&mtdids, &mtdparts);
> -#elif defined(MTDPARTS_DEFAULT)
> +#if defined(MTDPARTS_DEFAULT)
>  	mtdparts = MTDPARTS_DEFAULT;
>  #elif defined(CONFIG_MTDPARTS_DEFAULT)
>  	mtdparts = CONFIG_MTDPARTS_DEFAULT;
> diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h
> index b9d65697521b..280a094cdbae 100644
> --- a/include/configs/omap3_igep00x0.h
> +++ b/include/configs/omap3_igep00x0.h
> @@ -87,8 +87,6 @@
>  
>  #endif
>  
> -#define CONFIG_SYS_MTDPARTS_RUNTIME
> -
>  /* OneNAND config */
>  #define CONFIG_USE_ONENAND_BOARD_INIT
>  #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
> diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
> index b8addeaf693a..72608071c486 100644
> --- a/scripts/config_whitelist.txt
> +++ b/scripts/config_whitelist.txt
> @@ -3511,7 +3511,6 @@ CONFIG_SYS_MRAM_SIZE
>  CONFIG_SYS_MSC0_VAL
>  CONFIG_SYS_MSC1_VAL
>  CONFIG_SYS_MSC2_VAL
> -CONFIG_SYS_MTDPARTS_RUNTIME
>  CONFIG_SYS_MX5_CLK32
>  CONFIG_SYS_MX5_HCLK
>  CONFIG_SYS_MX6_CLK32
> -- 
> 2.17.1
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list