public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eli Billauer <eli.billauer@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fpga: zynqpl: Fixed bug in alignment routine
Date: Sat, 15 Mar 2014 22:40:29 +0200	[thread overview]
Message-ID: <1394916029-12079-1-git-send-email-eli.billauer@gmail.com> (raw)

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

             reply	other threads:[~2014-03-15 20:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-15 20:40 Eli Billauer [this message]
2014-03-18  6:11 ` [U-Boot] [PATCH] fpga: zynqpl: Fixed bug in alignment routine 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394916029-12079-1-git-send-email-eli.billauer@gmail.com \
    --to=eli.billauer@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox