From: Ladislav Michl Date: Tue, 12 Jul 2016 20:28:33 +0200 Subject: [U-Boot] [PATCH v5 25/26] igep00x0: generate default mtdparts according NAND chip used In-Reply-To: <1468348114-11442-1-git-send-email-ladis@linux-mips.org> References: <1468348114-11442-1-git-send-email-ladis@linux-mips.org> Message-ID: <1468348114-11442-26-git-send-email-ladis@linux-mips.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Signed-off-by: Ladislav Michl --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None board/isee/igep00x0/igep00x0.c | 18 ++++++++++++++++++ include/configs/omap3_igep00x0.h | 1 + 2 files changed, 19 insertions(+) diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index b36709c..4c52b36 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -232,6 +233,23 @@ 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; + } +} + /* * Routine: set_muxconf_regs * Description: Setting up the configuration Mux registers specific to the diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h index 03ffda9..e0d2593 100644 --- a/include/configs/omap3_igep00x0.h +++ b/include/configs/omap3_igep00x0.h @@ -113,6 +113,7 @@ #define CONFIG_RBTREE #define CONFIG_MTD_PARTITIONS +#define CONFIG_SYS_MTDPARTS_RUNTIME /* OneNAND config */ #define CONFIG_SPL_ONENAND_SUPPORT -- 2.1.4