public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/6] imx: Align the imximage header and payload to multiples of 4k
@ 2013-04-19  4:10 Marek Vasut
  2013-04-19  4:10 ` [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl Marek Vasut
                   ` (5 more replies)
  0 siblings, 6 replies; 58+ messages in thread
From: Marek Vasut @ 2013-04-19  4:10 UTC (permalink / raw)
  To: u-boot

The MX53 ROM loads the data from NAND in multiples of pages and
supports maximum page size of 4k. Thus, align the image and header
to 4k to be safe from ROM bugs.

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>
---
 tools/imximage.c | 11 +++++++----
 tools/imximage.h |  3 ++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index fa308c9..c018562 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -518,11 +518,14 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
 
 	/*
 	 * ROM bug alert
-	 * mx53 only loads 512 byte multiples.
-	 * The remaining fraction of a block bytes would
-	 * not be loaded.
+	 *
+	 * MX53 only loads 512 byte multiples in case of SD boot.
+	 * MX53 only loads NAND page multiples in case of NAND boot and
+	 * supports up to 4096 byte large pages, thus align to 4096.
+	 *
+	 * The remaining fraction of a block bytes would not be loaded!
 	 */
-	*header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 512);
+	*header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 4096);
 }
 
 int imximage_check_params(struct mkimage_params *params)
diff --git a/tools/imximage.h b/tools/imximage.h
index 42b6090..dfd2e9e 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -151,13 +151,14 @@ typedef struct {
 	dcd_v2_t dcd_table;
 } imx_header_v2_t;
 
+/* The header must be aligned to 4k on MX53 for NAND boot */
 struct imx_header {
 	union {
 		imx_header_v1_t hdr_v1;
 		imx_header_v2_t hdr_v2;
 	} header;
 	uint32_t flash_offset;
-};
+} __attribute__((aligned(4096)));
 
 typedef void (*set_dcd_val_t)(struct imx_header *imxhdr,
 					char *name, int lineno,
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2013-05-05 16:06 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl Marek Vasut
2013-04-19  8:38   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox