1 // SPDX-License-Identifier: GPL-2.0+
4 * Texas Instruments, <www.ti.com>
6 * Dan Murphy <dmurphy@ti.com>
8 * Derived work from spl_usb.c
13 #include <asm/u-boot.h>
20 static int spl_sata_load_image(struct spl_image_info *spl_image,
21 struct spl_boot_device *bootdev)
24 struct blk_desc *stor_dev;
26 err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
28 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
29 printf("spl: sata init failed: err - %d\n", err);
33 /* try to recognize storage devices immediately */
35 stor_dev = blk_get_devnum_by_type(IF_TYPE_SCSI, 0);
40 #ifdef CONFIG_SPL_OS_BOOT
41 if (spl_start_uboot() ||
42 spl_load_image_fat_os(spl_image, stor_dev,
43 CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
46 err = spl_load_image_fat(spl_image, stor_dev,
47 CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
48 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
51 puts("Error loading sata device\n");
57 SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image);