3 * Texas Instruments, <www.ti.com>
5 * Dan Murphy <dmurphy@ti.com>
7 * SPDX-License-Identifier: GPL-2.0+
9 * Derived work from spl_usb.c
14 #include <asm/u-boot.h>
21 DECLARE_GLOBAL_DATA_PTR;
23 static int spl_sata_load_image(struct spl_image_info *spl_image,
24 struct spl_boot_device *bootdev)
27 struct blk_desc *stor_dev;
29 err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
31 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
32 printf("spl: sata init failed: err - %d\n", err);
36 /* try to recognize storage devices immediately */
38 stor_dev = blk_get_devnum_by_type(IF_TYPE_SCSI, 0);
43 #ifdef CONFIG_SPL_OS_BOOT
44 if (spl_start_uboot() ||
45 spl_load_image_fat_os(spl_image, stor_dev,
46 CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
49 err = spl_load_image_fat(spl_image, stor_dev,
50 CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
51 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
54 puts("Error loading sata device\n");
60 SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image);