Skip to contentSkip to conversation

R-Car Gen2 QSPI driver performance

DISCUSSION Hiep Cao Minh 2 participants 3 messages Aug 26, 2016 SPI

lore
Share & tools
lore
#0 lore raw

Hi Geert.

I'd like to ask you about R-Car Gen2 QSPI driver performance test of single, dual and quad.

------
commit 4f12b5e529e4ff274eb478ec1c2ef41358ed9577

Author: Geert Uytterhoeven <[email protected]>
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?

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

Regards,
Jinso/Hiep.

#1 lore raw

Hi Hiep,

Quoted 14 lines · Hiep Cao Minh

I'd like to ask you about R-Car Gen2 QSPI driver performance test of single, dual and quad.

------
commit 4f12b5e529e4ff274eb478ec1c2ef41358ed9577

Author: Geert Uytterhoeven <[email protected]>
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.

Quoted 7 lines

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.

Quoted 8 lines

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

Quoted 5 lines

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...

drivers/spi/spi-rspi.c +5 -0
index 112f5130ee9579f4..d9d822a3e35cbed2 100644
@@ -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 -- [email protected]

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

#2 lore raw

Hi Geert,

Thanks for your quick reply!

Quoted 22 lines · Hiep Cao Minh
Quoted 14 lines

I'd like to ask you about R-Car Gen2 QSPI driver performance test of single, dual and quad.

------
commit 4f12b5e529e4ff274eb478ec1c2ef41358ed9577

Author: Geert Uytterhoeven <[email protected]>
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.

Quoted 7 lines

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?

Quoted 9 lines

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.

Thanks, I'll try to reproduce them as you showed me.

Quoted 8 lines
Quoted 8 lines

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

Quoted 7 lines
Quoted 5 lines

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...

Oh!, thank you pointed it out.
And we also wonder why the reading speed in quad and dual mode are most the same?. (I mean they are not different very much.)
v4.7: Read 3.2 MB/s(Quad) and 3.1 MB/s(Dual),
And in your test results: 12.7 Mbps, 13 Mbps in PIO mode.

Regards,
Jinso/Hiep.