summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2013-04-21 05:52:23 +0000
committerStefano Babic <sbabic@denx.de>2013-05-05 17:45:05 +0200
commit5c651e86ca6d88ae8016578f01fb4daf6d8d4fbc (patch)
tree90156fd21add2b97012cb211ad6c2b1c49de5fd5
parent895d996676b2d538657a5e058aa316a85237487c (diff)
downloadu-boot-imx-5c651e86ca6d88ae8016578f01fb4daf6d8d4fbc.zip
u-boot-imx-5c651e86ca6d88ae8016578f01fb4daf6d8d4fbc.tar.gz
u-boot-imx-5c651e86ca6d88ae8016578f01fb4daf6d8d4fbc.tar.bz2
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>
-rw-r--r--drivers/mtd/nand/mxc_nand_spl.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mtd/nand/mxc_nand_spl.c b/drivers/mtd/nand/mxc_nand_spl.c
index 09f23c3..5608352 100644
--- a/drivers/mtd/nand/mxc_nand_spl.c
+++ b/drivers/mtd/nand/mxc_nand_spl.c
@@ -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) {}