tools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images
authorPali Rohár <pali@kernel.org>
Fri, 22 Oct 2021 10:37:46 +0000 (12:37 +0200)
committerStefan Roese <sr@denx.de>
Thu, 28 Oct 2021 08:33:32 +0000 (10:33 +0200)
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>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwbimage.c
tools/kwbimage.h

index e9324ba..67c0c62 100644 (file)
@@ -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;
index 126d482..f1ba95c 100644 (file)
@@ -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       */