aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-imx/spl.c')
-rw-r--r--arch/arm/mach-imx/spl.c61
1 files changed, 51 insertions, 10 deletions
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index a20b30d154..397d6d4a91 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -96,8 +96,8 @@ u32 spl_boot_device(void)
96 return BOOT_DEVICE_NONE; 96 return BOOT_DEVICE_NONE;
97} 97}
98 98
99#elif defined(CONFIG_MX7) || defined(CONFIG_MX8M) 99#elif defined(CONFIG_MX7) || defined(CONFIG_IMX8M)
100/* Translate iMX7/MX8M boot device to the SPL boot device enumeration */ 100/* Translate iMX7/i.MX8M boot device to the SPL boot device enumeration */
101u32 spl_boot_device(void) 101u32 spl_boot_device(void)
102{ 102{
103#if defined(CONFIG_MX7) 103#if defined(CONFIG_MX7)
@@ -126,6 +126,7 @@ u32 spl_boot_device(void)
126 enum boot_device boot_device_spl = get_boot_device(); 126 enum boot_device boot_device_spl = get_boot_device();
127 127
128 switch (boot_device_spl) { 128 switch (boot_device_spl) {
129#if defined(CONFIG_MX7)
129 case SD1_BOOT: 130 case SD1_BOOT:
130 case MMC1_BOOT: 131 case MMC1_BOOT:
131 case SD2_BOOT: 132 case SD2_BOOT:
@@ -133,6 +134,14 @@ u32 spl_boot_device(void)
133 case SD3_BOOT: 134 case SD3_BOOT:
134 case MMC3_BOOT: 135 case MMC3_BOOT:
135 return BOOT_DEVICE_MMC1; 136 return BOOT_DEVICE_MMC1;
137#elif defined(CONFIG_IMX8M)
138 case SD1_BOOT:
139 case MMC1_BOOT:
140 return BOOT_DEVICE_MMC1;
141 case SD2_BOOT:
142 case MMC2_BOOT:
143 return BOOT_DEVICE_MMC2;
144#endif
136 case NAND_BOOT: 145 case NAND_BOOT:
137 return BOOT_DEVICE_NAND; 146 return BOOT_DEVICE_NAND;
138 case SPI_NOR_BOOT: 147 case SPI_NOR_BOOT:
@@ -143,9 +152,9 @@ u32 spl_boot_device(void)
143 return BOOT_DEVICE_NONE; 152 return BOOT_DEVICE_NONE;
144 } 153 }
145} 154}
146#endif /* CONFIG_MX6 || CONFIG_MX7 || CONFIG_MX8M */ 155#endif /* CONFIG_MX7 || CONFIG_IMX8M */
147 156
148#ifdef CONFIG_SPL_USB_GADGET_SUPPORT 157#ifdef CONFIG_SPL_USB_GADGET
149int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) 158int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
150{ 159{
151 put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM + 0xfff, &dev->idProduct); 160 put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM + 0xfff, &dev->idProduct);
@@ -220,14 +229,46 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
220 229
221 debug("image entry point: 0x%lX\n", spl_image->entry_point); 230 debug("image entry point: 0x%lX\n", spl_image->entry_point);
222 231
223 /* HAB looks for the CSF at the end of the authenticated data therefore, 232 if (spl_image->flags & SPL_FIT_FOUND) {
224 * we need to subtract the size of the CSF from the actual filesize */
225 offset = spl_image->size - CONFIG_CSF_SIZE;
226 if (!imx_hab_authenticate_image(spl_image->load_addr,
227 offset + IVT_SIZE + CSF_PAD_SIZE,
228 offset)) {
229 image_entry(); 233 image_entry();
230 } else { 234 } else {
235 /*
236 * HAB looks for the CSF at the end of the authenticated
237 * data therefore, we need to subtract the size of the
238 * CSF from the actual filesize
239 */
240 offset = spl_image->size - CONFIG_CSF_SIZE;
241 if (!imx_hab_authenticate_image(spl_image->load_addr,
242 offset + IVT_SIZE +
243 CSF_PAD_SIZE, offset)) {
244 image_entry();
245 } else {
246 puts("spl: ERROR: image authentication fail\n");
247 hang();
248 }
249 }
250}
251
252ulong board_spl_fit_size_align(ulong size)
253{
254 /*
255 * HAB authenticate_image requests the IVT offset is
256 * aligned to 0x1000
257 */
258
259 size = ALIGN(size, 0x1000);
260 size += CONFIG_CSF_SIZE;
261
262 return size;
263}
264
265void board_spl_fit_post_load(ulong load_addr, size_t length)
266{
267 u32 offset = length - CONFIG_CSF_SIZE;
268
269 if (imx_hab_authenticate_image(load_addr,
270 offset + IVT_SIZE + CSF_PAD_SIZE,
271 offset)) {
231 puts("spl: ERROR: image authentication unsuccessful\n"); 272 puts("spl: ERROR: image authentication unsuccessful\n");
232 hang(); 273 hang();
233 } 274 }