]> Git Repo - u-boot.git/blame - common/spl/spl_sata.c
spl: change return values of spl_*_load_image()
[u-boot.git] / common / spl / spl_sata.c
CommitLineData
fff40a7e
DM
1/*
2 * (C) Copyright 2013
3 * Texas Instruments, <www.ti.com>
4 *
5 * Dan Murphy <[email protected]>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 *
9 * Derived work from spl_usb.c
10 */
11
12#include <common.h>
13#include <spl.h>
14#include <asm/u-boot.h>
15#include <sata.h>
fc89b2e4 16#include <scsi.h>
36afd451 17#include <errno.h>
fff40a7e 18#include <fat.h>
fff40a7e
DM
19#include <image.h>
20
21DECLARE_GLOBAL_DATA_PTR;
22
36afd451 23int spl_sata_load_image(void)
fff40a7e
DM
24{
25 int err;
26 block_dev_desc_t *stor_dev;
27
28 err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
29 if (err) {
30#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
31 printf("spl: sata init failed: err - %d\n", err);
32#endif
36afd451 33 return err;
fff40a7e
DM
34 } else {
35 /* try to recognize storage devices immediately */
76300c0d 36 scsi_scan(0);
fff40a7e 37 stor_dev = scsi_get_dev(0);
36afd451
NK
38 if (!stor_dev)
39 return -ENODEV;
fff40a7e
DM
40 }
41
42#ifdef CONFIG_SPL_OS_BOOT
43 if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
44 CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
45#endif
46 err = spl_load_image_fat(stor_dev,
47 CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
205b4f33 48 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
fff40a7e
DM
49 if (err) {
50 puts("Error loading sata device\n");
36afd451 51 return err;
fff40a7e 52 }
36afd451
NK
53
54 return 0;
fff40a7e 55}
This page took 0.135272 seconds and 4 git commands to generate.