1 /* SPDX-License-Identifier: BSD-2-Clause */
3 * Renesas RZ/N1 Package Table format
4 * (C) 2015-2016 Renesas Electronics Europe, LTD
7 * Converted to mkimage plug-in
8 * (C) Copyright 2022 Schneider Electric
14 #include <linux/compiler_attributes.h>
16 #define SPKG_HEADER_MARKER {'R', 'Z', 'N', '1'}
17 #define SPKG_HEADER_SIZE 24
18 #define SPKG_HEADER_COUNT 8
19 #define SPKG_BLP_SIZE 264
20 #define SPKG_CRC_SIZE 4
23 * struct spkg_hdr - SPKG header
24 * @marker: magic pattern "RZN1"
25 * @version: header version (currently 1)
26 * @ecc: ECC enable and block size.
27 * @ecc_scheme: ECC algorithm selction
28 * @ecc_bytes: ECC bytes per block
29 * @payload_length: length of the payload (including CRC)
30 * @load_address: address in memory where payload should be loaded
31 * @execution_offset: offset from @load_address where execution starts
32 * @crc: 32-bit CRC of the above header fields
34 * SPKG header format is defined by Renesas. It is documented in the Reneasas
35 * RZ/N1 User Manual, Chapter 7.4 ("SPKG format").
37 * The BootROM searches this header in order to find and validate the boot
38 * payload. It is therefore mandatory to wrap the payload in this header.
40 * The ECC-related fields @ecc @ecc_scheme @ecc_bytes are used only when
41 * booting from NAND flash, and they are only used while fetching the payload.
42 * These values are used to initialize the ECC controller. To avoid using
43 * non-portable bitfields, struct spkg_hdr uses uint8_t for these fields, so
44 * the user must shift the values into the correct spot.
46 * The payload will be loaded into memory at @payload_address.
47 * Execution then jumps to @payload_address + @execution_offset.
48 * The LSB of @execution_offset selects between ARM and Thumb mode,
49 * as per the usual ARM interworking convention.
52 uint8_t marker[4]; /* aka magic */
57 uint32_t payload_length; /* only HIGHER 24 bits */
58 uint32_t load_address;
59 uint32_t execution_offset;
60 uint32_t crc; /* of this header */
64 * struct spkg_file - complete SPKG image
66 * A SPKG image consists of 8 identical copies of struct spkg_hdr, each one
67 * occupying 24 bytes, for a total of 192 bytes.
69 * This is followed by the payload (the u-boot binary), and a 32-bit CRC.
71 * Optionally, the payload can be being with security header ("BLp_header").
72 * This feature is not currently supported in mkimage.
74 * The payload is typically padded with 0xFF bytes so as to bring the total
75 * image size to a multiple of the flash erase size (often 64kB).
78 struct spkg_hdr header[SPKG_HEADER_COUNT];