Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1657658
| From | Alan Tull <atull@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v12 6/6] fpga-manager: altera-ps-spi: use bitrev8x4 |
| Date | 2017-06-05 17:20 +0200 |
| Message-ID | <tP1Xr-4zX-9@gated-at.bofh.it> (permalink) |
| References | <tL4TT-2Ht-3@gated-at.bofh.it> <tO1wt-5YJ-5@gated-at.bofh.it> <tO1wt-5YJ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jun 2, 2017 at 3:30 PM, Joshua Clayton <stillcompiling@gmail.com> wrote:
Hi Joshua,
Thanks for your work on this!
Alan
> Speed up bit reversal by using hardware bit reversal
> Add extra code to handle less than 4byte remnants, if any
>
> Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Alan Tull <atull@kernel.org>
> ---
> drivers/fpga/altera-ps-spi.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c
> index 0db8def668ed..14f14efdf0d5 100644
> --- a/drivers/fpga/altera-ps-spi.c
> +++ b/drivers/fpga/altera-ps-spi.c
> @@ -149,12 +149,23 @@ static int altera_ps_write_init(struct fpga_manager *mgr,
>
> static void rev_buf(char *buf, size_t len)
> {
> - const char *fw_end = (buf + len);
> + u32 *fw32 = (u32 *)buf;
> + size_t extra_bytes = (len & 0x03);
> + const u32 *fw_end = (u32 *)(buf + len - extra_bytes);
>
> /* set buffer to lsb first */
> - while (buf < fw_end) {
> - *buf = bitrev8(*buf);
> - buf++;
> + while (fw32 < fw_end) {
> + *fw32 = bitrev8x4(*fw32);
> + fw32++;
> + }
> +
> + if (extra_bytes) {
> + buf = (char *)fw_end;
> + while (extra_bytes) {
> + *buf = bitrev8(*buf);
> + buf++;
> + extra_bytes--;
> + }
> }
> }
>
> --
> 2.11.0
>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v12 6/6] fpga-manager: altera-ps-spi: use bitrev8x4 Joshua Clayton <stillcompiling@gmail.com> - 2017-06-02 22:40 +0200 Re: [PATCH v12 6/6] fpga-manager: altera-ps-spi: use bitrev8x4 Alan Tull <atull@kernel.org> - 2017-06-05 17:20 +0200
csiph-web