Discussion:
[U-Boot] [PATCH 2/2] mtd: Get rid of board_mtdparts_default()
Boris Brezillon
2018-12-10 15:38:50 UTC
Permalink
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.

Signed-off-by: Boris Brezillon <***@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
Enric Balletbo Serra
2018-12-10 21:50:03 UTC
Permalink
+Ladis who might be also interested.
We are trying to get rid of the weak board_mtdparts_default() function
and we need to make sure igep defconfigs have proper proper
CONFIG_MTD{IDS,PARTS}_DEFAULT before doing that.
---
configs/igep0032_defconfig | 2 ++
configs/igep00x0_defconfig | 2 ++
2 files changed, 4 insertions(+)
diff --git a/configs/igep0032_defconfig b/configs/igep0032_defconfig
index 383648789c53..d2a614c98f6d 100644
--- a/configs/igep0032_defconfig
+++ b/configs/igep0032_defconfig
@@ -28,6 +28,8 @@ CONFIG_CMD_SPI=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand,onenand0=omap2-onenand"
+CONFIG_MTDPARTS_DEFAULT="omap2-nand:512k(SPL),-(UBI);omap2-onenand:512k(SPL),-(UBI)"
CONFIG_CMD_UBI=y
# CONFIG_CMD_UBIFS is not set
CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig
index f2989e34e12e..5d3e109ee3c2 100644
--- a/configs/igep00x0_defconfig
+++ b/configs/igep00x0_defconfig
@@ -28,6 +28,8 @@ CONFIG_CMD_SPI=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand,onenand0=omap2-onenand"
+CONFIG_MTDPARTS_DEFAULT="omap2-nand:512k(SPL),-(UBI);omap2-onenand:512k(SPL),-(UBI)"
CONFIG_CMD_UBI=y
# CONFIG_CMD_UBIFS is not set
CONFIG_NET_RANDOM_ETHADDR=y
--
2.17.1
Enric Balletbo Serra
2018-12-10 21:50:18 UTC
Permalink
+Ladis who might be also interested.
Post by Boris Brezillon
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.
---
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
Loading...