[PATCH] i.MX: scripts: Fix a bug in imx-image

Andrey Smirnov andrew.smirnov at gmail.com
Sun Sep 4 16:40:02 PDT 2016


In order to clear a bitmask, "Set" bit has to be '0' and "Mask" bit
'1'. Since "Set" is bit 4 and "Mask" is bit 3 this leaves us with a
overal or-mask of 1 << 3. Orginal code was doing the inverse and setting
bit #4 to '1' bit #3 to '0'.

Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 scripts/imx/imx-image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 3f62228..10aa4c1 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -380,7 +380,7 @@ static int write_mem_v2(uint32_t addr, uint32_t val, int width, int set_bits, in
 	if (set_bits)
 		cmd |= 3 << 3;
 	if (clear_bits)
-		cmd |= 2 << 3;
+		cmd |= 1 << 3;
 
 	if (curdcd > MAX_DCD - 3) {
 		fprintf(stderr, "At maximum %d dcd entried are allowed\n", MAX_DCD);
-- 
2.5.5




More information about the barebox mailing list