igep00x0: generate default mtdparts according NAND chip used
authorLadislav Michl <ladis@linux-mips.org>
Tue, 12 Jul 2016 18:28:33 +0000 (20:28 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 22 Jul 2016 18:46:19 +0000 (14:46 -0400)
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
board/isee/igep00x0/igep00x0.c
include/configs/omap3_igep00x0.h

index b36709cbb2de671211c81631c6c54577c27910e7..4c52b3601f36a23338e86a9dfec515a91d03a9ef 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/onenand.h>
@@ -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
index 03ffda9e6fd709310470163553e60f5d442247d1..e0d25937f73586eb0b3a77179f593a218890f8aa 100644 (file)
 
 #define CONFIG_RBTREE
 #define CONFIG_MTD_PARTITIONS
+#define CONFIG_SYS_MTDPARTS_RUNTIME
 
 /* OneNAND config */
 #define CONFIG_SPL_ONENAND_SUPPORT