Reduce OneNAND IPL common code
OneNAND IPL has common codes for RAM init, load data, and jump to 2nd bootloader, but it's common code used about 300~400 bytes. So board specific codes, such as lowlevel_init, can't has enough code. It make a difficult to implement OneNAND IPL. his patch make this common code as small as possible. and give lowlevel_init can have more codes. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
16f2f5a351
commit
196c74311f
|
@ -28,46 +28,16 @@
|
||||||
|
|
||||||
#include "onenand_ipl.h"
|
#include "onenand_ipl.h"
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_PRINTF
|
|
||||||
int print_info(void)
|
|
||||||
{
|
|
||||||
printf(XLOADER_VERSION);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int (init_fnc_t)(void);
|
typedef int (init_fnc_t)(void);
|
||||||
|
|
||||||
init_fnc_t *init_sequence[] = {
|
|
||||||
board_init, /* basic board dependent setup */
|
|
||||||
#ifdef CONFIG_SYS_PRINTF
|
|
||||||
serial_init, /* serial communications setup */
|
|
||||||
print_info,
|
|
||||||
#endif
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
void start_oneboot(void)
|
void start_oneboot(void)
|
||||||
{
|
{
|
||||||
init_fnc_t **init_fnc_ptr;
|
|
||||||
uchar *buf;
|
uchar *buf;
|
||||||
|
|
||||||
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
|
|
||||||
if ((*init_fnc_ptr)() != 0)
|
|
||||||
hang();
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
|
buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
|
||||||
|
|
||||||
if (!onenand_read_block0(buf))
|
onenand_read_block0(buf);
|
||||||
buf += ONENAND_BLOCK_SIZE;
|
|
||||||
|
|
||||||
if (buf == (uchar *)CONFIG_SYS_LOAD_ADDR)
|
|
||||||
hang();
|
|
||||||
|
|
||||||
/* go run U-Boot and never return */
|
|
||||||
printf("Starting OS Bootloader...\n");
|
|
||||||
((init_fnc_t *)CONFIG_SYS_LOAD_ADDR)();
|
((init_fnc_t *)CONFIG_SYS_LOAD_ADDR)();
|
||||||
|
|
||||||
/* should never come here */
|
/* should never come here */
|
||||||
|
@ -75,7 +45,5 @@ void start_oneboot(void)
|
||||||
|
|
||||||
void hang(void)
|
void hang(void)
|
||||||
{
|
{
|
||||||
/* if board_hang() returns, hange here */
|
|
||||||
printf("X-Loader hangs\n");
|
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,6 @@
|
||||||
|
|
||||||
#include <linux/mtd/onenand_regs.h>
|
#include <linux/mtd/onenand_regs.h>
|
||||||
|
|
||||||
#define ONENAND_BLOCK_SIZE 2048
|
|
||||||
|
|
||||||
#ifndef CONFIG_SYS_PRINTF
|
|
||||||
#define printf(format, args...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define onenand_readw(a) readw(a)
|
#define onenand_readw(a) readw(a)
|
||||||
#define onenand_writew(v, a) writew(v, a)
|
#define onenand_writew(v, a) writew(v, a)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue