upstream u-boot with additional patches for our devices/boards:
https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ;
Gbit ethernet patch for some LIME2 revisions ;
with SPI flash support
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.1 KiB
101 lines
3.1 KiB
13 years ago
|
/*
|
||
|
* Copyright (C) 2011
|
||
|
* Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
|
||
|
*
|
||
|
* See file CREDITS for list of people who contributed to this
|
||
|
* project.
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU General Public License as
|
||
|
* published by the Free Software Foundation; either version 2 of
|
||
|
* the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||
|
* MA 02111-1307 USA
|
||
|
*/
|
||
|
#include <common.h>
|
||
13 years ago
|
#include <config.h>
|
||
13 years ago
|
#include <spl.h>
|
||
13 years ago
|
#include <asm/io.h>
|
||
13 years ago
|
#include <nand.h>
|
||
|
|
||
|
void spl_nand_load_image(void)
|
||
|
{
|
||
|
struct image_header *header;
|
||
13 years ago
|
int *src __attribute__((unused));
|
||
|
int *dst __attribute__((unused));
|
||
|
|
||
13 years ago
|
debug("spl: nand - using hw ecc\n");
|
||
|
nand_init();
|
||
13 years ago
|
|
||
|
/*use CONFIG_SYS_TEXT_BASE as temporary storage area */
|
||
|
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
|
||
13 years ago
|
#ifdef CONFIG_SPL_OS_BOOT
|
||
13 years ago
|
if (!spl_start_uboot()) {
|
||
13 years ago
|
/*
|
||
|
* load parameter image
|
||
|
* load to temp position since nand_spl_load_image reads
|
||
|
* a whole block which is typically larger than
|
||
13 years ago
|
* CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite
|
||
13 years ago
|
* following sections like BSS
|
||
|
*/
|
||
|
nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS,
|
||
|
CONFIG_CMD_SPL_WRITE_SIZE,
|
||
|
(void *)CONFIG_SYS_TEXT_BASE);
|
||
|
/* copy to destintion */
|
||
|
for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR,
|
||
|
src = (int *)CONFIG_SYS_TEXT_BASE;
|
||
|
src < (int *)(CONFIG_SYS_TEXT_BASE +
|
||
|
CONFIG_CMD_SPL_WRITE_SIZE);
|
||
|
src++, dst++) {
|
||
|
writel(readl(src), dst);
|
||
|
}
|
||
13 years ago
|
|
||
13 years ago
|
/* load linux */
|
||
|
nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
|
||
|
CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
|
||
|
spl_parse_image_header(header);
|
||
13 years ago
|
if (header->ih_os == IH_OS_LINUX) {
|
||
|
/* happy - was a linux */
|
||
|
nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
|
||
|
spl_image.size, (void *)spl_image.load_addr);
|
||
|
nand_deselect();
|
||
|
return;
|
||
|
} else {
|
||
13 years ago
|
puts("The Expected Linux image was not "
|
||
|
"found. Please check your NAND "
|
||
13 years ago
|
"configuration.\n");
|
||
13 years ago
|
puts("Trying to start u-boot now...\n");
|
||
13 years ago
|
}
|
||
|
}
|
||
13 years ago
|
#endif
|
||
13 years ago
|
#ifdef CONFIG_NAND_ENV_DST
|
||
13 years ago
|
nand_spl_load_image(CONFIG_ENV_OFFSET,
|
||
|
CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
|
||
|
spl_parse_image_header(header);
|
||
|
nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size,
|
||
|
(void *)spl_image.load_addr);
|
||
13 years ago
|
#ifdef CONFIG_ENV_OFFSET_REDUND
|
||
13 years ago
|
nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
|
||
|
CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
|
||
|
spl_parse_image_header(header);
|
||
|
nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size,
|
||
|
(void *)spl_image.load_addr);
|
||
13 years ago
|
#endif
|
||
|
#endif
|
||
13 years ago
|
/* Load u-boot */
|
||
|
nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
|
||
|
CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
|
||
|
spl_parse_image_header(header);
|
||
|
nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
|
||
|
spl_image.size, (void *)spl_image.load_addr);
|
||
13 years ago
|
nand_deselect();
|
||
|
}
|