summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJuergen Borleis <jbe@pengutronix.de>2018-03-23 09:43:51 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-03-26 09:23:21 +0200
commitf04deb4018a2df204e16fc13c74028120cdb60a6 (patch)
tree1f97528de964704199937c87d956003095cad0c6 /scripts
parent971366078893a669246a52e6058d47de9993e77e (diff)
downloadbarebox-f04deb4018a2df204e16fc13c74028120cdb60a6.tar.gz
barebox-f04deb4018a2df204e16fc13c74028120cdb60a6.tar.xz
i.MX/DCD compiler and interpreter: logic is different
Reading the manual more carefully discovers a different logic for the DCD 'check' command. They use the term "until". In order to get the manual and the software in sync, this change switches to the term "until" as well. Changing must happen at compiler and interpreter level to make it work. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/imx/README30
-rw-r--r--scripts/imx/imx-usb-loader.c24
-rw-r--r--scripts/imx/imx.c16
-rw-r--r--scripts/imx/imx.h8
4 files changed, 28 insertions, 50 deletions
diff --git a/scripts/imx/README b/scripts/imx/README
index b5cdb487a0..d573d3a6be 100644
--- a/scripts/imx/README
+++ b/scripts/imx/README
@@ -7,34 +7,12 @@ The imx-usb-loader tool is used to upload and start i.MX images. These
are images containing a DCD (Device Configuration Data) table. To generate
these images from raw binaries use the imx-image tool.
-imx-image
----------
+Refer the i.MX related documentation about the DCD source files and their
+content.
-The imx-image tool can be used to generate imximages from raw binaries.
-It requires an configuration file describing how to setup the SDRAM on
-a particular board. This mainly consists of a poke table. The recognized
-options in this file are:
+Example for a DCD source file:
-soc <soctype> soctype can be one of imx35, imx51, imx53, imx6
-loadaddr <adr> The address the binary is uploaded to
-dcdofs <ofs> The offset of the image header in the image. This should be:
- 0x400 - MMC/SD, NAND, serial ROM, PATA, SATA
- 0x1000 - NOR Flash
- 0x100 - OneNAND
-wm 8 <adr> <value> do a byte memory write
-wm 16 <adr> <value> do a short memory write
-wm 32 <adr> <value> do a word memory write
-check <width> <cond> <addr> <mask> Poll until condition becomes true.
- with <cond> being one of:
- while_all_bits_clear,
- while_all_bits_set,
- while_any_bit_clear,
- 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.
+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
size of 0x1000 bytes. The application is expected right thereafter, so if you
specify a loadaddr of 0x80000000 in the config file, the first 0x1000 bytes
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 6052343e00..43dde8b7f2 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -935,10 +935,10 @@ static int do_dcd_v2_cmd_check(const unsigned char *dcd)
}
switch ((check->param & 0xf8) >> 3) {
- case check_all_bits_clear:
- case check_all_bits_set:
- case check_any_bit_clear:
- case check_any_bit_set:
+ case until_all_bits_clear:
+ case until_all_bits_set:
+ case until_any_bit_clear:
+ case until_any_bit_set:
cond = (check->param & 0xf8) >> 3;
break;
default:
@@ -966,20 +966,20 @@ static int do_dcd_v2_cmd_check(const unsigned char *dcd)
data &= mask;
switch (cond) {
- case check_all_bits_clear:
- if (data != 0)
+ case until_all_bits_clear:
+ if (data == 0)
return 0;
break;
- case check_all_bits_set:
- if (data != mask)
+ case until_all_bits_set:
+ if (data == mask)
return 0;
break;
- case check_any_bit_clear:
- if (data == mask)
+ case until_any_bit_clear:
+ if (data != mask)
return 0;
break;
- case check_any_bit_set:
- if (data == 0)
+ case until_any_bit_set:
+ if (data != 0)
return 0;
break;
}
diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c
index 809d8a7f71..fb6ac001e2 100644
--- a/scripts/imx/imx.c
+++ b/scripts/imx/imx.c
@@ -69,10 +69,10 @@ struct command {
};
static const char *check_cmds[] = {
- "while_all_bits_clear", /* while ((*address & mask) == 0); */
- "while_all_bits_set" , /* while ((*address & mask) == mask); */
- "while_any_bit_clear", /* while ((*address & mask) != mask); */
- "while_any_bit_set", /* while ((*address & mask) != 0); */
+ "until_all_bits_clear", /* until ((*address & mask) == 0) { }; */
+ "until_any_bit_clear", /* until ((*address & mask) != mask) { }; */
+ "until_all_bits_set", /* until ((*address & mask) == mask) { }; */
+ "until_any_bit_set", /* until ((*address & mask) != 0) { }; */
};
static void do_cmd_check_usage(void)
@@ -81,10 +81,10 @@ static void do_cmd_check_usage(void)
"usage: check <width> <cmd> <addr> <mask>\n"
"<width> access width in bytes [1|2|4]\n"
"with <cmd> one of:\n"
- "while_all_bits_clear: while ((*addr & mask) == 0)\n"
- "while_all_bits_set: while ((*addr & mask) == mask)\n"
- "while_any_bit_clear: while ((*addr & mask) != mask)\n"
- "while_any_bit_set: while ((*addr & mask) != 0)\n");
+ "until_all_bits_clear: while ((*addr & mask) == 0)\n"
+ "until_all_bits_set: while ((*addr & mask) == mask)\n"
+ "until_any_bit_clear: while ((*addr & mask) != mask)\n"
+ "until_any_bit_set: while ((*addr & mask) != 0)\n");
}
static int do_cmd_check(struct config_data *data, int argc, char *argv[])
diff --git a/scripts/imx/imx.h b/scripts/imx/imx.h
index f32ae52abf..c7677f81a4 100644
--- a/scripts/imx/imx.h
+++ b/scripts/imx/imx.h
@@ -105,10 +105,10 @@ struct imx_dcd_v2_check {
} __attribute__((packed));
enum imx_dcd_v2_check_cond {
- check_all_bits_clear = 0,
- check_all_bits_set = 1,
- check_any_bit_clear = 2,
- check_any_bit_set = 3,
+ until_all_bits_clear = 0, /* until ((*address & mask) == 0) { ...} */
+ until_any_bit_clear = 1, /* until ((*address & mask) != mask) { ...} */
+ until_all_bits_set = 2, /* until ((*address & mask) == mask) { ...} */
+ until_any_bit_set = 3, /* until ((*address & mask) != 0) { ...} */
} __attribute__((packed));
int parse_config(struct config_data *data, const char *filename);