]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
am335x, guardian: load env from NAND
authorMoses Christopher <BollavarapuMoses.Christopher@in.bosch.com>
Wed, 25 Mar 2020 06:45:47 +0000 (06:45 +0000)
committerLokesh Vutla <lokeshvutla@ti.com>
Tue, 14 Apr 2020 10:14:48 +0000 (15:44 +0530)
- 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 <BollavarapuMoses.Christopher@in.bosch.com>
arch/arm/dts/am335x-guardian.dts
configs/am335x_guardian_defconfig
include/configs/am335x_guardian.h

index b554be97a3a3dac7047777b2d4c684f085236f3e..7e70a96d2534b57bdd41ece4c2462fbe374e6d63 100644 (file)
                };
 
                partition@6 {
+                       label = "u-boot-2";
+                       reg = <0x300000 0x100000>;
+               };
+
+               partition@7 {
+                       label = "u-boot-2.backup1";
+                       reg = <0x400000 0x100000>;
+               };
+
+               partition@8 {
+                       label = "u-boot-env";
+                       reg = <0x500000 0x40000>;
+               };
+
+               partition@9 {
+                       label = "u-boot-env.backup1";
+                       reg = <0x540000 0x40000>;
+               };
+
+               partition@10 {
+                       label = "splash-screen";
+                       reg = <0x580000 0x40000>;
+               };
+
+               partition@11 {
                        label = "UBI";
-                       reg = <0x300000 0x1fd00000>;
+                       reg = <0x5c0000 0x1fa40000>;
                };
        };
 };
index 6bd5f0a9e5fb96933317bedd3e3586dc848fa33d..b0033810b98d89436cc69df861ca1f32f2c8c640 100644 (file)
@@ -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
index 3c6147a266104c9c6d728d2101ebf0d8cb8a2178..1ac5e2e240e3cabb4cd67c89a81e4ad0c276ed7e 100644 (file)
 
 #include <config_distro_bootcmd.h>
 
+#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\"; " \