[U-Boot] [PATCH] Fix bug in io64 target (introduced by commit aba27ac)

From comparison of current logic and the logic that was prior to commit
aba27ac, we see that first parameter of FPGA_GET_REG() shall be the FPGA index and not channel number. The re-factoring in commit aba27ac accidentally changed that.
Signed-off-by: Vasili Galka vvv444@gmail.com Cc: Dirk Eibach dirk.eibach@gdsys.cc, Stefan Roese sr@denx.de --- board/gdsys/405ex/io64.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/gdsys/405ex/io64.c b/board/gdsys/405ex/io64.c index 2f8e306..3a075c4 100644 --- a/board/gdsys/405ex/io64.c +++ b/board/gdsys/405ex/io64.c @@ -287,7 +287,7 @@ int last_stage_init(void) for (fpga = 0; fpga < 2; ++fpga) { for (k = 0; k < 32; ++k) { u16 status; - FPGA_GET_REG(k, ch[k].status_int, &status); + FPGA_GET_REG(fpga, ch[k].status_int, &status); if (!(status & (1 << 4))) { failed = 1; printf("fpga %d channel %d: no serdes lock\n", @@ -304,7 +304,7 @@ int last_stage_init(void) for (fpga = 0; fpga < 2; ++fpga) { for (k = 0; k < 32; ++k) { u16 status; - FPGA_GET_REG(k, hicb_ch[k].status_int, &status); + FPGA_GET_REG(fpga, hicb_ch[k].status_int, &status); if (status) printf("fpga %d hicb %d: hicb status %04x\n", fpga, k, status);

Heh. Good catch. thanks! But now I'm curious: how did you find this?
Acked-by: dirk.eibach@gdsys.cc
Cheers Dirk

Hi Dirk,
On Tue, Jun 17, 2014 at 9:18 AM, Dirk Eibach dirk.eibach@gdsys.cc wrote:
Heh. Good catch. thanks! But now I'm curious: how did you find this?
Acked-by: dirk.eibach@gdsys.cc
Cheers Dirk
I had the following compiler warning (and I actually don't understand why it was generated here):
In file included from /home/lab/dev/uboot/board/gdsys/405ex/io64.c:25:0: /home/lab/dev/uboot/board/gdsys/405ex/io64.c: In function 'last_stage_init': /home/lab/dev/uboot/include/gdsys_fpga.h:35:17: warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations] &fpga_ptr[ix]->fld, \ ^ /home/lab/dev/uboot/board/gdsys/405ex/io64.c:307:4: note: in expansion of macro 'FPGA_GET_REG' FPGA_GET_REG(k, hicb_ch[k].status_int, &status); ^ /home/lab/dev/uboot/board/gdsys/405ex/io64.c:305:3: note: containing loop for (k = 0; k < 32; ++k) { ^
So I had to look on the code...
Best, Vasili

On Mon, Jun 16, 2014 at 05:40:59PM +0300, Vasili Galka wrote:
From comparison of current logic and the logic that was prior to commit aba27ac, we see that first parameter of FPGA_GET_REG() shall be the FPGA index and not channel number. The re-factoring in commit aba27ac accidentally changed that.
Signed-off-by: Vasili Galka vvv444@gmail.com Cc: Dirk Eibach dirk.eibach@gdsys.cc, Stefan Roese sr@denx.de
Applied to u-boot/master (and updated commit message to have an acked-by from Dirk), thanks!
participants (3)
-
Dirk Eibach
-
Tom Rini
-
Vasili Galka