From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] ARM i.MX flash header: Fix barebox image sizes
Date: Fri, 23 Mar 2012 09:02:42 +0100 [thread overview]
Message-ID: <1332489762-28709-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1332489762-28709-1-git-send-email-s.hauer@pengutronix.de>
The image sizes have been hardcoded to 256K. This is inefficient
for smaller images and nonfunctional for bigger images. Calculate
the image size during compile time and use it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 5 +----
| 2 +-
| 4 +---
arch/arm/boards/freescale-mx25-3-stack/3stack.c | 5 +----
| 2 +-
| 4 +---
| 2 +-
| 2 +-
| 2 +-
| 10 ++++++++++
10 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 1e45779..1e48650 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -49,7 +49,6 @@
#include <mach/devices-imx25.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
extern void exception_vectors(void);
void __naked __flash_header_start go(void)
@@ -84,9 +83,7 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-extern unsigned long __bss_start;
-
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
static struct fec_platform_data fec_info = {
.xcv_type = RMII,
--git a/arch/arm/boards/eukrea_cpuimx35/flash_header.c b/arch/arm/boards/eukrea_cpuimx35/flash_header.c
index f8ed5d4..a745442 100644
--- a/arch/arm/boards/eukrea_cpuimx35/flash_header.c
+++ b/arch/arm/boards/eukrea_cpuimx35/flash_header.c
@@ -42,4 +42,4 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
--git a/arch/arm/boards/eukrea_cpuimx51/flash_header.c b/arch/arm/boards/eukrea_cpuimx51/flash_header.c
index ac6bbdc..81bd442 100644
--- a/arch/arm/boards/eukrea_cpuimx51/flash_header.c
+++ b/arch/arm/boards/eukrea_cpuimx51/flash_header.c
@@ -2,8 +2,6 @@
#include <mach/imx-flash-header.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
-
void __naked __flash_header_start go(void)
{
barebox_arm_head();
@@ -82,4 +80,4 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof (dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
index f684864..c63467a 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
@@ -45,7 +45,6 @@
#include <mach/devices-imx25.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
extern void exception_vectors(void);
void __naked __flash_header_start go(void)
@@ -107,9 +106,7 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-extern unsigned long __bss_start;
-
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
static struct fec_platform_data fec_info = {
.xcv_type = RMII,
--git a/arch/arm/boards/freescale-mx35-3-stack/flash_header.c b/arch/arm/boards/freescale-mx35-3-stack/flash_header.c
index 85b52a2..0786836 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/flash_header.c
+++ b/arch/arm/boards/freescale-mx35-3-stack/flash_header.c
@@ -70,5 +70,5 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof(dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
--git a/arch/arm/boards/freescale-mx51-pdk/flash_header.c b/arch/arm/boards/freescale-mx51-pdk/flash_header.c
index 297dca1..c148eea 100644
--- a/arch/arm/boards/freescale-mx51-pdk/flash_header.c
+++ b/arch/arm/boards/freescale-mx51-pdk/flash_header.c
@@ -2,8 +2,6 @@
#include <mach/imx-flash-header.h>
#include <asm/barebox-arm-head.h>
-extern unsigned long _stext;
-
void __naked __flash_header_start go(void)
{
barebox_arm_head();
@@ -82,5 +80,5 @@ struct imx_flash_header __flash_header_section flash_header = {
.dcd_block_len = sizeof (dcd_entry),
};
-unsigned long __image_len_section barebox_len = 0x40000;
+unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
--git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c
index b459640..52e6eee 100644
--- a/arch/arm/boards/freescale-mx53-loco/flash_header.c
+++ b/arch/arm/boards/freescale-mx53-loco/flash_header.c
@@ -90,7 +90,7 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
.self = APP_DEST + 0x400,
.boot_data.start = APP_DEST,
- .boot_data.size = 0x40000,
+ .boot_data.size = DCD_BAREBOX_SIZE,
.dcd.header.tag = DCD_HEADER_TAG,
.dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
--git a/arch/arm/boards/freescale-mx53-smd/flash_header.c b/arch/arm/boards/freescale-mx53-smd/flash_header.c
index b459640..52e6eee 100644
--- a/arch/arm/boards/freescale-mx53-smd/flash_header.c
+++ b/arch/arm/boards/freescale-mx53-smd/flash_header.c
@@ -90,7 +90,7 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
.self = APP_DEST + 0x400,
.boot_data.start = APP_DEST,
- .boot_data.size = 0x40000,
+ .boot_data.size = DCD_BAREBOX_SIZE,
.dcd.header.tag = DCD_HEADER_TAG,
.dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
--git a/arch/arm/boards/tqma53/flash_header.c b/arch/arm/boards/tqma53/flash_header.c
index 73ea0c3..f5e817c 100644
--- a/arch/arm/boards/tqma53/flash_header.c
+++ b/arch/arm/boards/tqma53/flash_header.c
@@ -97,7 +97,7 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
.self = APP_DEST + 0x400,
.boot_data.start = APP_DEST,
- .boot_data.size = 0x40000,
+ .boot_data.size = DCD_BAREBOX_SIZE,
.dcd.header.tag = DCD_HEADER_TAG,
.dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
--git a/arch/arm/mach-imx/include/mach/imx-flash-header.h b/arch/arm/mach-imx/include/mach/imx-flash-header.h
index 8744262..ca2fe9f 100644
--- a/arch/arm/mach-imx/include/mach/imx-flash-header.h
+++ b/arch/arm/mach-imx/include/mach/imx-flash-header.h
@@ -1,6 +1,8 @@
#ifndef __MACH_FLASH_HEADER_H
#define __MACH_FLASH_HEADER_H
+#include <asm-generic/sections.h>
+
#define __flash_header_start __section(.flash_header_start)
#if defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_NOR)
@@ -87,6 +89,14 @@ struct imx_flash_header {
#define DCD_COMMAND_WRITE_TAG 0xcc
#define DCD_COMMAND_WRITE_PARAM 0x04
+/*
+ * At least on i.MX5 the ROM copies only full blocks. Unfortunately
+ * it does not round up to the next full block, we have to do it
+ * ourselves. Use 4095 which should be enough for the largest NAND
+ * pages.
+ */
+#define DCD_BAREBOX_SIZE (barebox_image_size + 4095)
+
struct imx_ivt_header {
uint8_t tag;
__be16 length;
--
1.7.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2012-03-23 8:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 8:02 fix i.MX flash header copy sizes Sascha Hauer
2012-03-23 8:02 ` [PATCH 1/2] ARM linker script: Fix barebox_image_size Sascha Hauer
2012-03-23 8:02 ` Sascha Hauer [this message]
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=1332489762-28709-3-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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