ARM: configs: cm_fx6: improve default environment
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/4 ARM: configs: cm_fx6: improve default environment
From: Christopher Spinrath <[email protected]>
Currently, entire script segments have to be changed in the default environment to change the kernel image location or to append kernel cmdline parameters. In the later case this has to be changed for every possible boot device.
Introduce new variables for kernel image locations and boot device independent kernel parameters to make it easier to change these settings.
---
Notes:
Changes since v1:
- added Reviewed-By tags
include/configs/cm_fx6.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
include/configs/cm_fx6.h +7 -5
@@ -69,6 +69,8 @@"stderr=serial,vga\0" \"panel=HDMI\0" \"autoload=no\0" \ +"uImage=uImage-cm-fx6\0" \ +"zImage=zImage-cm-fx6\0" \"kernel=uImage-cm-fx6\0" \"script=boot.scr\0" \"dtb=cm-fx6.dtb\0" \
@@ -81,10 +83,10 @@"video_dvi=mxcfb0:dev=dvi,1280x800M-32 at 50,if=RGB32\0" \"doboot=bootm ${loadaddr}\0" \"doloadfdt=false\0" \ -"setboottypez=setenv kernel zImage-cm-fx6;" \ +"setboottypez=setenv kernel ${zImage};" \"setenv doboot bootz ${loadaddr} - ${fdtaddr};" \"setenv doloadfdt true;\0" \ -"setboottypem=setenv kernel uImage-cm-fx6;" \ +"setboottypem=setenv kernel ${uImage};" \"setenv doboot bootm ${loadaddr};" \"setenv doloadfdt false;\0" \"mmcroot=/dev/mmcblk0p2 rw rootwait\0" \
@@ -92,13 +94,13 @@"nandroot=/dev/mtdblock4 rw\0" \"nandrootfstype=ubifs\0" \"mmcargs=setenv bootargs console=${console} root=${mmcroot} " \ -"${video}\0" \ +"${video} ${extrabootargs}\0" \"sataargs=setenv bootargs console=${console} root=${sataroot} " \ -"${video}\0" \ +"${video} ${extrabootargs}\0" \"nandargs=setenv bootargs console=${console} " \"root=${nandroot} " \"rootfstype=${nandrootfstype} " \ -"${video}\0" \ +"${video} ${extrabootargs}\0" \"nandboot=if run nandloadkernel; then " \"run nandloadfdt;" \"run setboottypem;" \
Signature · 1 line
2.9.0
PATCH v2 2/4 fdt_support: define stub for fdt_fixup_mtdparts
In reply to a message not in the archiveFrom: Christopher Spinrath <[email protected]>
Define an inline stub for fdt_fixup_mtdparts in the case that CONFIG_FDT_FIXUP_PARTITIONS is not defined. This avoids the need to guard every call to this function by a proper #ifdef in board files.
---
Notes:
Changes since v1:
- this is a new patch in v2 that is required to address the review comments for patch 3 (remove #ifdef guards)
include/fdt_support.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/fdt_support.h +6 -0
@@ -172,7 +172,13 @@ int fdt_increase_size(void *fdt, int add_len);int fdt_fixup_nor_flash_size (void *blob); +#if defined(CONFIG_FDT_FIXUP_PARTITIONS )void fdt_fixup_mtdparts (void *fdt,void *node_info,int node_info_size); +#else +static inline void fdt_fixup_mtdparts (void *fdt,void *node_info, +int node_info_size) {} +#endif +void fdt_del_node_and_alias (void *blob,const char *alias);u64 fdt_translate_address (void *blob,int node_offset,const __be32 *in_addr); int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
Signature · 1 line
2.9.0
PATCH v2 2/4 fdt_support: define stub for fdt_fixup_mtdparts
Quoted 10 lines · On 12 July 2016 at 15:37, <[email protected]> wrote:
From: Christopher Spinrath <[email protected]>
Define an inline stub for
fdt_fixup_mtdpartsin the case thatCONFIG_FDT_FIXUP_PARTITIONSis not defined. This avoids the need to guard every call to this function by a proper #ifdef in board files.Signed-off-by Christopher Spinrath <[email protected]>---
Quoted 7 lines
Notes:
Changes since v1:
- this is a new patch in v2 that is required to address the review comments for patch 3 (remove #ifdef guards)include/fdt_support.h | 6 ++++++ 1 file changed, 6 insertions(+)
PATCH v2 2/4 fdt_support: define stub for fdt_fixup_mtdparts
In reply to christopher.spinrath at rwth-aachen.deQuoted 8 lines · christopher.spinrath at rwth-aachen.de
From: Christopher Spinrath <[email protected]>
Define an inline stub for
fdt_fixup_mtdpartsin the case thatCONFIG_FDT_FIXUP_PARTITIONSis not defined. This avoids the need to guard every call to this function by a proper #ifdef in board files.Signed-off-by Christopher Spinrath <[email protected]>
Thanks!
Signature · 2 lines
Regards, Igor.
PATCH v2 3/4 ARM: board: cm_fx6: fixup mtd partitions in the fdt
In reply to a message not in the archiveFrom: Christopher Spinrath <[email protected]>
The cm-fx6 module has an on-board st,m25p compatible spi flash chip used for U-Boot (binary & environment). Overwrite the partitions in the device tree by the partition table provided in the mtdparts environment variable, if it is set.
This allows to specify a kernel independent partitioning in the environment and provides a convient way for the user to adapt the partition table.
---
Notes:
Changes since v1:
- remove #ifdef CONFIG_FDT_FIXUP_PARTITIONS guards (no longer required thanks to the stub introduced by patch 2 of this series)
- fallback to the documented jedec,spi-nor compatible if the undocumented compatible st,m25p used by the vendor device treeis not in the dt
board/compulab/cm_fx6/cm_fx6.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
board/compulab/cm_fx6/cm_fx6.c +17 -1
@@ -12,6 +12,7 @@#include <dm.h> #include <fsl_esdhc.h> #include <miiphy.h> +#include <mtd_node.h> #include <netdev.h> #include <errno.h> #include <usb.h>
@@ -28,6 +29,7 @@#include <asm/io.h> #include <asm/gpio.h> #include <dm/platform_data/serial_mxc.h> +#include <jffs2/load_kernel.h> #include "common.h" #include "../common/eeprom.h" #include "../common/common.h"
@@ -581,6 +583,17 @@ int cm_fx6_setup_ecspi(void) { return 0; }#ifdef CONFIG_OF_BOARD_SETUP #define USDHC3_PATH "/soc/aips-bus at 02100000/usdhc at 02198000/" + +struct node_info nodes[] = { +/* +* Both entries target the same flash chip. The st,m25p compatible +* is used in the vendor device trees, while upstream uses (the +* documented) jedec,spi-nor comptatible. +*/ + {"st,m25p" ,MTD_DEV_TYPE_NOR , }, + {"jedec,spi-nor" ,MTD_DEV_TYPE_NOR , }, +}; +int ft_board_setup (void *blob,bd_t *bd) {u32 baseboard_rev;
@@ -589,6 +602,8 @@ int ft_board_setup(void *blob, bd_t *bd)char baseboard_name[16 ];int err; +fdt_shrink_to_minimum (blob);/* Make room for new properties */ +/* MAC addr */ if (eth_getenv_enetaddr ("ethaddr" , enetaddr)) { fdt_find_and_setprop(blob,
@@ -607,7 +622,6 @@ int ft_board_setup(void *blob, bd_t *bd)return 0 ;/* Assume not an early revision SB-FX6m baseboard */ if (!strncmp ("SB-FX6m" , baseboard_name,7 ) && baseboard_rev <=120 ) { -fdt_shrink_to_minimum (blob);/* Make room for new properties */ nodeoffset =fdt_path_offset (blob,USDHC3_PATH );fdt_delprop (blob, nodeoffset,"cd-gpios" ); fdt_find_and_setprop(blob, USDHC3_PATH, "broken-cd",
@@ -616,6 +630,8 @@ int ft_board_setup(void *blob, bd_t *bd) NULL, 0, 1); } +fdt_fixup_mtdparts (blob, nodes,ARRAY_SIZE (nodes)); +return 0 ; }#endif
Signature · 1 line
2.9.0
PATCH v2 3/4 ARM: board: cm_fx6: fixup mtd partitions in the fdt
Quoted 7 lines · christopher.spinrath at rwth-aachen.de
From: Christopher Spinrath <[email protected]>
The cm-fx6 module has an on-board st,m25p compatible spi flash chip used for U-Boot (binary & environment). Overwrite the partitions in the device tree by the partition table provided in the mtdparts environment variable, if it is set.
Quoted 5 lines
This allows to specify a kernel independent partitioning in the environment and provides a convient way for the user to adapt the partition table.
Signed-off-by Christopher Spinrath <[email protected]>
Signature · 2 lines
Regards, Igor.
PATCH v2 4/4 ARM: configs: cm_fx6: add mtd support
In reply to a message not in the archiveFrom: Christopher Spinrath <[email protected]>
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).
---
Notes:
Changes since v1:
- explain the "sf probe" command added to preboot in the commit message
include/configs/cm_fx6.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
include/configs/cm_fx6.h +18 -1
@@ -18,6 +18,7 @@#define CONFIG_MACH_TYPE 4273/* CMD */ +#define CONFIG_CMD_MTDPARTS /* MMC */ #define CONFIG_SYS_FSL_USDHC_NUM 3
@@ -53,6 +54,20 @@#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 at 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" \
@@ -157,7 +174,7 @@"run setupnandboot;" \ "run nandboot;" -#define CONFIG_PREBOOT "usb start" +#define CONFIG_PREBOOT "usb start;sf probe"/* SPI */ #define CONFIG_SPI
Signature · 1 line
2.9.0
PATCH v2 4/4 ARM: configs: cm_fx6: add mtd support
Quoted 69 lines · christopher.spinrath at rwth-aachen.de
From: Christopher Spinrath <[email protected]>
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 <[email protected]>---
Notes:
Changes since v1:
- explain the "sf probe" command added to preboot in the commit messageinclude/configs/cm_fx6.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)include/configs/cm_fx6.h +17
-0@@ -18,6 +18,7 @@#define CONFIG_MACH_TYPE 4273/* CMD */ +#define CONFIG_CMD_MTDPARTS /* MMC */ #define CONFIG_SYS_FSL_USDHC_NUM 3@@ -53,6 +54,20 @@#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 at 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" \
include/configs/cm_fx6.h line 180
Quoted 8 lines
include/configs/cm_fx6.h +1
-1@@ -157,7 +174,7 @@"run setupnandboot;" \ "run nandboot;" -#define CONFIG_PREBOOT "usb start" +#define CONFIG_PREBOOT "usb start;sf probe"/* SPI */ #define CONFIG_SPI
I put these on my queue list to be apply - I wait just for Nikita's ACK as board's maintainer.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 4/4 ARM: configs: cm_fx6: add mtd support
In reply to christopher.spinrath at rwth-aachen.deQuoted 9 lines · christopher.spinrath at rwth-aachen.de
From: Christopher Spinrath <[email protected]>
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.
Quoted 7 lines
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 <[email protected]>
Signature · 2 lines
Regards, Igor.