imx: imximage: add new CHECK/CLR BIT command
* Extend imximage DCD version 2 to support DCD commands
CMD_WRITE_CLR_BIT 4 [address] [mask bit] means:
while ((*address & ~mask) != 0);
CMD_CHECK_BITS_SET 4 [address] [mask bit] means:
while ((*address & mask) != mask);
CMD_CHECK_BITS_CLR 4 [address] [mask bit] means:
*address = *address & ~mask;
* Add set_dcd_param_v2 helper function to set DCD
command parameters
Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
diff --git a/tools/imximage.h b/tools/imximage.h
index a913329..d41c74f 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -42,19 +42,27 @@
#define FLASH_LOADSIZE_SATA FLASH_LOADSIZE_STANDARD
#define FLASH_LOADSIZE_QSPI 0x0 /* entire image */
-#define IVT_HEADER_TAG 0xD1
-#define IVT_VERSION 0x40
-#define DCD_HEADER_TAG 0xD2
-#define DCD_COMMAND_TAG 0xCC
-#define DCD_VERSION 0x40
-#define DCD_COMMAND_PARAM 0x4
+/* Command tags and parameters */
+#define IVT_HEADER_TAG 0xD1
+#define IVT_VERSION 0x40
+#define DCD_HEADER_TAG 0xD2
+#define DCD_VERSION 0x40
+#define DCD_WRITE_DATA_COMMAND_TAG 0xCC
+#define DCD_WRITE_DATA_PARAM 0x4
+#define DCD_WRITE_CLR_BIT_PARAM 0xC
+#define DCD_CHECK_DATA_COMMAND_TAG 0xCF
+#define DCD_CHECK_BITS_SET_PARAM 0x14
+#define DCD_CHECK_BITS_CLR_PARAM 0x04
enum imximage_cmd {
CMD_INVALID,
CMD_IMAGE_VERSION,
CMD_BOOT_FROM,
CMD_BOOT_OFFSET,
- CMD_DATA,
+ CMD_WRITE_DATA,
+ CMD_WRITE_CLR_BIT,
+ CMD_CHECK_BITS_SET,
+ CMD_CHECK_BITS_CLR,
CMD_CSF,
};
@@ -168,6 +176,9 @@
int fld, uint32_t value,
uint32_t off);
+typedef void (*set_dcd_param_t)(struct imx_header *imxhdr, uint32_t dcd_len,
+ int32_t cmd);
+
typedef void (*set_dcd_rst_t)(struct imx_header *imxhdr,
uint32_t dcd_len,
char *name, int lineno);