Enric Balletbo i Serra | 6000992 | 2013-02-07 23:14:48 +0000 | [diff] [blame] | 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 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
Enric Balletbo i Serra | 6000992 | 2013-02-07 23:14:48 +0000 | [diff] [blame] | 10 | */ |
| 11 | #include <common.h> |
| 12 | #include <config.h> |
| 13 | #include <spl.h> |
| 14 | #include <asm/io.h> |
| 15 | #include <onenand_uboot.h> |
| 16 | |
Nikita Kiryanov | 36afd45 | 2015-11-08 17:11:49 +0200 | [diff] [blame] | 17 | int spl_onenand_load_image(void) |
Enric Balletbo i Serra | 6000992 | 2013-02-07 23:14:48 +0000 | [diff] [blame] | 18 | { |
| 19 | struct image_header *header; |
Marek Vasut | 7e0f226 | 2016-04-29 00:44:54 +0200 | [diff] [blame] | 20 | int ret; |
Enric Balletbo i Serra | 6000992 | 2013-02-07 23:14:48 +0000 | [diff] [blame] | 21 | |
| 22 | debug("spl: onenand\n"); |
| 23 | |
| 24 | /*use CONFIG_SYS_TEXT_BASE as temporary storage area */ |
| 25 | header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); |
| 26 | /* Load u-boot */ |
| 27 | onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, |
| 28 | CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header); |
Simon Glass | 71316c1 | 2016-09-24 18:19:53 -0600 | [diff] [blame^] | 29 | ret = spl_parse_image_header(&spl_image, header); |
Marek Vasut | 7e0f226 | 2016-04-29 00:44:54 +0200 | [diff] [blame] | 30 | if (ret) |
| 31 | return ret; |
Enric Balletbo i Serra | 6000992 | 2013-02-07 23:14:48 +0000 | [diff] [blame] | 32 | onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, |
| 33 | spl_image.size, (void *)spl_image.load_addr); |
Nikita Kiryanov | 36afd45 | 2015-11-08 17:11:49 +0200 | [diff] [blame] | 34 | |
| 35 | return 0; |
Enric Balletbo i Serra | 6000992 | 2013-02-07 23:14:48 +0000 | [diff] [blame] | 36 | } |