Blame view
common/spl/spl_sata.c
1.25 KB
fff40a7e0
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/* * (C) Copyright 2013 * Texas Instruments, <www.ti.com> * * Dan Murphy <dmurphy@ti.com> * * SPDX-License-Identifier: GPL-2.0+ * * Derived work from spl_usb.c */ #include <common.h> #include <spl.h> #include <asm/u-boot.h> #include <sata.h> |
fc89b2e47
|
16 |
#include <scsi.h> |
36afd4513
|
17 |
#include <errno.h> |
fff40a7e0
|
18 |
#include <fat.h> |
fff40a7e0
|
19 20 21 |
#include <image.h> DECLARE_GLOBAL_DATA_PTR; |
2a2ee2ac3
|
22 23 |
static int spl_sata_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) |
fff40a7e0
|
24 25 |
{ int err; |
4101f6879
|
26 |
struct blk_desc *stor_dev; |
fff40a7e0
|
27 28 29 30 31 32 33 |
err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE); if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: sata init failed: err - %d ", err); #endif |
36afd4513
|
34 |
return err; |
fff40a7e0
|
35 36 |
} else { /* try to recognize storage devices immediately */ |
8eab1a58d
|
37 |
scsi_scan(false); |
edd82ab35
|
38 |
stor_dev = blk_get_devnum_by_type(IF_TYPE_SCSI, 0); |
36afd4513
|
39 40 |
if (!stor_dev) return -ENODEV; |
fff40a7e0
|
41 42 43 |
} #ifdef CONFIG_SPL_OS_BOOT |
710e9ca57
|
44 45 46 |
if (spl_start_uboot() || spl_load_image_fat_os(spl_image, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) |
fff40a7e0
|
47 |
#endif |
710e9ca57
|
48 49 50 |
{ err = spl_load_image_fat(spl_image, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION, |
205b4f33c
|
51 |
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); |
710e9ca57
|
52 |
} |
fff40a7e0
|
53 54 55 |
if (err) { puts("Error loading sata device "); |
36afd4513
|
56 |
return err; |
fff40a7e0
|
57 |
} |
36afd4513
|
58 59 |
return 0; |
fff40a7e0
|
60 |
} |
ebc4ef61d
|
61 |
SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image); |