mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
nand: Add SPL_NAND support to mxc_nand_spl
Add support for generic NAND SPL via the SPL framework into the mxc_nand_spl driver. This is basically just a simple rename and publication of the already implemented functions. To avoid the bare-bones functions getting in the way of the NAND_SPL, build them only if CONFIG_SPL_FRAMEWORK is not defined. Also make sure the requested payload is aligned to full pages, otherwise this simple driver fails to load the last page. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net> Cc: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Tom Rini <trini@ti.com> Acked-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
895d996676
commit
5c651e86ca
1 changed files with 10 additions and 3 deletions
|
@ -290,7 +290,7 @@ static int is_badblock(int pagenumber)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
|
||||
int nand_spl_load_image(uint32_t from, unsigned int size, void *buf)
|
||||
{
|
||||
int i;
|
||||
unsigned int page;
|
||||
|
@ -303,6 +303,7 @@ static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
|
|||
page = from / CONFIG_SYS_NAND_PAGE_SIZE;
|
||||
i = 0;
|
||||
|
||||
size = roundup(size, CONFIG_SYS_NAND_PAGE_SIZE);
|
||||
while (i < size / CONFIG_SYS_NAND_PAGE_SIZE) {
|
||||
if (nfc_read_page(page, buf) < 0)
|
||||
return -1;
|
||||
|
@ -332,6 +333,7 @@ static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SPL_FRAMEWORK
|
||||
/*
|
||||
* The main entry for NAND booting. It's necessary that SDRAM is already
|
||||
* configured and available since this code loads the main U-Boot image
|
||||
|
@ -345,8 +347,9 @@ void nand_boot(void)
|
|||
* CONFIG_SYS_NAND_U_BOOT_OFFS and CONFIG_SYS_NAND_U_BOOT_SIZE must
|
||||
* be aligned to full pages
|
||||
*/
|
||||
if (!nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
|
||||
(uchar *)CONFIG_SYS_NAND_U_BOOT_DST)) {
|
||||
if (!nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
|
||||
CONFIG_SYS_NAND_U_BOOT_SIZE,
|
||||
(uchar *)CONFIG_SYS_NAND_U_BOOT_DST)) {
|
||||
/* Copy from NAND successful, start U-boot */
|
||||
uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
|
||||
uboot();
|
||||
|
@ -364,3 +367,7 @@ void hang(void)
|
|||
/* Loop forever */
|
||||
while (1) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
void nand_init(void) {}
|
||||
void nand_deselect(void) {}
|
||||
|
|
Loading…
Add table
Reference in a new issue