Commit 63a930937755e97928a75fa3afe2c09f1800188e

Authored by Christopher Spinrath
Committed by Stefano Babic
1 parent 62d6bac660

ARM: configs: cm_fx6: add mtd support

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>

Showing 1 changed file with 18 additions and 1 deletions Side-by-side Diff

include/configs/cm_fx6.h
... ... @@ -18,6 +18,7 @@
18 18 #define CONFIG_MACH_TYPE 4273
19 19  
20 20 /* CMD */
  21 +#define CONFIG_CMD_MTDPARTS
21 22  
22 23 /* MMC */
23 24 #define CONFIG_SYS_FSL_USDHC_NUM 3
... ... @@ -53,6 +54,20 @@
53 54 #define CONFIG_SF_DEFAULT_SPEED 25000000
54 55 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
55 56  
  57 +/* MTD support */
  58 +#ifndef CONFIG_SPL_BUILD
  59 +#define CONFIG_FDT_FIXUP_PARTITIONS
  60 +#define CONFIG_MTD_DEVICE
  61 +#define CONFIG_MTD_PARTITIONS
  62 +#define CONFIG_SPI_FLASH_MTD
  63 +#endif
  64 +
  65 +#define MTDIDS_DEFAULT "nor0=spi0.0"
  66 +#define MTDPARTS_DEFAULT "mtdparts=spi0.0:" \
  67 + "768k(uboot)," \
  68 + "256k(uboot-environment)," \
  69 + "-(reserved)"
  70 +
56 71 /* Environment */
57 72 #define CONFIG_ENV_IS_IN_SPI_FLASH
58 73 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
... ... @@ -83,6 +98,8 @@
83 98 "video_dvi=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32\0" \
84 99 "doboot=bootm ${loadaddr}\0" \
85 100 "doloadfdt=false\0" \
  101 + "mtdids=" MTDIDS_DEFAULT "\0" \
  102 + "mtdparts=" MTDPARTS_DEFAULT "\0" \
86 103 "setboottypez=setenv kernel ${zImage};" \
87 104 "setenv doboot bootz ${loadaddr} - ${fdtaddr};" \
88 105 "setenv doloadfdt true;\0" \
... ... @@ -157,7 +174,7 @@
157 174 "run setupnandboot;" \
158 175 "run nandboot;"
159 176  
160   -#define CONFIG_PREBOOT "usb start"
  177 +#define CONFIG_PREBOOT "usb start;sf probe"
161 178  
162 179 /* SPI */
163 180 #define CONFIG_SPI