Commit e7e720c2cef046f67f23db0a54bd65f8b662531e

Authored by Sumit Garg
Committed by York Sun
1 parent 69d4b48c84

arm: ls1021atwr: Add SD secure boot target

Add SD secure boot target for ls1021atwr.
Implement board specific spl_board_init() to setup CAAM stream ID and
corresponding stream ID in SMMU. Change the u-boot size defined by a
macro for copying the main U-Boot by SPL to also include the u-boot
Secure Boot header size as header is appended to u-boot image. So header
will also be copied from SD to DDR.

Reviewed-by: Aneesh Bansal <aneesh.bansal@nxp.com>
Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

Showing 3 changed files with 60 additions and 0 deletions Side-by-side Diff

board/freescale/ls1021atwr/ls1021atwr.c
... ... @@ -503,6 +503,13 @@
503 503 return 0;
504 504 }
505 505  
  506 +#if defined(CONFIG_SPL_BUILD)
  507 +void spl_board_init(void)
  508 +{
  509 + ls102xa_smmu_stream_id_init();
  510 +}
  511 +#endif
  512 +
506 513 #ifdef CONFIG_BOARD_LATE_INIT
507 514 int board_late_init(void)
508 515 {
configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
  1 +CONFIG_ARM=y
  2 +CONFIG_TARGET_LS1021ATWR=y
  3 +CONFIG_SPL=y
  4 +CONFIG_OF_BOARD_SETUP=y
  5 +CONFIG_OF_STDOUT_VIA_ALIAS=y
  6 +CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT,SECURE_BOOT"
  7 +CONFIG_BOOTDELAY=0
  8 +CONFIG_HUSH_PARSER=y
  9 +CONFIG_CMD_BOOTZ=y
  10 +CONFIG_CMD_GREPENV=y
  11 +CONFIG_CMD_MEMTEST=y
  12 +CONFIG_CMD_MEMINFO=y
  13 +CONFIG_CMD_MMC=y
  14 +CONFIG_CMD_I2C=y
  15 +CONFIG_CMD_USB=y
  16 +CONFIG_CMD_DHCP=y
  17 +CONFIG_CMD_MII=y
  18 +CONFIG_CMD_PING=y
  19 +CONFIG_CMD_EXT2=y
  20 +CONFIG_CMD_FAT=y
  21 +CONFIG_NETDEVICES=y
  22 +CONFIG_E1000=y
  23 +CONFIG_SYS_NS16550=y
  24 +CONFIG_USB=y
  25 +CONFIG_USB_XHCI_HCD=y
  26 +CONFIG_USB_XHCI_DWC3=y
  27 +CONFIG_OF_LIBFDT=y
  28 +CONFIG_FIT=y
  29 +CONFIG_FIT_VERBOSE=y
  30 +CONFIG_RSA=y
  31 +CONFIG_DM=y
include/configs/ls1021atwr.h
... ... @@ -124,7 +124,18 @@
124 124 #define CONFIG_SPL_SERIAL_SUPPORT
125 125 #define CONFIG_SPL_MMC_SUPPORT
126 126 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0xe8
  127 +
  128 +#ifdef CONFIG_SECURE_BOOT
  129 +#define CONFIG_U_BOOT_HDR_SIZE (16 << 10)
  130 +/*
  131 + * HDR would be appended at end of image and copied to DDR along
  132 + * with U-Boot image.
  133 + */
  134 +#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS (0x400 + \
  135 + (CONFIG_U_BOOT_HDR_SIZE / 512)
  136 +#else
127 137 #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x400
  138 +#endif /* ifdef CONFIG_SECURE_BOOT */
128 139  
129 140 #define CONFIG_SPL_TEXT_BASE 0x10000000
130 141 #define CONFIG_SPL_MAX_SIZE 0x1a000
131 142  
... ... @@ -137,7 +148,18 @@
137 148 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000
138 149 #define CONFIG_SPL_BSS_START_ADDR 0x80100000
139 150 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000
  151 +
  152 +#ifdef CONFIG_U_BOOT_HDR_SIZE
  153 +/*
  154 + * HDR would be appended at end of image and copied to DDR along
  155 + * with U-Boot image. Here u-boot max. size is 512K. So if binary
  156 + * size increases then increase this size in case of secure boot as
  157 + * it uses raw u-boot image instead of fit image.
  158 + */
  159 +#define CONFIG_SYS_MONITOR_LEN (0x80000 + CONFIG_U_BOOT_HDR_SIZE)
  160 +#else
140 161 #define CONFIG_SYS_MONITOR_LEN 0x80000
  162 +#endif /* ifdef CONFIG_U_BOOT_HDR_SIZE */
141 163 #endif
142 164  
143 165 #ifdef CONFIG_QSPI_BOOT