1 // SPDX-License-Identifier: GPL-2.0+
3 #include <asm/global_data.h>
4 #include <asm/arch/sys_proto.h>
5 #include <asm/mach-imx/boot_mode.h>
7 DECLARE_GLOBAL_DATA_PTR;
9 u32 rom_api_download_image(u8 *dest, u32 offset, u32 size)
11 u32 xor = (uintptr_t)dest ^ offset ^ size;
12 volatile gd_t *sgd = gd;
15 ret = g_rom_api->download_image(dest, offset, size, xor);
21 u32 rom_api_query_boot_infor(u32 info_type, u32 *info)
23 u32 xor = info_type ^ (uintptr_t)info;
24 volatile gd_t *sgd = gd;
27 ret = g_rom_api->query_boot_infor(info_type, info, xor);
33 extern struct rom_api *g_rom_api;
35 enum boot_device get_boot_device(void)
37 volatile gd_t *pgd = gd;
42 enum boot_device boot_dev = SD1_BOOT;
44 ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot,
45 ((uintptr_t)&boot) ^ QUERY_BT_DEV);
48 if (ret != ROM_API_OKAY) {
49 puts("ROMAPI: failure at query_boot_info\n");
53 boot_type = boot >> 16;
54 boot_instance = (boot >> 8) & 0xff;
58 boot_dev = boot_instance + SD1_BOOT;
61 boot_dev = boot_instance + MMC1_BOOT;
63 case BT_DEV_TYPE_NAND:
66 case BT_DEV_TYPE_FLEXSPINOR:
70 boot_dev = boot_instance + USB_BOOT;