Commit a5debaa3920ca1f50896a2cfc25597f4aaca7bf6

Authored by Ladislav Michl
Committed by Tom Rini
1 parent 4b9dc7c26b

igep00x0: generate default mtdparts according NAND chip used

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>

Showing 2 changed files with 19 additions and 0 deletions Side-by-side Diff

board/isee/igep00x0/igep00x0.c
... ... @@ -17,6 +17,7 @@
17 17 #include <asm/arch/mux.h>
18 18 #include <asm/arch/sys_proto.h>
19 19 #include <asm/mach-types.h>
  20 +#include <linux/mtd/mtd.h>
20 21 #include <linux/mtd/nand.h>
21 22 #include <linux/mtd/nand.h>
22 23 #include <linux/mtd/onenand.h>
... ... @@ -230,6 +231,23 @@
230 231 set_fdt();
231 232  
232 233 return 0;
  234 +}
  235 +
  236 +void board_mtdparts_default(const char **mtdids, const char **mtdparts)
  237 +{
  238 + struct mtd_info *mtd = get_mtd_device(NULL, 0);
  239 + if (mtd) {
  240 + static char ids[24];
  241 + static char parts[48];
  242 + const char *linux_name = "omap2-nand";
  243 + if (strncmp(mtd->name, "onenand0", 8) == 0)
  244 + linux_name = "omap2-onenand";
  245 + snprintf(ids, sizeof(ids), "%s=%s", mtd->name, linux_name);
  246 + snprintf(parts, sizeof(parts), "mtdparts=%s:%dk(SPL),-(UBI)",
  247 + linux_name, 4 * mtd->erasesize >> 10);
  248 + *mtdids = ids;
  249 + *mtdparts = parts;
  250 + }
233 251 }
234 252  
235 253 /*
include/configs/omap3_igep00x0.h
... ... @@ -113,6 +113,7 @@
113 113  
114 114 #define CONFIG_RBTREE
115 115 #define CONFIG_MTD_PARTITIONS
  116 +#define CONFIG_SYS_MTDPARTS_RUNTIME
116 117  
117 118 /* OneNAND config */
118 119 #define CONFIG_SPL_ONENAND_SUPPORT