Re: [PATCH 2/2] spi: sh-msiof: Use DMA if possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Geert-san

Thank you very much for your comments!

On 2019/01/11 18:09, Geert Uytterhoeven wrote:
Hi Hoan-san,

On Fri, Jan 11, 2019 at 9:59 AM Nguyen An Hoan <na-hoan@xxxxxxxxxxx> wrote:
From: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>

Currently, this driver only supports feature for DMA 32-bits.
In this case, only if the data length is divisible by 4 to use
DMA, otherwise PIO will be used. This patch will suggest use
the DMA 32-bits with 4bytes of words, then the remaining data
will be transmitted by PIO mode.

Signed-off-by: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>
Thanks for your patch, that's a great idea!

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
with a small suggestion below.
Currently, I only test the transmit-receive spi with AT25C eeprom,
because the maximum length of data I test with eeprom is only 18 bytes,
so with this patch, there will be times when clock timing time and pulse
of data transmission (I Observed by  sigrock logic analyzer) will not be
beautiful compared to PIO mode.
I worry if other devices using this driver also limit the maximum length
of transmission/reception to 18bytes.

But I still want to patch up to ask for your opinion.


--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -937,17 +937,13 @@ static int sh_msiof_transfer_one(struct spi_master *master,
                 unsigned int l = 0;

                 if (tx_buf)
-                       l = min(len, p->tx_fifo_size * 4);
+                       l = min(len - len % 4, p->tx_fifo_size * 4);
I think this would be easier to read when written as:

     l = min(round_down(len, 4), p->tx_fifo_size * 4);

If you do not have any problems with the above,
I will update as you want here.


Thank you for your helps!

Hoan.

                 if (rx_buf)
-                       l = min(len, p->rx_fifo_size * 4);
+                       l = min(len - len % 4, p->rx_fifo_size * 4);
Likewise,

Gr{oetje,eeting}s,

                         Geert




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux