From patchwork Wed Mar 25 06:45:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moses Christopher X-Patchwork-Id: 244232 List-Id: U-Boot discussion From: BollavarapuMoses.Christopher at in.bosch.com (Moses Christopher) Date: Wed, 25 Mar 2020 06:45:47 +0000 Subject: [PATCH 4/5] am335x, guardian: load env from NAND In-Reply-To: <20200325064548.31924-1-BollavarapuMoses.Christopher@in.bosch.com> References: <20200325064548.31924-1-BollavarapuMoses.Christopher@in.bosch.com> Message-ID: <20200325064548.31924-5-BollavarapuMoses.Christopher@in.bosch.com> - As there is a requirement to store certain data, we need a persistent storage in u-boot. Hence, we need to save env in NAND - Add default Guardian environment variables - Update partition table: - Reserve some space for experimentation, this ensures proper backwards compatibility - Update defconfig accordingly Signed-off-by: Moses Christopher --- arch/arm/dts/am335x-guardian.dts | 27 ++++++++++++++++++++++++++- configs/am335x_guardian_defconfig | 9 +++++++-- include/configs/am335x_guardian.h | 13 +++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts index b554be97a3..7e70a96d25 100644 --- a/arch/arm/dts/am335x-guardian.dts +++ b/arch/arm/dts/am335x-guardian.dts @@ -202,8 +202,33 @@ }; partition at 6 { + label = "u-boot-2"; + reg = <0x300000 0x100000>; + }; + + partition at 7 { + label = "u-boot-2.backup1"; + reg = <0x400000 0x100000>; + }; + + partition at 8 { + label = "u-boot-env"; + reg = <0x500000 0x40000>; + }; + + partition at 9 { + label = "u-boot-env.backup1"; + reg = <0x540000 0x40000>; + }; + + partition at 10 { + label = "splash-screen"; + reg = <0x580000 0x40000>; + }; + + partition at 11 { label = "UBI"; - reg = <0x300000 0x1fd00000>; + reg = <0x5c0000 0x1fa40000>; }; }; }; diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 6bd5f0a9e5..b0033810b9 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -5,6 +5,7 @@ CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_ENV_SIZE=0x40000 +CONFIG_ENV_OFFSET=0x500000 CONFIG_AM33XX=y CONFIG_TARGET_AM335X_GUARDIAN=y CONFIG_SPL_SERIAL_SUPPORT=y @@ -22,6 +23,11 @@ CONFIG_ARCH_MISC_INIT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_SEPARATE_BSS=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set +CONFIG_ENV_IS_IN_NAND=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y +CONFIG_ENV_OFFSET_REDUND=0x540000 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_ENV_IS_NOWHERE=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_ETH_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y @@ -49,7 +55,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y -CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:256k(SPL),256k(SPL.backup1),256k(SPL.backup2),256k(SPL.backup3),1m(u-boot),1m(u-boot.backup1),-(UBI)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:256k(SPL),256k(SPL.backup1),256k(SPL.backup2),256k(SPL.backup3),1m(u-boot),1m(u-boot.backup1),1m(u-boot-2),1m(u-boot-2.backup1),256k(u-boot-env),256k(u-boot-env.backup1),256k(splash-screen),-(UBI)" CONFIG_CMD_UBI=y # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set @@ -57,7 +63,6 @@ CONFIG_CMD_UBI=y CONFIG_OF_CONTROL=y # CONFIG_SPL_OF_CONTROL is not set CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian" -CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_AM33XX=y diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 3c6147a266..1ac5e2e240 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -42,10 +42,23 @@ #include +#define GUARDIAN_DEFAULT_PROD_ENV \ + "factory_assembly_status=0\0" \ + "main_pcba_part_number=0\0" \ + "main_pcba_supplier=0\0" \ + "main_pcba_timestamp=0\0" \ + "main_pcba_hardware_version=0\0" \ + "main_pcba_id=0\0" \ + "main_pcba_aux_1=0\0" \ + "main_pcba_aux_2=0\0" \ + "main_pcba_aux_3=0\0" \ + "main_pcba_aux_4=0\0" \ + #define CONFIG_EXTRA_ENV_SETTINGS \ AM335XX_BOARD_FDTFILE \ MEM_LAYOUT_ENV_SETTINGS \ BOOTENV \ + GUARDIAN_DEFAULT_PROD_ENV \ "bootubivol=rootfs\0" \ "altbootcmd=" \ "setenv boot_config \"extlinux-rollback.conf\"; " \