Update and Add features to Bosch Guardian Board

The following patches ensure that the Bosch Guardian Board is updated with the latest feature additions and improvements made in the recent past
On High Level, the following are achieved: * Proper handling of USB-ETH Boot in SPL stage * Provide Boot stage feedback * Store Bootcount in RTC Scratch Registers * Save ENV in NAND * Handle Linux Boot

- On Guardian board, usb-eth boot in SPL stage fails due to certain misconfiguration. Hence, add the same to fix the issue.
- configs are set based on the conditional statement present in arch/arm/mach-omap2/am33xx/board.c
- disable tiny printf in SPL stage: As the library is optimized, the ability to deal with ethaddr is lost. The following message would be printed on the console,
Error: flags type check failure for "ethaddr" <= "80a81144M" (type: m) Error inserting "ethaddr" variable, errno=1
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- configs/am335x_guardian_defconfig | 4 +++- include/configs/am335x_guardian.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 13974f7c0f..eb2d221f4c 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -52,7 +52,7 @@ CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_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 @@ -87,3 +87,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 CONFIG_USB_ETHER=y CONFIG_SPL_WDT=y CONFIG_FAT_WRITE=y +CONFIG_SPL_OF_LIBFDT=y +# CONFIG_SPL_USE_TINY_PRINTF is not set diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 0e20d6c728..6b9b6a28e9 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -109,4 +109,9 @@
#endif /* CONFIG_MTD_RAW_NAND */
+#define CONFIG_AM335X_USB0 +#define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL +#define CONFIG_AM335X_USB1 +#define CONFIG_AM335X_USB1_MODE MUSB_HOST + #endif /* ! __CONFIG_AM335X_GUARDIAN_H */

This patch enables the guardian board to provide feedback about the boot stage in headless mode. The on-board led would behave in the following pattern
* U-boot -> GLOW LED * Linux -> BLINK LED [HEART-BEAT PATTERN]
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- arch/arm/dts/am335x-guardian.dts | 2 +- board/bosch/guardian/board.c | 4 ++++ configs/am335x_guardian_defconfig | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts index 5ed2133e78..b554be97a3 100644 --- a/arch/arm/dts/am335x-guardian.dts +++ b/arch/arm/dts/am335x-guardian.dts @@ -58,7 +58,7 @@ label = "guardian:life-led"; gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; - default-state = "off"; + default-state = "on"; }; };
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 32ebaf4231..03ba9e8c5e 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -14,6 +14,7 @@ #include <env_internal.h> #include <errno.h> #include <i2c.h> +#include <led.h> #include <miiphy.h> #include <panel.h> #include <power/tps65217.h> @@ -232,6 +233,9 @@ err:
int board_late_init(void) { +#ifdef CONFIG_LED_GPIO + led_default_state(); +#endif set_bootmode_env(); return 0; } diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index eb2d221f4c..942530d76e 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -37,6 +37,7 @@ CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NAND_OFS=0x0 CONFIG_CMD_ASKENV=y # CONFIG_CMD_FLASH is not set +# CONFIG_CMD_LED is not set CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y @@ -58,6 +59,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_ENV=y +CONFIG_LED=y +CONFIG_LED_GPIO=y CONFIG_MISC=y # CONFIG_MMC is not set CONFIG_MTD=y

- Move bootlimit to defconfig - Store bootcount in RTC block
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- configs/am335x_guardian_defconfig | 4 +++- include/configs/am335x_guardian.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 942530d76e..6bd5f0a9e5 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -9,6 +9,8 @@ CONFIG_AM33XX=y CONFIG_TARGET_AM335X_GUARDIAN=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_BOOTCOUNT_BOOTLIMIT=3 +CONFIG_SYS_BOOTCOUNT_ADDR=0x44E3E000 CONFIG_SPL=y CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_SPL_LIBDISK_SUPPORT=y @@ -58,7 +60,7 @@ CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y -CONFIG_BOOTCOUNT_ENV=y +CONFIG_BOOTCOUNT_AM33XX=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 6b9b6a28e9..3c6147a266 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -46,7 +46,6 @@ AM335XX_BOARD_FDTFILE \ MEM_LAYOUT_ENV_SETTINGS \ BOOTENV \ - "bootlimit=3\0" \ "bootubivol=rootfs\0" \ "altbootcmd=" \ "setenv boot_config "extlinux-rollback.conf"; " \

- 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 | 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@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>; }; }; }; 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 <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"; " \

- Add a boot logic in the distro boot command - Add fallback mechanism in alternate boot command - Keep single boot target -> ubifs0
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- include/configs/am335x_guardian.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 1ac5e2e240..c34c07a493 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -34,9 +34,7 @@ "ramdisk_addr_r=0x88080000\0" \
#define BOOT_TARGET_DEVICES(func) \ - func(UBIFS, ubifs, 0) \ - func(PXE, pxe, na) \ - func(DHCP, dhcp, na) + func(UBIFS, ubifs, 0)
#define AM335XX_BOARD_FDTFILE "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"
@@ -60,9 +58,25 @@ BOOTENV \ GUARDIAN_DEFAULT_PROD_ENV \ "bootubivol=rootfs\0" \ + "distro_bootcmd=" \ + "setenv autoload no; " \ + "setenv rootflags "bulk_read,chk_data_crc"; " \ + "setenv ethact usb_ether; " \ + "if test "${swi_status}" -eq 1; then " \ + "setenv extrabootargs "swi_attached"; " \ + "if dhcp; then " \ + "sleep 1; " \ + "if tftp "${tftp_load_addr}" "bootscript.scr"; then " \ + "source "${tftp_load_addr}"; " \ + "fi; " \ + "fi; " \ + "fi;" \ + "run bootcmd_ubifs0;\0" \ "altbootcmd=" \ - "setenv boot_config "extlinux-rollback.conf"; " \ - "run distro_bootcmd\0" + "setenv boot_syslinux_conf "extlinux/extlinux-rollback.conf"; " \ + "run distro_bootcmd; " \ + "setenv boot_syslinux_conf "extlinux/extlinux.conf"; " \ + "run bootcmd_ubifs0;\0"
#endif /* ! CONFIG_SPL_BUILD */

On 25/03/20 12:15 PM, Moses Christopher wrote:
The following patches ensure that the Bosch Guardian Board is updated with the latest feature additions and improvements made in the recent past
On High Level, the following are achieved:
- Proper handling of USB-ETH Boot in SPL stage
- Provide Boot stage feedback
- Store Bootcount in RTC Scratch Registers
- Save ENV in NAND
- Handle Linux Boot
Applied to u-boot-ti.
Thanks and regards, Lokesh
participants (2)
-
Lokesh Vutla
-
Moses Christopher