[U-Boot] [PATCH v1 00/21] This patch series brings in sync DISPLAY5 internal

This patch series brings the internal DISPLAY5 development in sync with mainline.
Lukasz Majewski (21): display5: factory: Add support for BOOT_FROM = FACTORY switch display5: config: factory: Setup IP config data according to LEG production setup display5: config: Add "factory" (1MiB) SPI-NOR partition in u-boot display5: config: Provide command to flash the whole SPI-NOR memory display5: spl: Check return code of the env_* functions display5: config: Reset the board when bootm fails display5: config: Remove support for Linux initramfs recovery image boot display5: config: Update SPI-NOR partition for larger swupdate-initramfs display5: config: factory: Extend mtdparts to support LEG factory partition display5: Support for the emergency PAD pressing display5: wdt: Enable WDT support (both SPL and u-boot) display5: config: Provide 'tftp_mmc_rootfs_bkp' command to write BACKUP rootfs display5: config: factory: Update BACKUP rootfs in factory mode display5: config: Update swupdate initramfs file name (now supporting ext4) display5: ddr: Enable support for DDR3 auto calibration display5: net: Add function to read ethaddr from iMX6 fuses display5: config: Add cma=256M to command line arguments display5: config: Reduce rootfs2 (BACKUP) size from 1528M to 512M display5: display5_defconfig: Enable support for gpt command (CMD_GPT) in production u-boot display5: config: Add GPT verification and restoration code on SWUpdate entry display5: Add missing environment.h include to avoid warning
board/liebherr/display5/common.c | 10 ++++ board/liebherr/display5/common.h | 1 + board/liebherr/display5/display5.c | 41 +++++++++++++++ board/liebherr/display5/spl.c | 78 +++++++++++++++++++++++++++- configs/display5_defconfig | 6 ++- configs/display5_factory_defconfig | 3 +- include/configs/display5.h | 102 ++++++++++++++++++++++--------------- 7 files changed, 194 insertions(+), 47 deletions(-)

When BOOT_FROM = FACTORY, then the LEG's factory setup is performed.
This code relies on boot_nfs u-boot command, so it shall be adjusted appropriately (e.g. provide proper fitImage file).
Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 9cd2fdf683..67a1318e4f 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -100,7 +100,11 @@ #define CONFIG_BAUDRATE 115200
#ifndef CONFIG_BOOTCOMMAND -#define CONFIG_BOOTCOMMAND "run boot_mmc" +#define CONFIG_BOOTCOMMAND "if test ${BOOT_FROM} = FACTORY; then " \ + "run factory_nfs;" \ + "else " \ + "run boot_mmc;" \ + "fi" #endif
#define PARTS_DEFAULT \ @@ -279,6 +283,9 @@ "up=run tftp_sf_SPL; run tftp_sf_uboot\0" \ "download_kernel=" \ "tftpboot ${loadaddr} ${kernel_file};\0" \ + "factory_nfs=" \ + "echo BOOT: FACTORY (LEG);" \ + "run boot_nfs\0" \ "boot_kernel_recovery=" KERNEL_RECOVERY_PROCEDURE "\0" \ "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \ "recovery=" \

Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 67a1318e4f..6d384d4de5 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -284,6 +284,10 @@ "download_kernel=" \ "tftpboot ${loadaddr} ${kernel_file};\0" \ "factory_nfs=" \ + "setenv ipaddr 192.168.1.102;" \ + "setenv gatewayip 192.168.1.1;" \ + "setenv netmask 255.255.255.0;" \ + "setenv serverip 192.168.1.2;" \ "echo BOOT: FACTORY (LEG);" \ "run boot_nfs\0" \ "boot_kernel_recovery=" KERNEL_RECOVERY_PROCEDURE "\0" \

To test if this partition is present - one needs to write: display5 > sf probe; mtdparts display5 > sf erase factory +0x100000
Signed-off-by: Lukasz Majewski lukma@denx.de ---
configs/display5_defconfig | 2 +- include/configs/display5.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configs/display5_defconfig b/configs/display5_defconfig index db8212ca7c..03e9116676 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -48,7 +48,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" -CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),8m(lin-recovery),4m(swu-kernel),8m(swu-initramfs),-(reserved)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),8m(lin-recovery),4m(swu-kernel),8m(swu-initramfs),1m(factory),-(reserved)" CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y diff --git a/include/configs/display5.h b/include/configs/display5.h index 6d384d4de5..3bad7b52ea 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -33,6 +33,7 @@ * 0x140000 - 0x940000 : SPI.fitImage-recovery (8MiB) * 0x940000 - 0xD40000 : SPI.swupdate-kernel-FIT (4MiB) * 0xD40000 - 0x1540000 : SPI.swupdate-initramfs (8MiB) + * 0x1540000 - 0x1640000 : SPI.factory (1MiB) */
#ifndef CONFIG_SPL_BUILD

It may be necessary to update the content of the whole SPI-NOR memory at once with using a single command (tftp_sf_img).
Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 3bad7b52ea..7689d54df9 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -253,6 +253,16 @@ "sf write ${loadaddr} 0x400 ${filesize};" \ "fi\0" \
+#define TFTP_UPDATE_SPINOR \ + "spinorfile=core-image-lwn-display5.spinor\0" \ + "spinorsize=0x2000000\0" \ + "tftp_sf_img=" \ + "if tftp ${loadaddr} ${spinorfile}; then " \ + "sf probe;" \ + "sf erase 0x0 ${spinorsize};" \ + "sf write ${loadaddr} 0x0 ${filesize};" \ + "fi\0" \ + #define CONFIG_EXTRA_ENV_SETTINGS \ PARTS_DEFAULT \ "display=tianma-tm070-800x480\0" \ @@ -359,6 +369,7 @@ "BOOT_FROM=ACTIVE\0" \ "BOOT_FROM_RECOVERY=Linux\0" \ TFTP_UPDATE_BOOTLOADER \ + TFTP_UPDATE_SPINOR \ "kernel_part_active=1\0" \ "kernel_part_backup=3\0" \ __TFTP_UPDATE_KERNEL \

Force booting through u-boot proper when environment error encountered (as a result of either broken SPI-NOR or erased envs).
Signed-off-by: Lukasz Majewski lukma@denx.de ---
board/liebherr/display5/spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 6508e0ffa7..0d25b0d996 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -210,8 +210,8 @@ void board_boot_order(u32 *spl_boot_list) /* 'fastboot' */ const char *s;
- env_init(); - env_load(); + if (env_init() || env_load()) + return;
s = env_get("BOOT_FROM"); if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) {

Since display5 is now supporting boot counting, we can just reset the board when bootm fails (i.e. it doesn't boot the fitImage kernel for any reason).
Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 7689d54df9..9a11896c68 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -151,7 +151,7 @@ "sf probe;" \ "sf read ${loadaddr} swu-kernel;" \ "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \ - "bootm ${loadaddr} ${loadaddr_swu_initramfs};" + "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
#define KERNEL_RECOVERY_PROCEDURE \ "echo '#######################';" \ @@ -159,7 +159,7 @@ "echo '#######################';" \ "sf probe;" \ "sf read ${loadaddr} lin-recovery;" \ - "bootm;" + "bootm;reset;"
#define SETUP_BOOTARGS \ "run set_rootfs_part;" \ @@ -315,7 +315,7 @@ "if run download_kernel; then " \ "setenv bootargs console=${console} " \ "root=/dev/mmcblk0p2 rootwait;" \ - "bootm ${loadaddr} - ${fdtaddr};" \ + "bootm ${loadaddr} - ${fdtaddr};reset;" \ "fi\0" \ "addip=setenv bootargs ${bootargs} " \ "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \ @@ -332,7 +332,7 @@ "run addip;" \ "setenv bootargs ${bootargs} console=${console};" \ "setenv fdt_conf imx6q-${board}-${display}.dtb; " \ - "bootm ${loadaddr}#conf@${fdt_conf};" \ + "bootm ${loadaddr}#conf@${fdt_conf};reset;" \ "fi\0" \ "falcon_setup=" \ "if mmc dev ${mmcdev}; then " \ @@ -346,7 +346,7 @@ "boot_mmc=" \ "if mmc dev ${mmcdev}; then " \ SETUP_BOOTARGS \ - "bootm ${loadaddr}#conf@${fdt_conf};" \ + "bootm ${loadaddr}#conf@${fdt_conf};reset;" \ "fi\0" \ "set_kernel_part=" \ "if test ${BOOT_FROM} = ACTIVE; then " \

This is a prerequisite patch to combine SWUpdate and Linux recovery initramfs images.
It removes the support for it.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
configs/display5_defconfig | 2 +- configs/display5_factory_defconfig | 2 +- include/configs/display5.h | 29 +---------------------------- 3 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 03e9116676..2da49767c5 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -48,7 +48,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" -CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),8m(lin-recovery),4m(swu-kernel),8m(swu-initramfs),1m(factory),-(reserved)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),8m(swu-initramfs),1m(factory),-(reserved)" CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig index aa3bd4c8cf..805a73b9f7 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -53,7 +53,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" -CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),8m(lin-recovery),4m(swu-kernel),8m(swu-initramfs),-(reserved)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),8m(swu-initramfs),-(reserved)" # CONFIG_SPL_EFI_PARTITION is not set CONFIG_PARTITION_TYPE_GUID=y CONFIG_ENV_IS_IN_SPI_FLASH=y diff --git a/include/configs/display5.h b/include/configs/display5.h index 9a11896c68..1b9ed6905a 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -30,7 +30,6 @@ * 0x020000 - 0x120000 : SPI.u-boot (1MiB) * 0x120000 - 0x130000 : SPI.u-boot-env1 (64KiB) * 0x130000 - 0x140000 : SPI.u-boot-env2 (64KiB) - * 0x140000 - 0x940000 : SPI.fitImage-recovery (8MiB) * 0x940000 - 0xD40000 : SPI.swupdate-kernel-FIT (4MiB) * 0xD40000 - 0x1540000 : SPI.swupdate-initramfs (8MiB) * 0x1540000 - 0x1640000 : SPI.factory (1MiB) @@ -128,7 +127,6 @@ "run tftp_sf_SPL;" \ "run tftp_sf_uboot;" \ TFTP_UPDATE_KERNEL \ - "run tftp_sf_fitImg_recovery;" \ "run tftp_sf_fitImg_SWU;" \ "run tftp_sf_initramfs_SWU;" \ TFTP_UPDATE_ROOTFS \ @@ -153,14 +151,6 @@ "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \ "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
-#define KERNEL_RECOVERY_PROCEDURE \ - "echo '#######################';" \ - "echo '# RECOVERY KERNEL IMG #';" \ - "echo '#######################';" \ - "sf probe;" \ - "sf read ${loadaddr} lin-recovery;" \ - "bootm;reset;" - #define SETUP_BOOTARGS \ "run set_rootfs_part;" \ "setenv bootargs ${bootargs} console=${console} " \ @@ -227,15 +217,6 @@ "sf write ${loadaddr} swu-initramfs ${filesize};" \ "; fi\0" \
-#define TFTP_UPDATE_RECOVERY_KERNEL_INITRAMFS \ - "kernel_recovery_file=fitImage-initramfs\0" \ - "tftp_sf_fitImg_recovery=" \ - "if tftp ${loadaddr} ${kernel_recovery_file}; then " \ - "sf probe;" \ - "sf erase lin-recovery +${filesize};" \ - "sf write ${loadaddr} lin-recovery ${filesize};" \ - "; fi\0" \ - #define TFTP_UPDATE_BOOTLOADER \ "ubootfile=u-boot.img\0" \ "ubootfileSPL=SPL\0" \ @@ -301,16 +282,10 @@ "setenv serverip 192.168.1.2;" \ "echo BOOT: FACTORY (LEG);" \ "run boot_nfs\0" \ - "boot_kernel_recovery=" KERNEL_RECOVERY_PROCEDURE "\0" \ "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \ "recovery=" \ - "if test ${BOOT_FROM_RECOVERY} = SWU; then " \ "echo BOOT: RECOVERY: SWU;" \ - "run boot_swu_recovery;" \ - "else " \ - "echo BOOT: RECOVERY: Linux;" \ - "run boot_kernel_recovery;" \ - "fi\0" \ + "run boot_swu_recovery\0" \ "boot_tftp=" \ "if run download_kernel; then " \ "setenv bootargs console=${console} " \ @@ -367,7 +342,6 @@ "run recovery;" \ "fi;fi\0" \ "BOOT_FROM=ACTIVE\0" \ - "BOOT_FROM_RECOVERY=Linux\0" \ TFTP_UPDATE_BOOTLOADER \ TFTP_UPDATE_SPINOR \ "kernel_part_active=1\0" \ @@ -377,7 +351,6 @@ "rootfs_part_backup=4\0" \ "rootfs_file=core-image-lwn-display5.ext4\0" \ __TFTP_UPDATE_ROOTFS \ - TFTP_UPDATE_RECOVERY_KERNEL_INITRAMFS \ TFTP_UPDATE_RECOVERY_SWU_KERNEL \ TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \ "\0" \

The SPI-NOR partition information has been updated to store swupdate-kernel-FIT just after envs as well as two times larger swupdate-initramfs image.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
configs/display5_defconfig | 2 +- configs/display5_factory_defconfig | 2 +- include/configs/display5.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 2da49767c5..81f329f259 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -48,7 +48,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" -CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),8m(swu-initramfs),1m(factory),-(reserved)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),16m(swu-initramfs),1m(factory),-(reserved)" CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig index 805a73b9f7..05424bda7f 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -53,7 +53,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" -CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),8m(swu-initramfs),-(reserved)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),16m(swu-initramfs),-(reserved)" # CONFIG_SPL_EFI_PARTITION is not set CONFIG_PARTITION_TYPE_GUID=y CONFIG_ENV_IS_IN_SPI_FLASH=y diff --git a/include/configs/display5.h b/include/configs/display5.h index 1b9ed6905a..49a1ead649 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -30,8 +30,8 @@ * 0x020000 - 0x120000 : SPI.u-boot (1MiB) * 0x120000 - 0x130000 : SPI.u-boot-env1 (64KiB) * 0x130000 - 0x140000 : SPI.u-boot-env2 (64KiB) - * 0x940000 - 0xD40000 : SPI.swupdate-kernel-FIT (4MiB) - * 0xD40000 - 0x1540000 : SPI.swupdate-initramfs (8MiB) + * 0x140000 - 0x540000 : SPI.swupdate-kernel-FIT (4MiB) + * 0x540000 - 0x1540000 : SPI.swupdate-initramfs (16MiB) * 0x1540000 - 0x1640000 : SPI.factory (1MiB) */

This special partition has been added solely for production purpose.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
configs/display5_factory_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig index 05424bda7f..d86e5f51e9 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -53,7 +53,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" -CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),16m(swu-initramfs),-(reserved)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),16m(swu-initramfs),1m(factory),-(reserved)" # CONFIG_SPL_EFI_PARTITION is not set CONFIG_PARTITION_TYPE_GUID=y CONFIG_ENV_IS_IN_SPI_FLASH=y

To enter the special mode, one needs to short cut two pads with e.g. screw driver.
After power up the SPL will execute u-boot in which proper actions will be taken.
It is worth noting that we do not alter envs (even the BOOT_FROM variable) and unconditionally go to recovery.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
board/liebherr/display5/common.c | 10 ++++++++++ board/liebherr/display5/common.h | 1 + board/liebherr/display5/display5.c | 19 +++++++++++++++++++ board/liebherr/display5/spl.c | 22 ++++++++++++++++++++++ include/configs/display5.h | 8 ++++++-- 5 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/board/liebherr/display5/common.c b/board/liebherr/display5/common.c index 26575f73bd..4eb86d8c5d 100644 --- a/board/liebherr/display5/common.c +++ b/board/liebherr/display5/common.c @@ -34,6 +34,16 @@ void displ5_set_iomux_uart(void) SETUP_IOMUX_PADS(uart_pads); }
+iomux_v3_cfg_t const misc_pads_spl[] = { + /* Emergency recovery pin */ + MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL), +}; + +void displ5_set_iomux_misc_spl(void) +{ + SETUP_IOMUX_PADS(misc_pads_spl); +} + #ifdef CONFIG_MXC_SPI iomux_v3_cfg_t const ecspi_pads[] = { /* SPI3 */ diff --git a/board/liebherr/display5/common.h b/board/liebherr/display5/common.h index a507ef9ce8..78c64b02e2 100644 --- a/board/liebherr/display5/common.h +++ b/board/liebherr/display5/common.h @@ -37,5 +37,6 @@ void displ5_set_iomux_ecspi_spl(void); void displ5_set_iomux_ecspi(void); void displ5_set_iomux_usdhc_spl(void); void displ5_set_iomux_usdhc(void); +void displ5_set_iomux_misc_spl(void);
#endif /* __DISPL5_COMMON_H_ */ diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index ebc643e7e3..4bade476a5 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -44,6 +44,7 @@ static bool sw_ids_valid; static u32 cpu_id; static u32 unit_id;
+#define EM_PAD IMX_GPIO_NR(3, 29) #define SW0 IMX_GPIO_NR(2, 4) #define SW1 IMX_GPIO_NR(2, 5) #define SW2 IMX_GPIO_NR(2, 6) @@ -179,6 +180,9 @@ iomux_v3_cfg_t const misc_pads[] = {
/* XTALOSC */ MX6_PAD_GPIO_3__XTALOSC_REF_CLK_24M | MUX_PAD_CTRL(NO_PAD_CTRL), + + /* Emergency recovery pin */ + MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL), };
#ifdef CONFIG_FSL_ESDHC @@ -369,7 +373,22 @@ static inline void setup_boot_modes(void) {}
int misc_init_r(void) { + int ret; + setup_boot_modes(); + + ret = gpio_request(EM_PAD, "Emergency_PAD"); + if (ret) { + printf("Can't request emergency PAD gpio\n"); + return ret; + } + + ret = gpio_direction_input(EM_PAD); + if (ret) { + printf("Can't set emergency PAD direction\n"); + return ret; + } + return 0; }
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 0d25b0d996..551a14347d 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -16,6 +16,7 @@ #include <asm/arch/imx-regs.h> #include "asm/arch/iomux.h" #include <asm/mach-imx/iomux-v3.h> +#include <asm/gpio.h> #include <environment.h> #include <fsl_esdhc.h> #include <netdev.h> @@ -194,10 +195,24 @@ void board_init_f(ulong dummy) /* Clear the BSS. */ memset(__bss_start, 0, __bss_end - __bss_start);
+ displ5_set_iomux_misc_spl(); + /* load/boot image from boot device */ board_init_r(NULL, 0); }
+#define EM_PAD IMX_GPIO_NR(3, 29) +int board_check_emergency_pad(void) +{ + int ret; + + ret = gpio_direction_input(EM_PAD); + if (ret) + return ret; + + return !gpio_get_value(EM_PAD); +} + void board_boot_order(u32 *spl_boot_list) { /* Default boot sequence SPI -> MMC */ @@ -206,6 +221,13 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[2] = BOOT_DEVICE_UART; spl_boot_list[3] = BOOT_DEVICE_NONE;
+ /* + * In case of emergency PAD pressed, we always boot + * to proper u-boot and perform recovery tasks there. + */ + if (board_check_emergency_pad()) + return; + #ifdef CONFIG_SPL_ENV_SUPPORT /* 'fastboot' */ const char *s; diff --git a/include/configs/display5.h b/include/configs/display5.h index 49a1ead649..574e15eb1a 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -100,11 +100,13 @@ #define CONFIG_BAUDRATE 115200
#ifndef CONFIG_BOOTCOMMAND -#define CONFIG_BOOTCOMMAND "if test ${BOOT_FROM} = FACTORY; then " \ +#define CONFIG_BOOTCOMMAND "if run check_em_pad; then " \ + "run recovery;" \ + "else if test ${BOOT_FROM} = FACTORY; then " \ "run factory_nfs;" \ "else " \ "run boot_mmc;" \ - "fi" + "fi;fi" #endif
#define PARTS_DEFAULT \ @@ -246,6 +248,8 @@
#define CONFIG_EXTRA_ENV_SETTINGS \ PARTS_DEFAULT \ + "gpio_recovery=93\0" \ + "check_em_pad=gpio input ${gpio_recovery};test $? -eq 0;\0" \ "display=tianma-tm070-800x480\0" \ "board=display5\0" \ "mmcdev=0\0" \

Test case:
The fitImage gets corrupted:
truncate -c -s 3M fitImage run tftp_mmc_fitImg setenv boot_os y reset
[board shall hang in SPL with "Trying to boot from MMC1" information]
Then after X seconds WDT is causing board to reset. After N boot attempts we enter recovery mode.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
board/liebherr/display5/spl.c | 5 +++++ configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + include/configs/display5.h | 5 +++++ 4 files changed, 12 insertions(+)
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 551a14347d..5c6b8bff38 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -21,6 +21,7 @@ #include <fsl_esdhc.h> #include <netdev.h> #include <bootcount.h> +#include <watchdog.h> #include "common.h"
DECLARE_GLOBAL_DATA_PTR; @@ -197,6 +198,10 @@ void board_init_f(ulong dummy)
displ5_set_iomux_misc_spl();
+ /* Initialize and reset WDT in SPL */ + hw_watchdog_init(); + WATCHDOG_RESET(); + /* load/boot image from boot device */ board_init_r(NULL, 0); } diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 81f329f259..03e56e9588 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -10,6 +10,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_SPL=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5" CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig index d86e5f51e9..da736b2afa 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -9,6 +9,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_SPL=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_FIT=y CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q" diff --git a/include/configs/display5.h b/include/configs/display5.h index 574e15eb1a..9e3c7f547b 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -389,6 +389,11 @@ #define CONFIG_MTD_PARTITIONS #define CONFIG_MTD_DEVICE
+/* Watchdog */ +#define CONFIG_HW_WATCHDOG +#define CONFIG_IMX_WATCHDOG +#define CONFIG_WATCHDOG_TIMEOUT_MSECS 15000 + /* ENV config */ #ifdef CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_ENV_SIZE (SZ_64K)

Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 9e3c7f547b..1e0383de46 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -354,7 +354,12 @@ "rootfs_part_active=2\0" \ "rootfs_part_backup=4\0" \ "rootfs_file=core-image-lwn-display5.ext4\0" \ + "rootfs_file_backup=core-image-lwn-backup-display5.ext4\0" \ __TFTP_UPDATE_ROOTFS \ + "tftp_mmc_rootfs_bkp=" \ + "setenv rootfs_part ${rootfs_part_backup};" \ + "setenv rootfs_file ${rootfs_file_backup};" \ + "run tftp_mmc_rootfs\0" \ TFTP_UPDATE_RECOVERY_SWU_KERNEL \ TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \ "\0" \

After splitting rootfs images to BACKUP and ACTIVE, the "factory" u-boot also needs to update the former.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 1e0383de46..2e26da369f 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -194,13 +194,11 @@ "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \ "; fi\0" \
-/* To save some considerable time, we only once download the rootfs image */ -/* and store it on 'active' and 'backup' rootfs partitions */ #define TFTP_UPDATE_ROOTFS \ "setenv rootfs_part ${rootfs_part_active};" \ "run tftp_mmc_rootfs;" \ - "part start mmc ${mmcdev} ${rootfs_part_backup} lba_start;" \ - "mmc write ${loadaddr} ${lba_start} ${fw_sz};" \ + "run tftp_mmc_rootfs_bkp;" \ +
#define TFTP_UPDATE_RECOVERY_SWU_KERNEL \ "tftp_sf_fitImg_SWU=" \

After moving to swupdate 2017.07, the default fs for swupdate rootfs is ext4, not ext3.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 2e26da369f..75dfed9c3d 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -209,7 +209,7 @@ "; fi\0" \
#define TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \ - "swu_initramfs_file=swupdate-image-display5.ext3.gz.u-boot\0" \ + "swu_initramfs_file=swupdate-image-display5.ext4.gz.u-boot\0" \ "tftp_sf_initramfs_SWU=" \ "if tftp ${loadaddr} ${swu_initramfs_file}; then " \ "sf probe;" \

This code performs DDR3 memory calibration for display5 board.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
board/liebherr/display5/spl.c | 47 +++++++++++++++++++++++++++++++++++++++++++ configs/display5_defconfig | 1 + 2 files changed, 48 insertions(+)
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 5c6b8bff38..0c0172e201 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -117,6 +117,49 @@ static void ccgr_init(void) writel(0x000003FF, &ccm->CCGR6); }
+#ifdef CONFIG_MX6_DDRCAL +static void spl_dram_print_cal(struct mx6_ddr_sysinfo const *sysinfo) +{ + struct mx6_mmdc_calibration calibration = {0}; + + mmdc_read_calibration(sysinfo, &calibration); + + debug(".p0_mpdgctrl0\t= 0x%08X\n", calibration.p0_mpdgctrl0); + debug(".p0_mpdgctrl1\t= 0x%08X\n", calibration.p0_mpdgctrl1); + debug(".p0_mprddlctl\t= 0x%08X\n", calibration.p0_mprddlctl); + debug(".p0_mpwrdlctl\t= 0x%08X\n", calibration.p0_mpwrdlctl); + debug(".p0_mpwldectrl0\t= 0x%08X\n", calibration.p0_mpwldectrl0); + debug(".p0_mpwldectrl1\t= 0x%08X\n", calibration.p0_mpwldectrl1); + debug(".p1_mpdgctrl0\t= 0x%08X\n", calibration.p1_mpdgctrl0); + debug(".p1_mpdgctrl1\t= 0x%08X\n", calibration.p1_mpdgctrl1); + debug(".p1_mprddlctl\t= 0x%08X\n", calibration.p1_mprddlctl); + debug(".p1_mpwrdlctl\t= 0x%08X\n", calibration.p1_mpwrdlctl); + debug(".p1_mpwldectrl0\t= 0x%08X\n", calibration.p1_mpwldectrl0); + debug(".p1_mpwldectrl1\t= 0x%08X\n", calibration.p1_mpwldectrl1); +} + +static void spl_dram_perform_cal(struct mx6_ddr_sysinfo const *sysinfo) +{ + int ret; + + /* Perform DDR DRAM calibration */ + udelay(100); + ret = mmdc_do_write_level_calibration(sysinfo); + if (ret) { + printf("DDR: Write level calibration error [%d]\n", ret); + return; + } + + ret = mmdc_do_dqs_calibration(sysinfo); + if (ret) { + printf("DDR: DQS calibration error [%d]\n", ret); + return; + } + + spl_dram_print_cal(sysinfo); +} +#endif /* CONFIG_MX6_DDRCAL */ + static void spl_dram_init(void) { struct mx6_ddr_sysinfo sysinfo = { @@ -143,6 +186,10 @@ static void spl_dram_init(void)
mx6dq_dram_iocfg(64, &mx6_ddr_ioregs, &mx6_grp_ioregs); mx6_dram_cfg(&sysinfo, &mx6_4x256mx16_mmdc_calib, &mt41k128m16jt_125); + +#ifdef CONFIG_MX6_DDRCAL + spl_dram_perform_cal(&sysinfo); +#endif }
#ifdef CONFIG_SPL_SPI_SUPPORT diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 03e56e9588..81e186820a 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x17800000 CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_MX6_DDRCAL=y CONFIG_TARGET_DISPLAY5=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y

Signed-off-by: Lukasz Majewski lukma@denx.de ---
board/liebherr/display5/display5.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index 4bade476a5..a3deba216c 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -254,6 +254,25 @@ static void setup_iomux_enet(void) gpio_direction_input(IMX_GPIO_NR(1, 28)); /*INT#_GBE*/ }
+static int setup_mac_from_fuse(void) +{ + unsigned char enetaddr[6]; + int ret; + + ret = eth_env_get_enetaddr("ethaddr", enetaddr); + if (ret) /* ethaddr is already set */ + return 0; + + imx_get_mac_from_fuse(0, enetaddr); + + if (is_valid_ethaddr(enetaddr)) { + eth_env_set_enetaddr("ethaddr", enetaddr); + return 0; + } + + return 0; +} + int board_eth_init(bd_t *bd) { struct phy_device *phydev; @@ -268,6 +287,8 @@ int board_eth_init(bd_t *bd) if (ret) return ret;
+ setup_mac_from_fuse(); + bus = fec_get_miibus(IMX_FEC_BASE, -1); if (!bus) return -ENODEV;

Hi Lukasz,
On Fri, May 11, 2018 at 9:51 AM, Lukasz Majewski lukma@denx.de wrote:
Signed-off-by: Lukasz Majewski lukma@denx.de
board/liebherr/display5/display5.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index 4bade476a5..a3deba216c 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -254,6 +254,25 @@ static void setup_iomux_enet(void) gpio_direction_input(IMX_GPIO_NR(1, 28)); /*INT#_GBE*/ }
+static int setup_mac_from_fuse(void) +{
unsigned char enetaddr[6];
int ret;
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
if (ret) /* ethaddr is already set */
return 0;
imx_get_mac_from_fuse(0, enetaddr);
Generally this should be registered as a read_rom_hwaddr handler.
Then you won't be recreating the logic around what to do with it.
if (is_valid_ethaddr(enetaddr)) {
eth_env_set_enetaddr("ethaddr", enetaddr);
return 0;
}
return 0;
+}
int board_eth_init(bd_t *bd) { struct phy_device *phydev; @@ -268,6 +287,8 @@ int board_eth_init(bd_t *bd) if (ret) return ret;
setup_mac_from_fuse();
bus = fec_get_miibus(IMX_FEC_BASE, -1); if (!bus) return -ENODEV;
-- 2.11.0
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hi Joe,
Hi Lukasz,
On Fri, May 11, 2018 at 9:51 AM, Lukasz Majewski lukma@denx.de wrote:
Signed-off-by: Lukasz Majewski lukma@denx.de
board/liebherr/display5/display5.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index 4bade476a5..a3deba216c 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -254,6 +254,25 @@ static void setup_iomux_enet(void) gpio_direction_input(IMX_GPIO_NR(1, 28)); /*INT#_GBE*/ }
+static int setup_mac_from_fuse(void) +{
unsigned char enetaddr[6];
int ret;
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
if (ret) /* ethaddr is already set */
return 0;
imx_get_mac_from_fuse(0, enetaddr);
Generally this should be registered as a read_rom_hwaddr handler.
This function seems like a generic approach for IMX SoC: arch/arm/mach-imx/mac.c
On the other hand the fec_mxc.c driver seems to have such function:
.read_rom_hwaddr = fecmxc_read_rom_hwaddr, (which latter on calls the above function).
To use this function in the automatic way I would need to enable DM_ETH for this board.
Then you won't be recreating the logic around what to do with it.
if (is_valid_ethaddr(enetaddr)) {
eth_env_set_enetaddr("ethaddr", enetaddr);
return 0;
}
return 0;
+}
int board_eth_init(bd_t *bd) { struct phy_device *phydev; @@ -268,6 +287,8 @@ int board_eth_init(bd_t *bd) if (ret) return ret;
setup_mac_from_fuse();
bus = fec_get_miibus(IMX_FEC_BASE, -1); if (!bus) return -ENODEV;
-- 2.11.0
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de

On Wed, May 16, 2018 at 9:46 AM, Lukasz Majewski lukma@denx.de wrote:
Hi Joe,
Hi Lukasz,
On Fri, May 11, 2018 at 9:51 AM, Lukasz Majewski lukma@denx.de wrote:
Signed-off-by: Lukasz Majewski lukma@denx.de
board/liebherr/display5/display5.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index 4bade476a5..a3deba216c 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -254,6 +254,25 @@ static void setup_iomux_enet(void) gpio_direction_input(IMX_GPIO_NR(1, 28)); /*INT#_GBE*/ }
+static int setup_mac_from_fuse(void) +{
unsigned char enetaddr[6];
int ret;
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
if (ret) /* ethaddr is already set */
return 0;
imx_get_mac_from_fuse(0, enetaddr);
Generally this should be registered as a read_rom_hwaddr handler.
This function seems like a generic approach for IMX SoC: arch/arm/mach-imx/mac.c
On the other hand the fec_mxc.c driver seems to have such function:
.read_rom_hwaddr = fecmxc_read_rom_hwaddr,
(which latter on calls the above function).
To use this function in the automatic way I would need to enable DM_ETH for this board.
Good idea.
Then you won't be recreating the logic around what to do with it.
if (is_valid_ethaddr(enetaddr)) {
eth_env_set_enetaddr("ethaddr", enetaddr);
return 0;
}
return 0;
+}
int board_eth_init(bd_t *bd) { struct phy_device *phydev; @@ -268,6 +287,8 @@ int board_eth_init(bd_t *bd) if (ret) return ret;
setup_mac_from_fuse();
bus = fec_get_miibus(IMX_FEC_BASE, -1); if (!bus) return -ENODEV;
-- 2.11.0
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 75dfed9c3d..8212775cc3 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -269,7 +269,7 @@ "hostname=display5\0" \ "loadaddr=0x12000000\0" \ "fdtaddr=0x12800000\0" \ - "console=ttymxc4,115200 quiet\0" \ + "console=ttymxc4,115200 quiet cma=256M\0" \ "fdtfile=imx6q-display5.dtb\0" \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \

Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 8212775cc3..906345067c 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -116,7 +116,7 @@ "name=kernel_raw1,start=128K,size=8M,uuid=${uuid_gpt_kernel_raw1};" \ "name=rootfs1,size=1528M,uuid=${uuid_gpt_rootfs1};" \ "name=kernel_raw2,size=8M,uuid=${uuid_gpt_kernel_raw2};" \ - "name=rootfs2,size=1528M,uuid=${uuid_gpt_rootfs2};" \ + "name=rootfs2,size=512M,uuid=${uuid_gpt_rootfs2};" \ "name=data,size=-,uuid=${uuid_gpt_data}\0"
#define FACTORY_PROCEDURE \

After this change one can run 'gpt' command on production u-boot.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
configs/display5_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 81e186820a..8ac5a2d644 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -34,6 +34,7 @@ CONFIG_CMD_ASKENV=y CONFIG_CRC32_VERIFY=y CONFIG_CMD_EEPROM=y CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y @@ -51,7 +52,6 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1" CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),16m(swu-initramfs),1m(factory),-(reserved)" -CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_SPI_FLASH=y

If GPT gets broken, then after N boot attempts we will run the SWUpdate restoration image. On its enter we will check GPT and restore it if needed.
To test it: display5 > mmc write 0x12000000 4 8
It will overwrite the primary GPT table.
Signed-off-by: Lukasz Majewski lukma@denx.de ---
include/configs/display5.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/configs/display5.h b/include/configs/display5.h index 906345067c..4b6a7cc00e 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -144,6 +144,16 @@ "echo '#######################';" \ "echo '# RECOVERY SWUupdate #';" \ "echo '#######################';" \ + "echo '#######################';" \ + "echo '# GPT verify #';" \ + "if gpt verify mmc ${mmcdev} ${partitions}; then " \ + "echo '# OK ! #';" \ + "else " \ + "echo '# FAILED ! #';" \ + "echo '# GPT RESTORATION #';" \ + "gpt write mmc ${mmcdev} ${partitions};" \ + "fi;" \ + "echo '#######################';" \ "setenv loadaddr_swu_initramfs 0x14000000;" \ "setenv bootargs console=${console} " \ "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \

Without this change the following warning shows up when building:
board/liebherr/display5/display5.c:270:3: warning: implicit declaration of function ‘eth_env_set_enetaddr’ [-Wimplicit-function-declaration]
This commit fixes this issue.
Signed-off-by: Lukasz Majewski lukma@denx.de
---
board/liebherr/display5/display5.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index a3deba216c..d8383170d2 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -25,6 +25,7 @@ #include <miiphy.h> #include <netdev.h> #include <i2c.h> +#include <environment.h>
#include <dm.h> #include <dm/platform_data/serial_mxc.h>
participants (2)
-
Joe Hershberger
-
Lukasz Majewski