public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Marek Behún" <marek.behun@nic.cz>, u-boot@lists.denx.de
Subject: [PATCH 1/3] tools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images
Date: Fri, 22 Oct 2021 12:37:46 +0200	[thread overview]
Message-ID: <20211022103748.25651-2-pali@kernel.org> (raw)
In-Reply-To: <20211022103748.25651-1-pali@kernel.org>

The NAND_PAGE_SIZE command is already supported by mkimage for v0 images,
but not for v1 images.

A38x and A39x BootROM supports reading NAND flash page size from v1 image
in the same way as Kirkwood BootROM from v0 image. It it documented in A38x
and A39x Functional Specification.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 tools/kwbimage.c | 3 +++
 tools/kwbimage.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index e9324baddba4..67c0c628ae9f 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1231,6 +1231,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 	e = image_find_option(IMAGE_CFG_NAND_BLKSZ);
 	if (e)
 		main_hdr->nandblocksize = e->nandblksz / (64 * 1024);
+	e = image_find_option(IMAGE_CFG_NAND_PAGESZ);
+	if (e)
+		main_hdr->nandpagesize = cpu_to_le16(e->nandpagesz);
 	e = image_find_option(IMAGE_CFG_NAND_BADBLK_LOCATION);
 	if (e)
 		main_hdr->nandbadblklocation = e->nandbadblklocation;
diff --git a/tools/kwbimage.h b/tools/kwbimage.h
index 126d482fe722..f1ba95c2fa5b 100644
--- a/tools/kwbimage.h
+++ b/tools/kwbimage.h
@@ -73,7 +73,7 @@ struct ext_hdr_v0 {
 struct main_hdr_v1 {
 	uint8_t  blockid;               /* 0x0       */
 	uint8_t  flags;                 /* 0x1       */
-	uint16_t reserved2;             /* 0x2-0x3   */
+	uint16_t nandpagesize;          /* 0x2-0x3   */
 	uint32_t blocksize;             /* 0x4-0x7   */
 	uint8_t  version;               /* 0x8       */
 	uint8_t  headersz_msb;          /* 0x9       */
-- 
2.20.1


  reply	other threads:[~2021-10-22 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 10:37 [PATCH 0/3] arm: mvebu: nandpagesize support for kwbimage v1 Pali Rohár
2021-10-22 10:37 ` Pali Rohár [this message]
2021-10-26  4:46   ` [PATCH 1/3] tools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images Stefan Roese
2021-10-22 10:37 ` [PATCH 2/3] tools: kwboot: Patch nandpagesize to zero also for v1 image Pali Rohár
2021-10-26  4:47   ` Stefan Roese
2021-10-22 10:37 ` [PATCH 3/3] arm: mvebu: Update name of kwbimage v1 field at offset 0x2-0x3 Pali Rohár
2021-10-26  4:47   ` Stefan Roese
2021-10-28 10:49 ` [PATCH 0/3] arm: mvebu: nandpagesize support for kwbimage v1 Stefan Roese

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=20211022103748.25651-2-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=sr@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