]> git.sur5r.net Git - u-boot/commitdiff
powerpc/BSC9131RDB: Enable creation of dynamic partitions for NAND
authorAshish Kumar <Ashish.Kumar@freescale.com>
Tue, 7 Oct 2014 12:32:23 +0000 (18:02 +0530)
committerYork Sun <yorksun@freescale.com>
Fri, 14 Nov 2014 19:12:14 +0000 (11:12 -0800)
* fdt_fixup_mtdparts is called from ft_board_setup
 * Run "mtdparts default" to create NAND partition on uboot
 * Use mtdparts to create partitions dynamically rather
    than using static partitions in device tree

Signed-off-by: Ashish Kumar <Ashish.Kumar@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
board/freescale/bsc9131rdb/bsc9131rdb.c
include/configs/BSC9131RDB.h

index 7fe4ae74ea03b736a69500bc2da30a15e01f33f5..9146f492626e5a3e378e83d11cb7d5bececca404 100644 (file)
@@ -15,6 +15,9 @@
 #include <fdt_support.h>
 #include <fsl_mdio.h>
 #include <tsec.h>
+#include <jffs2/load_kernel.h>
+#include <mtd_node.h>
+#include <flash.h>
 #include <netdev.h>
 
 
@@ -50,6 +53,11 @@ int checkboard(void)
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+struct node_info nodes[] = {
+       { "fsl,ifc-nand",               MTD_DEV_TYPE_NAND, },
+};
+#endif
 void ft_board_setup(void *blob, bd_t *bd)
 {
        phys_addr_t base;
@@ -61,6 +69,9 @@ void ft_board_setup(void *blob, bd_t *bd)
        size = getenv_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+       fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+#endif
 
        fdt_fixup_dr_usb(blob, bd);
 }
index bc5af526c5f7eb55df3d424268980c372fe13d48..adb81461dd62b5267120756ca79186d628812774 100644 (file)
@@ -399,6 +399,23 @@ extern unsigned long get_sdram_size(void);
 #define CONFIG_HAS_FSL_DR_USB
 #endif
 
+/*
+ * Dynamic MTD Partition support with mtdparts
+ */
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_CMD_MTDPARTS
+#define MTDIDS_DEFAULT "nand0=ff800000.flash,"
+#define MTDPARTS_DEFAULT "mtdparts=ff800000.flash:1m(uboot)," \
+                       "8m(kernel),512k(dtb),-(fs)"
+/*
+ * Override partitions in device tree using info
+ * in "mtdparts" environment variable
+ */
+#ifdef CONFIG_CMD_MTDPARTS
+#define CONFIG_FDT_FIXUP_PARTITIONS
+#endif
+
 /*
  * Environment Configuration
  */