Re: R-Car Gen2 QSPI driver performance

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

 



Hi Hiep,

On Fri, Aug 26, 2016 at 2:58 AM, Hiep Cao Minh <cm-hiep@xxxxxxxxxxx> wrote:
> I'd like to ask you about R-Car Gen2 QSPI driver performance test of single,
> dual and quad.
>
> ------
> commit 4f12b5e529e4ff274eb478ec1c2ef41358ed9577
> Author: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> Date:   Mon Jun 2 15:38:17 2014 +0200
>
>      spi: rspi: Add DMA support for QSPI on R-Car Gen2
>
>      Enable DMA support for QSPI on R-Car Gen2, for Single, Dual, and Quad
> SPI
>      Transfers.
>
>      Performance figures for reading from a QSPI FLASH driven at 24.375 MHz
>      on r8a7791/koelsch:
>        - Single:  1.1 Mbps PIO, 23 Mbps DMA
>        - Dual  : 12.7 Mbps PIO, 48 Mbps DMA
>        - Quad  : 13   Mbps PIO, 70 Mbps DMA
> ------
> Could you show me how to test these performances?

As I wanted to measure raw SPI performance, and not overhead (block
device, file system, ...) or other impact (buffer cache!), I used a patch like
the (whitespace-damaged) one at the end of this email, and:

    dd if=/dev/mtd2 bs=4M count=1 of=/dev/null

Using a sufficiently large buffer size is recommended for good performance.
All of this was done in r8a7791/koelsch.

> I have tried to reproduce them but I only got the results like this:
>
> Enabled DMA:
> Linux stable v4.7
>      Quad-spi: Read 3.2 MB/s Write 601 kB/s
>      Dual-spi: Read 3.1 MB/s Write 847 kB/s
>      Single-spi: Read 2.5 MB/s Write 850 kB/s
>
> PIO:
> RcarGen2_BSP linux_v3.10.101-ltsi
>      Quad-spi: Read 2.2 MB/s Write 1.1 MB/s
>      Dual-spi: Read 2.1 MB/s Write 158 kB/s
>      Single-spi: Read 173 kB/s Write 159 kB/s

Note that some of these are even faster than mine, probably due to
caching...

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 112f5130ee9579f4..d9d822a3e35cbed2 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -199,6 +199,8 @@ struct rspi_data {

        unsigned dma_callbacked:1;
        unsigned byte_access:1;
+
+       u64 msg_start;
 };

 static void rspi_write8(const struct rspi_data *rspi, u8 data, u16 offset)
@@ -926,6 +972,8 @@ static int rspi_prepare_message(struct spi_master *master,
        struct rspi_data *rspi = spi_master_get_devdata(master);
        int ret;

+       rspi->msg_start = get_jiffies_64();
+
        if (msg->spi->mode &
            (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)) {
                /* Setup sequencer for messages with multiple transfer modes */
@@ -943,6 +992,7 @@ static int rspi_unprepare_message(struct spi_master *master,
                                  struct spi_message *msg)
 {
        struct rspi_data *rspi = spi_master_get_devdata(master);
+       unsigned int elapsed, bps;

        /* Disable SPI function */
        rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR);
@@ -950,6 +1000,13 @@ static int rspi_unprepare_message(struct
spi_master *master,
        /* Reset sequencer for Single SPI Transfers */
        rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0);
        rspi_write8(rspi, 0, RSPI_SPSCR);
+
+       elapsed = get_jiffies_64() - rspi->msg_start;
+       bps = elapsed ? div_u64(msg->actual_length * 8ULL * HZ + elapsed / 2,
+                               elapsed) : 0;
+       printk("RSPI %u bps (%u bytes in %u ticks)\n", bps, msg->actual_length,
+              elapsed);
+
        return 0;
 }

 Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds




[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