All of lore.kernel.org
 help / color / mirror / Atom feed
From: Icenowy Zheng <icenowy@aosc.io>
To: Vinod Koul <vinod.koul@intel.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Chen-Yu Tsai <wens@csie.org>, Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>
Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-sunxi@googlegroups.com, Icenowy Zheng <icenowy@aosc.xyz>
Subject: [PATCH v3 5/9] dmaengine: sun6i: make gate bit in sun8i's DMA engines a common quirk
Date: Wed, 24 May 2017 18:06:03 +0800	[thread overview]
Message-ID: <20170524100607.29790-6-icenowy@aosc.io> (raw)
In-Reply-To: <20170524100607.29790-1-icenowy@aosc.io>

From: Icenowy Zheng <icenowy@aosc.xyz>

Originally we enable a special gate bit when the compatible indicates
A23/33.

But according to BSP sources and user manuals, more SoCs will need this
gate bit.

So make it a common quirk configured in the config struct.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
Changes in v3:
- Stripped out the A83T gate bit set.

 drivers/dma/sun6i-dma.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index a2358780ab2c..69840cf6fe98 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -101,6 +101,11 @@ struct sun6i_dma_config {
 	u32 nr_max_channels;
 	u32 nr_max_requests;
 	u32 nr_max_vchans;
+	/*
+	 * The hardware has a special gate bit, which is needed to
+	 * be enabled for some SoCs with a sun6i-style DMA engine.
+	 */
+	bool gate_needed;
 };
 
 /*
@@ -1009,6 +1014,7 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 24,
 	.nr_max_vchans   = 37,
+	.gate_needed	 = true,
 };
 
 static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
@@ -1177,10 +1183,10 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	/*
 	 * sun8i variant requires us to toggle a dma gating register,
 	 * as seen in Allwinner's SDK. This register is not documented
-	 * in the A23 user manual.
+	 * in the A23 user manual, but documented at least in V3s user
+	 * manual.
 	 */
-	if (of_device_is_compatible(pdev->dev.of_node,
-				    "allwinner,sun8i-a23-dma"))
+	if (sdc->cfg->gate_needed)
 		writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE);
 
 	return 0;
-- 
2.12.2

WARNING: multiple messages have this Message-ID (diff)
From: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
To: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>,
	Takashi Iwai <tiwai-IBi9RG/b67k@public.gmane.org>
Cc: dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
Subject: [PATCH v3 5/9] dmaengine: sun6i: make gate bit in sun8i's DMA engines a common quirk
Date: Wed, 24 May 2017 18:06:03 +0800	[thread overview]
Message-ID: <20170524100607.29790-6-icenowy@aosc.io> (raw)
In-Reply-To: <20170524100607.29790-1-icenowy-h8G6r0blFSE@public.gmane.org>

From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>

Originally we enable a special gate bit when the compatible indicates
A23/33.

But according to BSP sources and user manuals, more SoCs will need this
gate bit.

So make it a common quirk configured in the config struct.

Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
---
Changes in v3:
- Stripped out the A83T gate bit set.

 drivers/dma/sun6i-dma.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index a2358780ab2c..69840cf6fe98 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -101,6 +101,11 @@ struct sun6i_dma_config {
 	u32 nr_max_channels;
 	u32 nr_max_requests;
 	u32 nr_max_vchans;
+	/*
+	 * The hardware has a special gate bit, which is needed to
+	 * be enabled for some SoCs with a sun6i-style DMA engine.
+	 */
+	bool gate_needed;
 };
 
 /*
@@ -1009,6 +1014,7 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 24,
 	.nr_max_vchans   = 37,
+	.gate_needed	 = true,
 };
 
 static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
@@ -1177,10 +1183,10 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	/*
 	 * sun8i variant requires us to toggle a dma gating register,
 	 * as seen in Allwinner's SDK. This register is not documented
-	 * in the A23 user manual.
+	 * in the A23 user manual, but documented at least in V3s user
+	 * manual.
 	 */
-	if (of_device_is_compatible(pdev->dev.of_node,
-				    "allwinner,sun8i-a23-dma"))
+	if (sdc->cfg->gate_needed)
 		writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE);
 
 	return 0;
-- 
2.12.2

WARNING: multiple messages have this Message-ID (diff)
From: icenowy@aosc.io (Icenowy Zheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 5/9] dmaengine: sun6i: make gate bit in sun8i's DMA engines a common quirk
Date: Wed, 24 May 2017 18:06:03 +0800	[thread overview]
Message-ID: <20170524100607.29790-6-icenowy@aosc.io> (raw)
In-Reply-To: <20170524100607.29790-1-icenowy@aosc.io>

From: Icenowy Zheng <icenowy@aosc.xyz>

Originally we enable a special gate bit when the compatible indicates
A23/33.

But according to BSP sources and user manuals, more SoCs will need this
gate bit.

So make it a common quirk configured in the config struct.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
Changes in v3:
- Stripped out the A83T gate bit set.

 drivers/dma/sun6i-dma.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index a2358780ab2c..69840cf6fe98 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -101,6 +101,11 @@ struct sun6i_dma_config {
 	u32 nr_max_channels;
 	u32 nr_max_requests;
 	u32 nr_max_vchans;
+	/*
+	 * The hardware has a special gate bit, which is needed to
+	 * be enabled for some SoCs with a sun6i-style DMA engine.
+	 */
+	bool gate_needed;
 };
 
 /*
@@ -1009,6 +1014,7 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 24,
 	.nr_max_vchans   = 37,
+	.gate_needed	 = true,
 };
 
 static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
@@ -1177,10 +1183,10 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	/*
 	 * sun8i variant requires us to toggle a dma gating register,
 	 * as seen in Allwinner's SDK. This register is not documented
-	 * in the A23 user manual.
+	 * in the A23 user manual, but documented at least in V3s user
+	 * manual.
 	 */
-	if (of_device_is_compatible(pdev->dev.of_node,
-				    "allwinner,sun8i-a23-dma"))
+	if (sdc->cfg->gate_needed)
 		writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE);
 
 	return 0;
-- 
2.12.2

  parent reply	other threads:[~2017-05-24 11:34 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 10:05 [PATCH v3 0/9] Add support for the audio codec on Allwinner V3s Icenowy Zheng
2017-05-24 10:05 ` Icenowy Zheng
2017-05-24 10:05 ` Icenowy Zheng
2017-05-24 10:05 ` [PATCH v3 1/9] ASoC: sun8i-codec-analog: split out mbias Icenowy Zheng
2017-05-24 10:05   ` Icenowy Zheng
2017-05-24 10:05   ` Icenowy Zheng
2017-05-24 10:33   ` [linux-sunxi] " Chen-Yu Tsai
2017-05-24 10:33     ` Chen-Yu Tsai
2017-05-24 10:33     ` Chen-Yu Tsai
2017-05-24 10:06 ` [PATCH v3 2/9] ASoC: sun8i-codec-analog: prepare a mixer control/widget/route set for V3s Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-25  3:56   ` [linux-sunxi] " Chen-Yu Tsai
2017-05-25  3:56     ` Chen-Yu Tsai
2017-05-25  3:56     ` Chen-Yu Tsai
2017-05-24 10:06 ` [PATCH v3 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-25  3:58   ` [linux-sunxi] " Chen-Yu Tsai
2017-05-25  3:58     ` Chen-Yu Tsai
2017-05-25  3:58     ` Chen-Yu Tsai
2017-05-31 16:56     ` [linux-sunxi] " Rob Herring
2017-05-31 16:56       ` Rob Herring
2017-05-31 16:56       ` Rob Herring
2017-05-31 16:55   ` Rob Herring
2017-05-31 16:55     ` Rob Herring
2017-05-31 16:55     ` Rob Herring
2017-06-06 19:06   ` Applied "ASoC: sun8i-codec-analog: add support for V3s SoC" to the asoc tree Mark Brown
2017-06-06 19:06     ` Mark Brown
2017-06-06 19:06     ` Mark Brown
2017-05-24 10:06 ` [PATCH v3 4/9] ASoC: sun4i-codec: Add support for V3s codec Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-31 16:56   ` Rob Herring
2017-05-31 16:56     ` Rob Herring
2017-05-31 16:56     ` Rob Herring
2017-06-06 19:06   ` Applied "ASoC: sun4i-codec: Add support for V3s codec" to the asoc tree Mark Brown
2017-06-06 19:06     ` Mark Brown
2017-06-06 19:06     ` Mark Brown
2017-05-24 10:06 ` Icenowy Zheng [this message]
2017-05-24 10:06   ` [PATCH v3 5/9] dmaengine: sun6i: make gate bit in sun8i's DMA engines a common quirk Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:30   ` [linux-sunxi] " Chen-Yu Tsai
2017-05-24 10:30     ` Chen-Yu Tsai
2017-05-24 10:30     ` Chen-Yu Tsai
2017-05-24 10:06 ` [PATCH v3 6/9] dmaengine: sun6i: support V3s SoC variant Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-31 16:57   ` Rob Herring
2017-05-31 16:57     ` Rob Herring
2017-05-31 16:57     ` Rob Herring
2017-05-24 10:06 ` [PATCH v3 7/9] ARM: dts: sun8i: add DMA engine in V3s DTSI Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06 ` [PATCH v3 8/9] ARM: dts: sun8i: add audio codec support into " Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06 ` [PATCH v3 9/9] ARM: sun8i: v3s: enable audio on Lichee Pi Zero Dock board Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:06   ` Icenowy Zheng
2017-05-24 10:40 ` [PATCH v3 0/9] Add support for the audio codec on Allwinner V3s Vinod Koul
2017-05-24 10:40   ` Vinod Koul
2017-05-24 10:44   ` Vinod Koul
2017-05-24 10:44     ` Vinod Koul
2017-05-24 10:44     ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170524100607.29790-6-icenowy@aosc.io \
    --to=icenowy@aosc.io \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=icenowy@aosc.xyz \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.