Skip to contentSkip to conversation

ARM: shmobile: koelsch legacy: Enable DMA for QSPI

PATCH Superseded Geert Uytterhoeven 5 participants 9 messages Jun 2, 2014 – Jun 3, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover ARM: shmobile: koelsch legacy: Enable DMA for QSPI

This patch series enables DMA support for QSPI on r8a7791/koelsch legacy. It's independent from the series "ARM: shmobile: koelsch reference: Enable DMA for QSPI".

[2/4] was written by Morimoto-san for LTSI 3.10, and forward ported by me.

This was tested on r8a7791/koelsch.

Performance figures for reading from a QSPI FLASH driven at 24.375 MHz are:
- Single: 1.1 Mbps PIO, 23 Mbps DMA
- Dual : 12.7 Mbps PIO, 48 Mbps DMA
- Quad : 13 Mbps PIO, 70 Mbps DMA

Thanks for your comments!

[1/4] ARM: shmobile: r8a7791: Add SYS-DMAC clocks [2/4] ARM: shmobile: r8a7791: Add SYS-DMAC support [3/4] ARM: shmobile: r8a7791: Add QSPI DMA support [4/4] ARM: shmobile: koelsch legacy: Enable DMA for QSPI

 arch/arm/mach-shmobile/board-koelsch.c        |  2 +
 arch/arm/mach-shmobile/clock-r8a7791.c        |  6 +-
 arch/arm/mach-shmobile/include/mach/r8a7791.h |  7 +++
 arch/arm/mach-shmobile/setup-r8a7791.c        | 82 +++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 1 deletion(-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

author maintainer
#1 lore raw

PATCH 1/4 ARM: shmobile: r8a7791: Add SYS-DMAC clocks

---
 arch/arm/mach-shmobile/clock-r8a7791.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/clock-r8a7791.c +5 -1
index e2fdfcc14436..b0b2294513e2 100644
@@ -178,7 +178,7 @@ enum {
 	MSTP719, MSTP718, MSTP715, MSTP714,
 	MSTP522,
 	MSTP314, MSTP312, MSTP311,
-	MSTP216, MSTP207, MSTP206,
+	MSTP219, MSTP218, MSTP216, MSTP207, MSTP206,
 	MSTP204, MSTP203, MSTP202,
 	MSTP124,
 	MSTP_NR
@@ -215,6 +215,8 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP312] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD1], SMSTPCR3, 12, MSTPSR3, 0), /* SDHI1 */
 	[MSTP311] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD2], SMSTPCR3, 11, MSTPSR3, 0), /* SDHI2 */
 	[MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0), /* SCIFB2 */
+	[MSTP219] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 19, MSTPSR2, 0), /* SYS-DMAC0 */
+	[MSTP218] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 18, MSTPSR2, 0), /* SYS-DMAC1 */
 	[MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0), /* SCIFB1 */
 	[MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0), /* SCIFB0 */
 	[MSTP204] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 4, MSTPSR2, 0), /* SCIFA0 */
@@ -267,6 +269,8 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.0", &mstp_clks[MSTP124]),
 	CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
 	CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
+	CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP219]),
+	CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP218]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]),
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/4 ARM: shmobile: r8a7791: Add SYS-DMAC clocks

Hello.

Quoted 10 lines · Geert Uytterhoeven
---
  arch/arm/mach-shmobile/clock-r8a7791.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/clock-r8a7791.c +0 -0
index e2fdfcc14436..b0b2294513e2 100644

arch/arm/mach-shmobile/clock-r8a7791.c enum { · line 181

Quoted 5 lines
arch/arm/mach-shmobile/clock-r8a7791.c +1 -1
@@ -178,7 +178,7 @@ enum {
  	MSTP719, MSTP718, MSTP715, MSTP714,
  	MSTP522,
  	MSTP314, MSTP312, MSTP311,
-	MSTP216, MSTP207, MSTP206,
+	MSTP219, MSTP218, MSTP216, MSTP207, MSTP206,

I'd put the latter two on a separate line or on the same line with the
following three.

arch/arm/mach-shmobile/clock-r8a7791.c static struct clk mstp_clks[MSTP_NR] = { · line 219

Quoted 9 lines
arch/arm/mach-shmobile/clock-r8a7791.c +2 -0
  	MSTP204, MSTP203, MSTP202,
  	MSTP124,
  	MSTP_NR
@@ -215,6 +215,8 @@ static struct clk mstp_clks[MSTP_NR] = {
  	[MSTP312] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD1], SMSTPCR3, 12, MSTPSR3, 0), /* SDHI1 */
  	[MSTP311] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD2], SMSTPCR3, 11, MSTPSR3, 0), /* SDHI2 */
  	[MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0), /* SCIFB2 */
+	[MSTP219] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 19, MSTPSR2, 0), /* SYS-DMAC0 */
+	[MSTP218] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 18, MSTPSR2, 0), /* SYS-DMAC1 */

I think these 2 clocks should precede SCIFB2 clock.

arch/arm/mach-shmobile/clock-r8a7791.c static struct clk mstp_clks[MSTP_NR] = { · line 222

Quoted 3 lines
arch/arm/mach-shmobile/clock-r8a7791.c +0 -0
  	[MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0), /* SCIFB1 */
  	[MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0), /* SCIFB0 */
  	[MSTP204] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 4, MSTPSR2, 0), /* SCIFA0 */

WBR, Sergei

#3 lore raw

PATCH 1/4 ARM: shmobile: r8a7791: Add SYS-DMAC clocks

Hi Sergei,

Quoted 15 lines · Sergei Shtylyov

arch/arm/mach-shmobile/clock-r8a7791.c enum { · line 181

Quoted 11 lines
arch/arm/mach-shmobile/clock-r8a7791.c +1 -1
index e2fdfcc14436..b0b2294513e2 100644
@@ -178,7 +178,7 @@ enum {
        MSTP719, MSTP718, MSTP715, MSTP714,
        MSTP522,
        MSTP314, MSTP312, MSTP311,
-       MSTP216, MSTP207, MSTP206,
+       MSTP219, MSTP218, MSTP216, MSTP207, MSTP206,

I'd put the latter two on a separate line or on the same line with the
following three.

Quoted 23 lines
Quoted 6 lines
arch/arm/mach-shmobile/clock-r8a7791.c +0 -0
        MSTP204, MSTP203, MSTP202,
        MSTP124,
        MSTP_NR
@@ -215,6 +215,8 @@ static struct clk mstp_clks[MSTP_NR] = {
        [MSTP312] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD1], SMSTPCR3, 12,

MSTPSR3, 0), /* SDHI1 */

Quoted 8 lines
        [MSTP311] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD2], SMSTPCR3, 11,
MSTPSR3, 0), /* SDHI2 */
        [MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0),

/* SCIFB2 */
+ [MSTP219] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 19, MSTPSR2, 0),
/* SYS-DMAC0 */
+ [MSTP218] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 18, MSTPSR2, 0),
/* SYS-DMAC1 */

I think these 2 clocks should precede SCIFB2 clock.

Quoted 6 lines
        [MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0),
/* SCIFB1 */
        [MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0),
/* SCIFB0 */
        [MSTP204] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 4, MSTPSR2, 0),

/* SCIFA0 */

My local patches still have the MSIOF entries as well. Unfortunately MSTP values are not always contiguous (MSIOF, SYS-DMAC, and SCIF are mixed). So this is the end result of rebasing that on top of Simon's current tree.

Anyway, I think the legacy series is mostly posted for reference, as I'm under the impression Simon will no longer apply patches adding features to the legacy code. Simon, is that correct?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#4 lore raw

PATCH 1/4 ARM: shmobile: r8a7791: Add SYS-DMAC clocks

Quoted 43 lines · Geert Uytterhoeven

Hi Sergei,

Quoted 15 lines · Sergei Shtylyov

arch/arm/mach-shmobile/clock-r8a7791.c enum { · line 181

Quoted 11 lines
arch/arm/mach-shmobile/clock-r8a7791.c +1 -1
index e2fdfcc14436..b0b2294513e2 100644
@@ -178,7 +178,7 @@ enum {
        MSTP719, MSTP718, MSTP715, MSTP714,
        MSTP522,
        MSTP314, MSTP312, MSTP311,
-       MSTP216, MSTP207, MSTP206,
+       MSTP219, MSTP218, MSTP216, MSTP207, MSTP206,

I'd put the latter two on a separate line or on the same line with the
following three.

Quoted 23 lines
Quoted 6 lines
arch/arm/mach-shmobile/clock-r8a7791.c +0 -0
        MSTP204, MSTP203, MSTP202,
        MSTP124,
        MSTP_NR
@@ -215,6 +215,8 @@ static struct clk mstp_clks[MSTP_NR] = {
        [MSTP312] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD1], SMSTPCR3, 12,

MSTPSR3, 0), /* SDHI1 */

Quoted 8 lines
        [MSTP311] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD2], SMSTPCR3, 11,
MSTPSR3, 0), /* SDHI2 */
        [MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0),

/* SCIFB2 */
+ [MSTP219] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 19, MSTPSR2, 0),
/* SYS-DMAC0 */
+ [MSTP218] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 18, MSTPSR2, 0),
/* SYS-DMAC1 */

I think these 2 clocks should precede SCIFB2 clock.

Quoted 6 lines
        [MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0),
/* SCIFB1 */
        [MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0),
/* SCIFB0 */
        [MSTP204] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 4, MSTPSR2, 0),

/* SCIFA0 */

Quoted 7 lines

My local patches still have the MSIOF entries as well. Unfortunately MSTP values are not always contiguous (MSIOF, SYS-DMAC, and SCIF are mixed). So this is the end result of rebasing that on top of Simon's current tree.

Anyway, I think the legacy series is mostly posted for reference, as I'm under the impression Simon will no longer apply patches adding features to the legacy code. Simon, is that correct?

Yes, that is correct.

author maintainer
#5 lore raw

PATCH 2/4 ARM: shmobile: r8a7791: Add SYS-DMAC support

In reply to Geert Uytterhoeven

From: Kuninori Morimoto <[email protected]>

This patch enables SYS-DMAC0 (= Low), it doesn't support SYS-DMAC1 (= HI) today.
Because, SYS-DMAC HI/Low interrupt mapping is not good match to SH-DMAC driver.

---
 arch/arm/mach-shmobile/include/mach/r8a7791.h |  5 ++
 arch/arm/mach-shmobile/setup-r8a7791.c        | 81 +++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
arch/arm/mach-shmobile/include/mach/r8a7791.h +5 -0
index 86eae7bceb6f..533999916e73 100644
@@ -1,6 +1,11 @@
 #ifndef __ASM_R8A7791_H__
 #define __ASM_R8A7791_H__
 
+/* DMA slave IDs */
+enum {
+	RCAR_DMA_SLAVE_INVALID,
+};
+
 void r8a7791_add_standard_devices(void);
 void r8a7791_add_dt_devices(void);
 void r8a7791_clock_init(void);
arch/arm/mach-shmobile/setup-r8a7791.c +81 -0

100 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#6 lore raw

PATCH 3/4 ARM: shmobile: r8a7791: Add QSPI DMA support

In reply to Geert Uytterhoeven
---
 arch/arm/mach-shmobile/include/mach/r8a7791.h | 2 ++
 arch/arm/mach-shmobile/setup-r8a7791.c        | 1 +
 2 files changed, 3 insertions(+)
arch/arm/mach-shmobile/include/mach/r8a7791.h +2 -0
index 533999916e73..c4582df76139 100644
@@ -4,6 +4,8 @@
 /* DMA slave IDs */
 enum {
 	RCAR_DMA_SLAVE_INVALID,
+	SYS_DMAC_SLAVE_QSPI_TX,
+	SYS_DMAC_SLAVE_QSPI_RX,
 };
 
 void r8a7791_add_standard_devices(void);
arch/arm/mach-shmobile/setup-r8a7791.c +1 -0
index 77e1bc2b2870..8dbdb17ffe51 100644
@@ -57,6 +57,7 @@
 }
 
 static const struct sh_dmae_slave_config r8a7791_sys_dmac_slaves[] = {
+	SYS_DMAC_SLAVE(QSPI,   8, 0xe6b10000, 0x04, 0x04,   0x17, 0x18),
 };
 
 static const struct sh_dmae_channel r8a7791_sys_dmac_channels[] = {
Signature · 1 line
1.9.1
author maintainer
#7 lore raw

PATCH 4/4 ARM: shmobile: koelsch legacy: Enable DMA for QSPI

In reply to Geert Uytterhoeven
---
 arch/arm/mach-shmobile/board-koelsch.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-shmobile/board-koelsch.c +2 -0
index c6c68892caa3..171ce3ea162a 100644
@@ -182,6 +182,8 @@ static const struct resource qspi_resources[] __initconst = {
 
 static const struct rspi_plat_data qspi_pdata __initconst = {
 	.num_chipselect = 1,
+	.dma_tx_id	= SYS_DMAC_SLAVE_QSPI_TX,
+	.dma_rx_id	= SYS_DMAC_SLAVE_QSPI_RX,
 };
 
 /* SPI Flash memory (Spansion S25FL512SAGMFIG11 64 MiB) */
Signature · 1 line
1.9.1
#8 lore raw

cover ARM: shmobile: koelsch legacy: Enable DMA for QSPI

In reply to Geert Uytterhoeven

Hi Geert,

Thanks for the patch.

It seems that patch 1 and patch 2 are to support DMA in general, while patch 3 and patch 4 are to support DMA for QSPI.

So, I think it should be separated into 2 patch series. How do you think about it ?

Best regards,
KHIEM Nguyen

Quoted 40 lines · Geert Uytterhoeven

This patch series enables DMA support for QSPI on r8a7791/koelsch legacy. It's independent from the series "ARM: shmobile: koelsch reference: Enable DMA for QSPI".

[2/4] was written by Morimoto-san for LTSI 3.10, and forward ported by me.

This was tested on r8a7791/koelsch.

Performance figures for reading from a QSPI FLASH driven at 24.375 MHz are:
- Single: 1.1 Mbps PIO, 23 Mbps DMA
- Dual : 12.7 Mbps PIO, 48 Mbps DMA
- Quad : 13 Mbps PIO, 70 Mbps DMA

Thanks for your comments!

[1/4] ARM: shmobile: r8a7791: Add SYS-DMAC clocks [2/4] ARM: shmobile: r8a7791: Add SYS-DMAC support [3/4] ARM: shmobile: r8a7791: Add QSPI DMA support [4/4] ARM: shmobile: koelsch legacy: Enable DMA for QSPI

  arch/arm/mach-shmobile/board-koelsch.c        |  2 +
  arch/arm/mach-shmobile/clock-r8a7791.c        |  6 +-
  arch/arm/mach-shmobile/include/mach/r8a7791.h |  7 +++
  arch/arm/mach-shmobile/setup-r8a7791.c        | 82 +++++++++++++++++++++++++++
  4 files changed, 96 insertions(+), 1 deletion(-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html