From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl
Date: Fri, 19 Apr 2013 06:10:51 +0200 [thread overview]
Message-ID: <1366344655-8535-2-git-send-email-marex@denx.de> (raw)
In-Reply-To: <1366344655-8535-1-git-send-email-marex@denx.de>
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
old function which are used with the nand_spl/ stuff getting in
the way of NAND SPL framework, the macro CONFIG_SPL_NAND_LEGACY
was introduced and two remaining legacy boards were adjusted.
These board need to be either fixed or removed in the long run,
but I don't have either.
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>
---
drivers/mtd/nand/mxc_nand_spl.c | 13 ++++++++++---
include/configs/mx31pdk.h | 1 +
include/configs/tx25.h | 1 +
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/mxc_nand_spl.c b/drivers/mtd/nand/mxc_nand_spl.c
index 09f23c3..8ff03c9 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;
}
+#ifdef CONFIG_SPL_NAND_SUPPORT_LEGACY
/*
* 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) {}
diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
index 1754595..217552e 100644
--- a/include/configs/mx31pdk.h
+++ b/include/configs/mx31pdk.h
@@ -50,6 +50,7 @@
#define CONFIG_SPL_LDSCRIPT "arch/$(ARCH)/cpu/u-boot-spl.lds"
#define CONFIG_SPL_MAX_SIZE 2048
#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT_LEGACY
#define CONFIG_SPL_TEXT_BASE 0x87dc0000
#define CONFIG_SYS_TEXT_BASE 0x87e00000
diff --git a/include/configs/tx25.h b/include/configs/tx25.h
index e72f8f6..7c362d0 100644
--- a/include/configs/tx25.h
+++ b/include/configs/tx25.h
@@ -37,6 +37,7 @@
#define CONFIG_SPL_LDSCRIPT "arch/$(ARCH)/cpu/u-boot-spl.lds"
#define CONFIG_SPL_MAX_SIZE 2048
#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT_LEGACY
#define CONFIG_SPL_TEXT_BASE 0x810c0000
#define CONFIG_SYS_TEXT_BASE 0x81200000
--
1.7.11.7
next prev parent reply other threads:[~2013-04-19 4:10 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 4:10 [U-Boot] [PATCH 1/6] imx: Align the imximage header and payload to multiples of 4k Marek Vasut
2013-04-19 4:10 ` Marek Vasut [this message]
2013-04-19 8:38 ` [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl Benoît Thébaudeau
2013-04-19 9:35 ` Benoît Thébaudeau
2013-04-19 11:14 ` Marek Vasut
2013-04-19 11:55 ` Benoît Thébaudeau
2013-04-19 13:46 ` Benoît Thébaudeau
2013-04-19 17:08 ` Marek Vasut
2013-04-20 13:00 ` Benoît Thébaudeau
2013-04-19 17:06 ` Marek Vasut
2013-04-20 13:06 ` Benoît Thébaudeau
2013-04-20 17:09 ` Marek Vasut
2013-04-19 13:00 ` Philip Paeps
2013-04-19 14:48 ` Philip Paeps
2013-04-19 14:53 ` Benoît Thébaudeau
2013-04-19 15:09 ` Philip Paeps
2013-04-19 15:21 ` Benoît Thébaudeau
2013-04-19 15:28 ` Benoît Thébaudeau
2013-04-19 15:41 ` Philip Paeps
2013-04-19 16:20 ` Tom Rini
2013-04-19 17:11 ` Marek Vasut
2013-04-19 4:10 ` [U-Boot] [PATCH 3/6] arm: imx: Fix u-boot-with-nand-spl.imx target Marek Vasut
2013-04-19 8:56 ` Benoît Thébaudeau
2013-04-19 11:16 ` Marek Vasut
2013-04-19 11:42 ` Benoît Thébaudeau
2013-04-19 11:51 ` Marek Vasut
2013-04-19 11:55 ` Tom Rini
2013-04-19 17:04 ` Marek Vasut
2013-04-19 4:10 ` [U-Boot] [PATCH 4/6] arm: mx5: Add SPL support code to MX5 Marek Vasut
2013-04-19 9:03 ` Benoît Thébaudeau
2013-04-19 13:10 ` Philip Paeps
2013-04-20 10:28 ` Marek Vasut
2013-04-21 0:38 ` Marek Vasut
2013-05-05 16:06 ` Stefano Babic
2013-04-19 4:10 ` [U-Boot] [PATCH 5/6] arm: mx5: Add NAND clock handling Marek Vasut
2013-04-19 9:02 ` Benoît Thébaudeau
2013-04-19 9:08 ` Benoît Thébaudeau
2013-04-19 11:18 ` Marek Vasut
2013-04-19 11:32 ` Benoît Thébaudeau
2013-05-05 16:04 ` Stefano Babic
2013-04-19 4:10 ` [U-Boot] [PATCH 6/6] arm: mx5: Add support for DENX M53EVK Marek Vasut
2013-04-19 5:52 ` Wolfgang Denk
2013-04-19 11:58 ` Marek Vasut
2013-04-19 12:58 ` Wolfgang Denk
2013-04-21 0:43 ` Marek Vasut
2013-04-21 6:35 ` Wolfgang Denk
2013-04-21 14:42 ` Marek Vasut
2013-04-21 22:13 ` Wolfgang Denk
2013-04-21 23:09 ` Marek Vasut
2013-04-22 11:19 ` Wolfgang Denk
2013-04-25 19:07 ` Marek Vasut
2013-04-19 9:22 ` Benoît Thébaudeau
2013-04-19 11:44 ` Marek Vasut
2013-04-19 12:54 ` Benoît Thébaudeau
2013-04-19 13:56 ` Benoît Thébaudeau
2013-04-19 14:49 ` Fabio Estevam
2013-04-21 2:32 ` Marek Vasut
2013-04-19 8:15 ` [U-Boot] [PATCH 1/6] imx: Align the imximage header and payload to multiples of 4k Benoît Thébaudeau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366344655-8535-2-git-send-email-marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox