From: michal.simek@xilinx.com (Michal Simek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2] fpga: zynq-fpga: Change fw format to handle bin instead of bit.
Date: Wed, 21 Oct 2015 08:46:21 +0200 [thread overview]
Message-ID: <562734BD.2000909@xilinx.com> (raw)
In-Reply-To: <1445361596-12024-2-git-send-email-moritz.fischer@ettus.com>
On 10/20/2015 07:19 PM, Moritz Fischer wrote:
> 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)
>
Looks good.
Acked-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <michal.simek@xilinx.com>
To: Moritz Fischer <moritz.fischer@ettus.com>, <atull@opensource.altera.com>
Cc: <michal.simek@xilinx.com>, <soren.brinkmann@xilinx.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <joshc@ni.com>,
<gregkh@linuxfoundation.org>, <mike.looijmans@topic.nl>
Subject: Re: [PATCHv2] fpga: zynq-fpga: Change fw format to handle bin instead of bit.
Date: Wed, 21 Oct 2015 08:46:21 +0200 [thread overview]
Message-ID: <562734BD.2000909@xilinx.com> (raw)
In-Reply-To: <1445361596-12024-2-git-send-email-moritz.fischer@ettus.com>
On 10/20/2015 07:19 PM, Moritz Fischer wrote:
> 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)
>
Looks good.
Acked-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
next prev parent reply other threads:[~2015-10-21 6:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 17:19 [PATCHv2] fpga: zynq-fpga: Replacing BIT with BIN format Moritz Fischer
2015-10-20 17:19 ` Moritz Fischer
2015-10-20 17:19 ` [PATCHv2] fpga: zynq-fpga: Change fw format to handle bin instead of bit Moritz Fischer
2015-10-20 17:19 ` Moritz Fischer
2015-10-21 6:46 ` Michal Simek [this message]
2015-10-21 6:46 ` Michal Simek
2015-10-21 10:32 ` Josh Cartwright
2015-10-21 10:32 ` Josh Cartwright
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=562734BD.2000909@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 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.