]> git.ipfire.org Git - people/ms/u-boot.git/blame - common/spl/spl_onenand.c
spl: Pass spl_image as a parameter to load_image() methods
[people/ms/u-boot.git] / common / spl / spl_onenand.c
CommitLineData
6000992e
EBS
1/*
2 * Copyright (C) 2013
3 * ISEE 2007 SL - Enric Balletbo i Serra <eballetbo@iseebcn.com>
4 *
5 * Based on common/spl/spl_nand.c
6 * Copyright (C) 2011
7 * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
8 *
1a459660 9 * SPDX-License-Identifier: GPL-2.0+
6000992e
EBS
10 */
11#include <common.h>
12#include <config.h>
13#include <spl.h>
14#include <asm/io.h>
15#include <onenand_uboot.h>
16
2a2ee2ac
SG
17static int spl_onenand_load_image(struct spl_image_info *spl_image,
18 struct spl_boot_device *bootdev)
6000992e
EBS
19{
20 struct image_header *header;
7e0f2267 21 int ret;
6000992e
EBS
22
23 debug("spl: onenand\n");
24
25 /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
26 header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
27 /* Load u-boot */
28 onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
29 CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
2a2ee2ac 30 ret = spl_parse_image_header(spl_image, header);
7e0f2267
MV
31 if (ret)
32 return ret;
6000992e 33 onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
2a2ee2ac 34 spl_image->size, (void *)spl_image->load_addr);
36afd451
NK
35
36 return 0;
6000992e 37}
afa6e6c4
SG
38/* Use priorty 1 so that Ubi can override this */
39SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_ONENAND, spl_onenand_load_image);