mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] i.MX: scripts: Fix a bug in imx-image
@ 2016-09-04 23:40 Andrey Smirnov
  2016-09-05  6:46 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2016-09-04 23:40 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i.MX: scripts: Fix a bug in imx-image
  2016-09-04 23:40 [PATCH] i.MX: scripts: Fix a bug in imx-image Andrey Smirnov
@ 2016-09-05  6:46 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-09-05  6:46 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Sun, Sep 04, 2016 at 04:40:02PM -0700, Andrey Smirnov wrote:
> 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'.

Yeah, right. I just had a look at the i.MX53 reference manual and I
probably was confused by the description table which describes the bits
in the order I used them in the code.

Applied, thanks

Sascha

> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@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
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-05  6:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 23:40 [PATCH] i.MX: scripts: Fix a bug in imx-image Andrey Smirnov
2016-09-05  6:46 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox