]> git.sur5r.net Git - u-boot/commitdiff
ARM: configs: cm_fx6: add mtd support
authorChristopher Spinrath <christopher.spinrath@rwth-aachen.de>
Tue, 12 Jul 2016 21:37:37 +0000 (23:37 +0200)
committerStefano Babic <sbabic@denx.de>
Tue, 19 Jul 2016 17:52:13 +0000 (19:52 +0200)
The cm-fx6 module has an on-board spi flash chip. Enable mtd support
and the mtdparts command. Also define a default partitioning, add
it to the default environment, and enable support to overwrite the
partitioning defined in a device tree by it. Finally, probe for the
chip on preboot to register the flash chip and, thus, establish the
connection between the mtd environment settings and the actual device.

These changes move the effective default partitioning from the device
tree shipped with the vendor kernels to U-Boot which becomes the single
point of definition for the partitioning for all device tree based
kernels (in particular, for the upstream Linux kernel which does not
have a default partitioning defined in its device tree).

Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
include/configs/cm_fx6.h

index f054ca8840aea84482eca5855d70959f0a86bcba..c839b03591554186646c5a3df22536dfa3d70a2c 100644 (file)
@@ -18,6 +18,7 @@
 #define CONFIG_MACH_TYPE               4273
 
 /* CMD */
+#define CONFIG_CMD_MTDPARTS
 
 /* MMC */
 #define CONFIG_SYS_FSL_USDHC_NUM       3
 #define CONFIG_SF_DEFAULT_SPEED                25000000
 #define CONFIG_SF_DEFAULT_MODE         (SPI_MODE_0)
 
+/* MTD support */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_FDT_FIXUP_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_SPI_FLASH_MTD
+#endif
+
+#define MTDIDS_DEFAULT         "nor0=spi0.0"
+#define MTDPARTS_DEFAULT       "mtdparts=spi0.0:" \
+                               "768k(uboot)," \
+                               "256k(uboot-environment)," \
+                               "-(reserved)"
+
 /* Environment */
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_SPI_MAX_HZ          CONFIG_SF_DEFAULT_SPEED
@@ -83,6 +98,8 @@
        "video_dvi=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32\0" \
        "doboot=bootm ${loadaddr}\0" \
        "doloadfdt=false\0" \
+       "mtdids=" MTDIDS_DEFAULT "\0" \
+       "mtdparts=" MTDPARTS_DEFAULT "\0" \
        "setboottypez=setenv kernel ${zImage};" \
                "setenv doboot bootz ${loadaddr} - ${fdtaddr};" \
                "setenv doloadfdt true;\0" \
        "run setupnandboot;" \
        "run nandboot;"
 
-#define CONFIG_PREBOOT         "usb start"
+#define CONFIG_PREBOOT         "usb start;sf probe"
 
 /* SPI */
 #define CONFIG_SPI