]> git.sur5r.net Git - u-boot/commitdiff
powerpc/BSC9132QDS: Enable creation of dynamic partition for NAND and NOR
authorAshish Kumar <Ashish.Kumar@freescale.com>
Mon, 6 Oct 2014 12:54:56 +0000 (18:24 +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, NOR 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/bsc9132qds/bsc9132qds.c
include/configs/BSC9132QDS.h

index 10580bcecc51cde79d182a962c85645a96ba86ce..c88838b3dfac59a7d83e002c222e14128e167b82 100644 (file)
@@ -21,6 +21,9 @@
 #include <hwconfig.h>
 #include <i2c.h>
 #include <fsl_ddr_sdram.h>
+#include <jffs2/load_kernel.h>
+#include <mtd_node.h>
+#include <flash.h>
 
 #ifdef CONFIG_PCI
 #include <pci.h>
@@ -354,6 +357,12 @@ void fdt_del_node_compat(void *blob, const char *compatible)
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+struct node_info nodes[] = {
+       { "cfi-flash",                  MTD_DEV_TYPE_NOR,  },
+       { "fsl,ifc-nand",               MTD_DEV_TYPE_NAND, },
+};
+#endif
 void ft_board_setup(void *blob, bd_t *bd)
 {
        phys_addr_t base;
@@ -369,6 +378,9 @@ void ft_board_setup(void *blob, bd_t *bd)
        #endif
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+       fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+#endif
 
        ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
        u32 porbmsr = in_be32(&gur->porbmsr);
index 989363c0fbc0def810b96a73ae07889382205656..2722a329ddccc7dc5bfce4d580f335338b606214 100644 (file)
@@ -636,6 +636,27 @@ combinations. this should be removed later
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
 #endif
 
+/*
+ * Dynamic MTD Partition support with mtdparts
+ */
+#ifndef CONFIG_SYS_NO_FLASH
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_FLASH_CFI_MTD
+#define MTDIDS_DEFAULT "nor0=88000000.nor,nand0=ff800000.flash,"
+#define MTDPARTS_DEFAULT "mtdparts=88000000.nor:256k(dtb),7m(kernel)," \
+                       "55m(fs),1m(uboot);ff800000.flash:1m(uboot)," \
+                       "8m(kernel),512k(dtb),-(fs)"
+#endif
+/*
+ * Override partitions in device tree using info
+ * in "mtdparts" environment variable
+ */
+#ifdef CONFIG_CMD_MTDPARTS
+#define CONFIG_FDT_FIXUP_PARTITIONS
+#endif
+
 /*
  * Environment Configuration
  */