Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1251902

[PATCHv2] fpga: zynq-fpga: Change fw format to handle bin instead of bit.

From Moritz Fischer <moritz.fischer@ettus.com>
Newsgroups linux.kernel
Subject [PATCHv2] fpga: zynq-fpga: Change fw format to handle bin instead of bit.
Date 2015-10-20 19:20 +0200
Message-ID <qlIJQ-1Ol-13@gated-at.bofh.it> (permalink)
References <qlIJQ-1Ol-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This gets rid of the code to strip away the header and byteswap,
as well as the check for the sync word.

Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
---
v2:
 - Removed early exit path in case synq seq is not found
---
 drivers/fpga/zynq-fpga.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
index 617d382..31db550 100644
--- a/drivers/fpga/zynq-fpga.c
+++ b/drivers/fpga/zynq-fpga.c
@@ -287,9 +287,9 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr,
 	struct zynq_fpga_priv *priv;
 	int err;
 	char *kbuf;
-	size_t i, in_count;
+	size_t in_count;
 	dma_addr_t dma_addr;
-	u32 transfer_length = 0;
+	u32 transfer_length;
 	u32 intr_status;
 
 	in_count = count;
@@ -301,26 +301,6 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr,
 
 	memcpy(kbuf, buf, count);
 
-	/* look for the sync word */
-	for (i = 0; i < count - 4; i++) {
-		if (memcmp(kbuf + i, "\xAA\x99\x55\x66", 4) == 0) {
-			dev_dbg(priv->dev, "Found swapped sync word\n");
-			break;
-		}
-	}
-
-	/* remove the header, align the data on word boundary */
-	if (i != count - 4) {
-		count -= i;
-		memmove(kbuf, kbuf + i, count);
-	}
-
-	/* fixup endianness of the data */
-	for (i = 0; i < count; i += 4) {
-		u32 *p = (u32 *)&kbuf[i];
-		*p = swab32(*p);
-	}
-
 	/* enable clock */
 	err = clk_enable(priv->clk);
 	if (err)
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2] fpga: zynq-fpga: Replacing BIT with BIN format Moritz Fischer <moritz.fischer@ettus.com> - 2015-10-20 19:20 +0200
  [PATCHv2] fpga: zynq-fpga: Change fw format to handle bin instead of bit. Moritz Fischer <moritz.fischer@ettus.com> - 2015-10-20 19:20 +0200
    Re: [PATCHv2] fpga: zynq-fpga: Change fw format to handle bin  instead of bit. Josh Cartwright <joshc@ni.com> - 2015-10-21 12:40 +0200

csiph-web