All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fpga: zynqpl: Fixed bug in alignment routine
@ 2014-03-15 20:40 Eli Billauer
  2014-03-18  6:11 ` S Durga Prasad Paladugu
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Billauer @ 2014-03-15 20:40 UTC (permalink / raw)
  To: u-boot

The aligned buffer is always with a higher address, so copying should run
from the end of the buffer to the beginning, and not the other way around.

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
---
 drivers/fpga/zynqpl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c
index 160abc7..2888131 100644
--- a/drivers/fpga/zynqpl.c
+++ b/drivers/fpga/zynqpl.c
@@ -173,7 +173,8 @@ int zynq_load(Xilinx_desc *desc, const void *buf, size_t bsize)
 {
 	unsigned long ts; /* Timestamp */
 	u32 partialbit = 0;
-	u32 i, control, isr_status, status, swap, diff;
+	u32 control, isr_status, status, swap, diff;
+	int i;
 	u32 *buf_start;
 
 	/* Detect if we are going working with partial or full bitstream */
@@ -206,7 +207,7 @@ int zynq_load(Xilinx_desc *desc, const void *buf, size_t bsize)
 		printf("%s: Align buffer at %x to %x(swap %d)\n", __func__,
 		       (u32)buf_start, (u32)new_buf, swap);
 
-		for (i = 0; i < (bsize/4); i++)
+		for (i = (bsize/4)-1; i >= 0 ; i--)
 			new_buf[i] = load_word(&buf_start[i], swap);
 
 		swap = SWAP_DONE;
-- 
1.7.2.3

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

end of thread, other threads:[~2014-03-19  5:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-15 20:40 [U-Boot] [PATCH] fpga: zynqpl: Fixed bug in alignment routine Eli Billauer
2014-03-18  6:11 ` S Durga Prasad Paladugu
2014-03-18 10:20   ` Eli Billauer
2014-03-18 12:17     ` Michal Simek
2014-03-18 21:14       ` Eli Billauer
2014-03-19  5:50         ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.