public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 5/5 RESEND] Remove bit swapping in Xilinx Spartan bitfile loading
@ 2007-12-27 16:13 Matthias Fuchs
  2008-01-09 12:37 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Fuchs @ 2007-12-27 16:13 UTC (permalink / raw)
  To: u-boot

This patch removes the unnecessary bit swapping when
booting .bit files with the 'fpga loadb' command.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
 common/cmd_fpga.c |   37 +------------------------------------
 1 files changed, 1 insertions(+), 36 deletions(-)

diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index fb24395..f55447a 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -60,12 +60,9 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
 {
 #if defined(CONFIG_FPGA_XILINX)
 	unsigned int length;
-	unsigned char* swapdata;
 	unsigned int swapsize;
 	char buffer[80];
-	unsigned char *ptr;
 	unsigned char *dataptr;
-	unsigned char data;
 	unsigned int i;
 	int rc;
 
@@ -143,39 +140,7 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
 	dataptr+=4;
 	printf("  bytes in bitstream = %d\n", swapsize);
 
-	/* check consistency of length obtained */
-	if (swapsize >= size) {
-		printf("%s: Could not find right length of data in bitstream\n",
-			__FUNCTION__);
-		return FPGA_FAIL;
-	}
-
-	/* allocate memory */
-	swapdata = (unsigned char *)malloc(swapsize);
-	if (swapdata == NULL) {
-		printf("%s: Could not allocate %d bytes memory !\n",
-			__FUNCTION__, swapsize);
-		return FPGA_FAIL;
-	}
-
-	/* read data into memory and swap bits */
-	ptr = swapdata;
-	for (i = 0; i < swapsize; i++) {
-		data = 0x00;
-		data |= (*dataptr & 0x01) << 7;
-		data |= (*dataptr & 0x02) << 5;
-		data |= (*dataptr & 0x04) << 3;
-		data |= (*dataptr & 0x08) << 1;
-		data |= (*dataptr & 0x10) >> 1;
-		data |= (*dataptr & 0x20) >> 3;
-		data |= (*dataptr & 0x40) >> 5;
-		data |= (*dataptr & 0x80) >> 7;
-		*ptr++ = data;
-		dataptr++;
-	}
-
-	rc = fpga_load(dev, swapdata, swapsize);
-	free(swapdata);
+	rc = fpga_load(dev, dataptr, swapsize);
 	return rc;
 #else
 	printf("Bitstream support only for Xilinx devices\n");
-- 
1.5.3

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

* [U-Boot-Users] [PATCH 5/5 RESEND] Remove bit swapping in Xilinx Spartan bitfile loading
  2007-12-27 16:13 [U-Boot-Users] [PATCH 5/5 RESEND] Remove bit swapping in Xilinx Spartan bitfile loading Matthias Fuchs
@ 2008-01-09 12:37 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2008-01-09 12:37 UTC (permalink / raw)
  To: u-boot

In message <200712271713.11367.matthias.fuchs@esd-electronics.com> you wrote:
> This patch removes the unnecessary bit swapping when
> booting .bit files with the 'fpga loadb' command.
> 
> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
About the use of language: it is impossible to sharpen a pencil  with
a  blunt  ax.  It is equally vain to try to do it with ten blunt axes
instead.                                           -- Edsger Dijkstra

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

end of thread, other threads:[~2008-01-09 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-27 16:13 [U-Boot-Users] [PATCH 5/5 RESEND] Remove bit swapping in Xilinx Spartan bitfile loading Matthias Fuchs
2008-01-09 12:37 ` Wolfgang Denk

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