9
0
Fork 0

scripts imx-image: add DCD NOP command support

The DCD NOP command is available for all flash header v2 devices (i.MX28,
50, 53, 6 and 7).

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Alexander Kurz 2016-11-03 19:32:37 +01:00 committed by Sascha Hauer
parent 91a55bc00f
commit c3223f98c0
4 changed files with 41 additions and 0 deletions

View File

@ -32,6 +32,7 @@ check <width> <cond> <addr> <mask> Poll until condition becomes true.
while_any_bit_set
set_bits <width> <addr> <bits> set <bits> in register <addr>
clear_bits <width> <addr> <bits> clear <bits> in register <addr>
nop do nothing
the i.MX SoCs support a wide range of fancy things doing with the flash header.
We limit ourselves to a very simple case, that is the flash header has a fixed

View File

@ -482,6 +482,33 @@ static int write_mem(const struct config_data *data, uint32_t addr,
}
}
static int nop(const struct config_data *data)
{
const struct imx_ivt_header nop_header = {
.tag = TAG_NOP,
.length = htobe16(4),
.version = 0,
};
switch (data->header_version) {
case 1:
fprintf(stderr, "DCD command NOP not implemented on DCD v1\n");
return -EINVAL;
case 2:
if (curdcd > MAX_DCD - 1) {
fprintf(stderr, "At maximum %d DCD entries allowed\n",
MAX_DCD);
return -ENOMEM;
}
check_last_dcd(*((uint32_t *) &nop_header));
dcdtable[curdcd++] = *((uint32_t *) &nop_header);
return 0;
default:
return -EINVAL;
}
}
/*
* This uses the Freescale Code Signing Tool (CST) to sign the image.
* The cst is expected to be executable as 'cst' or if exists, the content
@ -653,6 +680,7 @@ int main(int argc, char *argv[])
.image_dcd_offset = 0xffffffff,
.write_mem = write_mem,
.check = check,
.nop = nop,
};
prgname = argv[0];

View File

@ -131,6 +131,14 @@ static int do_cmd_check(struct config_data *data, int argc, char *argv[])
return data->check(data, cmd, addr, mask);
}
static int do_cmd_nop(struct config_data *data, int argc, char *argv[])
{
if (!data->nop)
return -ENOSYS;
return data->nop(data);
}
static int write_mem(struct config_data *data, int argc, char *argv[],
int set_bits, int clear_bits)
{
@ -364,6 +372,9 @@ struct command cmds[] = {
}, {
.name = "check",
.parse = do_cmd_check,
}, {
.name = "nop",
.parse = do_cmd_nop,
}, {
.name = "loadaddr",
.parse = do_loadaddr,

View File

@ -77,6 +77,7 @@ struct config_data {
uint32_t addr, uint32_t mask);
int (*write_mem)(const struct config_data *data, uint32_t addr,
uint32_t val, int width, int set_bits, int clear_bits);
int (*nop)(const struct config_data *data);
int csf_space;
char *csf;
};