linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] R8A7778/BOCK-W: HPB-DMAC support for SDHI0
@ 2013-08-24 21:33 Sergei Shtylyov
  2013-08-24 21:35 ` [PATCH v4 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support Sergei Shtylyov
  2013-08-24 21:36 ` [PATCH v4 2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0 Sergei Shtylyov
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2013-08-24 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

   Here's the set of 2 patches against the Simon Horman's 'renesas.git' repo,
'renesas-next-20130823' tag. Here we add the HPB-DMAC platform code working on
the R8A7778 and enable DMA for SDHI0 on BOCK-W (Max has fixed the wrong settings
that led to the SDHI0 DMA working incorrectly). The patchset depends on the
R-Car HPB-DMAC driver patch posted earlier.

[1/2] ARM: shmobile: r8a7778: add HPB-DMAC support
[2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0

   The former patch #1 has been merged to the next patch moving the data from
the now removed <mach/dma.h> to <mach/r8a7778.h>.

WBR, Sergei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support
  2013-08-24 21:33 [PATCH v4 0/2] R8A7778/BOCK-W: HPB-DMAC support for SDHI0 Sergei Shtylyov
@ 2013-08-24 21:35 ` Sergei Shtylyov
  2013-09-27  4:52   ` Simon Horman
  2013-08-24 21:36 ` [PATCH v4 2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0 Sergei Shtylyov
  1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2013-08-24 21:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Max Filippov <max.filippov@cogentembedded.com>

Add HPB-DMAC platform device on R8A7778 SoC along with its slave and channel
configurations (only for SDHI0 so far).

Signed-off-by: Max Filippov <max.filippov@cogentembedded.com>
[Sergei: moved *enum* declaring HPB-DMAC slave IDs from now removed <mach/dma.h>
to <mach/r8a7778.h>, removed #include <mach/dma.h> from setup-r8a7778.c, removed
SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[] and
hpb_dmae_channels[], moved the comments after the element initializers of
hpb_dmae_channels[].]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
Changes in version 4:
- renamed all the bit/field #define's to include 'HBP_DMAE_' prefix to match
  the driver.

Changes in version 3:
- changed ASYNCMDR_ASMD2[12]_SINGLE to ASYNCMDR_ASMD2[12]_MULTI in the 'mdr'
  field initializers;
- moved the comments after the element initializers of hpb_dmae_channels[];
- resolved rejects, refreshed the patch.

Changes in version 2:
- moved *enum* declaring HPB-DMAC slave IDs from the separate header file to
  <mach/r8a7778.h>, removed #include <mach/dma.h> from setup-r8a7778.c;
- removed SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[]
  and hpb_dmae_channels[].

 arch/arm/mach-shmobile/include/mach/r8a7778.h |    8 ++
 arch/arm/mach-shmobile/setup-r8a7778.c        |   85 ++++++++++++++++++++++++++
 2 files changed, 93 insertions(+)

Index: renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h
=================================--- renesas.orig/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2013  Renesas Solutions Corp.
  * Copyright (C) 2013  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ * Copyright (C) 2013  Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +21,13 @@
 
 #include <linux/sh_eth.h>
 
+/* HPB-DMA slave IDs */
+enum {
+	HPBDMA_SLAVE_DUMMY,
+	HPBDMA_SLAVE_SDHI0_TX,
+	HPBDMA_SLAVE_SDHI0_RX,
+};
+
 extern void r8a7778_add_standard_devices(void);
 extern void r8a7778_add_standard_devices_dt(void);
 extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata);
Index: renesas/arch/arm/mach-shmobile/setup-r8a7778.c
=================================--- renesas.orig/arch/arm/mach-shmobile/setup-r8a7778.c
+++ renesas/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -24,6 +24,7 @@
 #include <linux/irqchip/arm-gic.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/platform_data/dma-rcar-hpbdma.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/irq-renesas-intc-irqpin.h>
 #include <linux/platform_device.h>
@@ -305,6 +306,88 @@ void __init r8a7778_add_dt_devices(void)
 	r8a7778_register_tmu(1);
 }
 
+/* HPB-DMA */
+
+/* Asynchronous mode register (ASYNCMDR) bits */
+#define HPB_DMAE_ASYNCMDR_ASMD22_MASK	BIT(2)	/* SDHI0 */
+#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE	BIT(2)	/* SDHI0 */
+#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI	0	/* SDHI0 */
+#define HPB_DMAE_ASYNCMDR_ASMD21_MASK	BIT(1)	/* SDHI0 */
+#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE	BIT(1)	/* SDHI0 */
+#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI	0	/* SDHI0 */
+
+static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
+	{
+		.id	= HPBDMA_SLAVE_SDHI0_TX,
+		.addr	= 0xffe4c000 + 0x30,
+		.dcr	= HPB_DMAE_DCR_SPDS_16BIT |
+			  HPB_DMAE_DCR_DMDL |
+			  HPB_DMAE_DCR_DPDS_16BIT,
+		.rstr	= HPB_DMAE_ASYNCRSTR_ASRST21 |
+			  HPB_DMAE_ASYNCRSTR_ASRST22 |
+			  HPB_DMAE_ASYNCRSTR_ASRST23,
+		.mdr	= HPB_DMAE_ASYNCMDR_ASMD21_MULTI,
+		.mdm	= HPB_DMAE_ASYNCMDR_ASMD21_MASK,
+		.port	= 0x0D0C,
+		.flags	= HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
+		.dma_ch	= 21,
+	}, {
+		.id	= HPBDMA_SLAVE_SDHI0_RX,
+		.addr	= 0xffe4c000 + 0x30,
+		.dcr	= HPB_DMAE_DCR_SMDL |
+			  HPB_DMAE_DCR_SPDS_16BIT |
+			  HPB_DMAE_DCR_DPDS_16BIT,
+		.rstr	= HPB_DMAE_ASYNCRSTR_ASRST21 |
+			  HPB_DMAE_ASYNCRSTR_ASRST22 |
+			  HPB_DMAE_ASYNCRSTR_ASRST23,
+		.mdr	= HPB_DMAE_ASYNCMDR_ASMD22_MULTI,
+		.mdm	= HPB_DMAE_ASYNCMDR_ASMD22_MASK,
+		.port	= 0x0D0C,
+		.flags	= HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
+		.dma_ch	= 22,
+	},
+};
+
+static const struct hpb_dmae_channel hpb_dmae_channels[] = {
+	HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
+	HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
+};
+
+static struct hpb_dmae_pdata dma_platform_data __initdata = {
+	.slaves			= hpb_dmae_slaves,
+	.num_slaves		= ARRAY_SIZE(hpb_dmae_slaves),
+	.channels		= hpb_dmae_channels,
+	.num_channels		= ARRAY_SIZE(hpb_dmae_channels),
+	.ts_shift		= {
+		[XMIT_SZ_8BIT]	= 0,
+		[XMIT_SZ_16BIT]	= 1,
+		[XMIT_SZ_32BIT]	= 2,
+	},
+	.num_hw_channels	= 39,
+};
+
+static struct resource hpb_dmae_resources[] __initdata = {
+	/* Channel registers */
+	DEFINE_RES_MEM(0xffc08000, 0x1000),
+	/* Common registers */
+	DEFINE_RES_MEM(0xffc09000, 0x170),
+	/* Asynchronous reset registers */
+	DEFINE_RES_MEM(0xffc00300, 4),
+	/* Asynchronous mode registers */
+	DEFINE_RES_MEM(0xffc00400, 4),
+	/* IRQ for DMA channels */
+	DEFINE_RES_NAMED(gic_iid(0x7b), 5, NULL, IORESOURCE_IRQ),
+};
+
+static void __init r8a7778_register_hpb_dmae(void)
+{
+	platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
+					  hpb_dmae_resources,
+					  ARRAY_SIZE(hpb_dmae_resources),
+					  &dma_platform_data,
+					  sizeof(dma_platform_data));
+}
+
 void __init r8a7778_add_standard_devices(void)
 {
 	r8a7778_add_dt_devices();
@@ -315,6 +398,8 @@ void __init r8a7778_add_standard_devices
 	r8a7778_register_hspi(0);
 	r8a7778_register_hspi(1);
 	r8a7778_register_hspi(2);
+
+	r8a7778_register_hpb_dmae();
 }
 
 void __init r8a7778_init_late(void)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0
  2013-08-24 21:33 [PATCH v4 0/2] R8A7778/BOCK-W: HPB-DMAC support for SDHI0 Sergei Shtylyov
  2013-08-24 21:35 ` [PATCH v4 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support Sergei Shtylyov
@ 2013-08-24 21:36 ` Sergei Shtylyov
  2013-09-27  4:54   ` Simon Horman
  1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2013-08-24 21:36 UTC (permalink / raw)
  To: linux-arm-kernel

From: Max Filippov <max.filippov@cogentembedded.com>

Pass HPB-DMA slave IDs in the SDHI0 platform data to enable DMA in the SDHI
driver.

Signed-off-by: Max Filippov <max.filippov@cogentembedded.com>
[Sergei: removed #include <mach/dma.h>]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
Changes in version 3:
- resolved reject.

Changes in version 2:
- removed #include <mach/dma.h>;
- refreshed the patch.

 arch/arm/mach-shmobile/board-bockw.c |    2 ++
 1 file changed, 2 insertions(+)

Index: renesas/arch/arm/mach-shmobile/board-bockw.c
=================================--- renesas.orig/arch/arm/mach-shmobile/board-bockw.c
+++ renesas/arch/arm/mach-shmobile/board-bockw.c
@@ -89,6 +89,8 @@ static struct rcar_phy_platform_data usb
 
 /* SDHI */
 static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
+	.dma_slave_tx	= HPBDMA_SLAVE_SDHI0_TX,
+	.dma_slave_rx	= HPBDMA_SLAVE_SDHI0_RX,
 	.tmio_caps	= MMC_CAP_SD_HIGHSPEED,
 	.tmio_ocr_mask	= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support
  2013-08-24 21:35 ` [PATCH v4 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support Sergei Shtylyov
@ 2013-09-27  4:52   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-09-27  4:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Aug 25, 2013 at 01:35:13AM +0400, Sergei Shtylyov wrote:
> From: Max Filippov <max.filippov@cogentembedded.com>
> 
> Add HPB-DMAC platform device on R8A7778 SoC along with its slave and channel
> configurations (only for SDHI0 so far).
> 
> Signed-off-by: Max Filippov <max.filippov@cogentembedded.com>
> [Sergei: moved *enum* declaring HPB-DMAC slave IDs from now removed <mach/dma.h>
> to <mach/r8a7778.h>, removed #include <mach/dma.h> from setup-r8a7778.c, removed
> SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[] and
> hpb_dmae_channels[], moved the comments after the element initializers of
> hpb_dmae_channels[].]
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> ---
> Changes in version 4:
> - renamed all the bit/field #define's to include 'HBP_DMAE_' prefix to match
>   the driver.
> 
> Changes in version 3:
> - changed ASYNCMDR_ASMD2[12]_SINGLE to ASYNCMDR_ASMD2[12]_MULTI in the 'mdr'
>   field initializers;
> - moved the comments after the element initializers of hpb_dmae_channels[];
> - resolved rejects, refreshed the patch.
> 
> Changes in version 2:
> - moved *enum* declaring HPB-DMAC slave IDs from the separate header file to
>   <mach/r8a7778.h>, removed #include <mach/dma.h> from setup-r8a7778.c;
> - removed SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[]
>   and hpb_dmae_channels[].
> 
>  arch/arm/mach-shmobile/include/mach/r8a7778.h |    8 ++
>  arch/arm/mach-shmobile/setup-r8a7778.c        |   85 ++++++++++++++++++++++++++
>  2 files changed, 93 insertions(+)

Thanks, queued up for v3.13.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0
  2013-08-24 21:36 ` [PATCH v4 2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0 Sergei Shtylyov
@ 2013-09-27  4:54   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-09-27  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Aug 25, 2013 at 01:36:38AM +0400, Sergei Shtylyov wrote:
> From: Max Filippov <max.filippov@cogentembedded.com>
> 
> Pass HPB-DMA slave IDs in the SDHI0 platform data to enable DMA in the SDHI
> driver.
> 
> Signed-off-by: Max Filippov <max.filippov@cogentembedded.com>
> [Sergei: removed #include <mach/dma.h>]
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Thanks, queued up for v3.13.

I believe that a defconfig update is required in order
for this feature to be used when compiling with the defconfig.
If so please provide a defconfig patch.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-27  4:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-24 21:33 [PATCH v4 0/2] R8A7778/BOCK-W: HPB-DMAC support for SDHI0 Sergei Shtylyov
2013-08-24 21:35 ` [PATCH v4 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support Sergei Shtylyov
2013-09-27  4:52   ` Simon Horman
2013-08-24 21:36 ` [PATCH v4 2/2] ARM: shmobile: BOCK-W: enable DMA for SDHI0 Sergei Shtylyov
2013-09-27  4:54   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).