From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] ARM: i.MX5: internal NAND update: Use variables for some constants
Date: Thu, 24 Jul 2014 08:48:12 +0200 [thread overview]
Message-ID: <1406184493-29225-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1406184493-29225-1-git-send-email-s.hauer@pengutronix.de>
Instead oof using the same constants multiple times use a variable
to make the meaning of the constants clear.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/imx-bbu-internal.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index a5cb7e7..d90d92b 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -178,6 +178,9 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler *
uint32_t *ptr, *num_bb, *bb;
uint64_t offset;
int block = 0, len, now, blocksize;
+ int dbbt_start_page = 4;
+ int firmware_start_page = 12;
+ void *dbbt_base;
int pre_image_size;
ret = stat(data->devicefile, &s);
@@ -194,7 +197,7 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler *
if (ret)
goto out;
- pre_image_size = 12 * meminfo.writesize;
+ pre_image_size = firmware_start_page * meminfo.writesize;
blocksize = meminfo.erasesize;
@@ -203,23 +206,24 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler *
*ptr++ = 1; /* FCB version */
ptr = image + 0x68; /* Firmware start page */
- *ptr = 12;
+ *ptr = firmware_start_page;
ptr = image + 0x78; /* DBBT start page */
- *ptr = 4;
+ *ptr = dbbt_start_page;
- ptr = image + 4 * 2048 + 4;
+ dbbt_base = image + dbbt_start_page * meminfo.writesize;
+ ptr = dbbt_base + 4;
*ptr++ = DBBT_MAGIC; /* DBBT */
*ptr = 1; /* DBBT version */
- ptr = (u32*)(image + 0x2010);
+ ptr = (u32*)(dbbt_base + 0x10);
/*
* This is marked as reserved in the i.MX53 reference manual, but
* must be != 0. Otherwise the ROM ignores the DBBT
*/
*ptr = 1;
- ptr = (u32*)(image + 0x4004); /* start of DBBT */
+ ptr = (u32*)(dbbt_base + 4 * meminfo.writesize + 4); /* start of DBBT */
num_bb = ptr;
bb = ptr + 1;
offset = 0;
--
2.0.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-07-24 6:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 6:48 [PATCH] i.MX5 internal NAND update fixes/cleanup Sascha Hauer
2014-07-24 6:48 ` [PATCH 1/4] ARM: i.MX5: internal NAND update: Use variable for pre_image_size Sascha Hauer
2014-07-24 6:48 ` [PATCH 2/4] ARM: i.MX5: internal NAND update: Fix firmware start page for internal nand boot Sascha Hauer
2014-07-24 6:48 ` Sascha Hauer [this message]
2014-07-24 6:48 ` [PATCH 4/4] ARM: i.MX5: internal NAND update: simplify code Sascha Hauer
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=1406184493-29225-4-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