All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Gong <yibin.gong@nxp.com>
To: s.hauer@pengutronix.de, vkoul@kernel.org, shawnguo@kernel.org,
	u.kleine-koenig@pengutronix.de, broonie@kernel.org,
	robh+dt@kernel.org, festevam@gmail.com, dan.j.williams@intel.com,
	mark.rutland@arm.com, catalin.marinas@arm.com,
	will.deacon@arm.com, l.stach@pengutronix.de,
	martin.fuzzey@flowbird.group
Cc: kernel@pengutronix.de, linux-spi@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com,
	dmaengine@vger.kernel.org, devicetree@vger.kernel.org
Subject: [PATCH v7 12/13] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
Date: Thu, 12 Mar 2020 00:36:35 +0800	[thread overview]
Message-ID: <1583944596-23410-13-git-send-email-yibin.gong@nxp.com> (raw)
In-Reply-To: <1583944596-23410-1-git-send-email-yibin.gong@nxp.com>

Because the number of ecspi1 rx event on i.mx8mm is 0, the condition
check ignore such special case without dma channel enabled, which caused
ecspi1 rx works failed. Actually, no need to check event_id0/event_id1
and replace checking 'event_id1' with 'DMA_DEV_TO_DEV', so that configure
event_id1 only in case DEV_TO_DEV.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/imx-sdma.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 22f9f20..9d49aaf 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1183,7 +1183,7 @@ static int sdma_config_channel(struct dma_chan *chan)
 	if ((sdmac->peripheral_type != IMX_DMATYPE_MEMORY) &&
 			(sdmac->peripheral_type != IMX_DMATYPE_DSP)) {
 		/* Handle multiple event channels differently */
-		if (sdmac->event_id1) {
+		if (sdmac->direction == DMA_DEV_TO_DEV) {
 			if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP ||
 			    sdmac->peripheral_type == IMX_DMATYPE_ASRC)
 				sdma_set_watermarklevel_for_p2p(sdmac);
@@ -1351,9 +1351,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
 	sdma_channel_synchronize(chan);
 
-	if (sdmac->event_id0 >= 0)
-		sdma_event_disable(sdmac, sdmac->event_id0);
-	if (sdmac->event_id1)
+	sdma_event_disable(sdmac, sdmac->event_id0);
+
+	if (sdmac->direction == DMA_DEV_TO_DEV)
 		sdma_event_disable(sdmac, sdmac->event_id1);
 
 	sdmac->event_id0 = 0;
@@ -1651,13 +1651,11 @@ static int sdma_config(struct dma_chan *chan,
 	memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
 
 	/* Set ENBLn earlier to make sure dma request triggered after that */
-	if (sdmac->event_id0 >= 0) {
-		if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
-			return -EINVAL;
-		sdma_event_enable(sdmac, sdmac->event_id0);
-	}
+	if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
+		return -EINVAL;
+	sdma_event_enable(sdmac, sdmac->event_id0);
 
-	if (sdmac->event_id1) {
+	if (sdmac->direction == DMA_DEV_TO_DEV) {
 		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
 			return -EINVAL;
 		sdma_event_enable(sdmac, sdmac->event_id1);
-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
From: Robin Gong <yibin.gong-3arQi8VN3Tc@public.gmane.org>
To: s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	vkoul-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	l.stach-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	martin.fuzzey-X8SyT9posyX3d/wEbhiU/g@public.gmane.org
Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-imx-3arQi8VN3Tc@public.gmane.org,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v7 12/13] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
Date: Thu, 12 Mar 2020 00:36:35 +0800	[thread overview]
Message-ID: <1583944596-23410-13-git-send-email-yibin.gong@nxp.com> (raw)
In-Reply-To: <1583944596-23410-1-git-send-email-yibin.gong-3arQi8VN3Tc@public.gmane.org>

Because the number of ecspi1 rx event on i.mx8mm is 0, the condition
check ignore such special case without dma channel enabled, which caused
ecspi1 rx works failed. Actually, no need to check event_id0/event_id1
and replace checking 'event_id1' with 'DMA_DEV_TO_DEV', so that configure
event_id1 only in case DEV_TO_DEV.

Signed-off-by: Robin Gong <yibin.gong-3arQi8VN3Tc@public.gmane.org>
Acked-by: Vinod Koul <vkoul-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/dma/imx-sdma.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 22f9f20..9d49aaf 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1183,7 +1183,7 @@ static int sdma_config_channel(struct dma_chan *chan)
 	if ((sdmac->peripheral_type != IMX_DMATYPE_MEMORY) &&
 			(sdmac->peripheral_type != IMX_DMATYPE_DSP)) {
 		/* Handle multiple event channels differently */
-		if (sdmac->event_id1) {
+		if (sdmac->direction == DMA_DEV_TO_DEV) {
 			if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP ||
 			    sdmac->peripheral_type == IMX_DMATYPE_ASRC)
 				sdma_set_watermarklevel_for_p2p(sdmac);
@@ -1351,9 +1351,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
 	sdma_channel_synchronize(chan);
 
-	if (sdmac->event_id0 >= 0)
-		sdma_event_disable(sdmac, sdmac->event_id0);
-	if (sdmac->event_id1)
+	sdma_event_disable(sdmac, sdmac->event_id0);
+
+	if (sdmac->direction == DMA_DEV_TO_DEV)
 		sdma_event_disable(sdmac, sdmac->event_id1);
 
 	sdmac->event_id0 = 0;
@@ -1651,13 +1651,11 @@ static int sdma_config(struct dma_chan *chan,
 	memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
 
 	/* Set ENBLn earlier to make sure dma request triggered after that */
-	if (sdmac->event_id0 >= 0) {
-		if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
-			return -EINVAL;
-		sdma_event_enable(sdmac, sdmac->event_id0);
-	}
+	if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
+		return -EINVAL;
+	sdma_event_enable(sdmac, sdmac->event_id0);
 
-	if (sdmac->event_id1) {
+	if (sdmac->direction == DMA_DEV_TO_DEV) {
 		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
 			return -EINVAL;
 		sdma_event_enable(sdmac, sdmac->event_id1);
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Robin Gong <yibin.gong@nxp.com>
To: s.hauer@pengutronix.de, vkoul@kernel.org, shawnguo@kernel.org,
	u.kleine-koenig@pengutronix.de, broonie@kernel.org,
	robh+dt@kernel.org, festevam@gmail.com, dan.j.williams@intel.com,
	mark.rutland@arm.com, catalin.marinas@arm.com,
	will.deacon@arm.com, l.stach@pengutronix.de,
	martin.fuzzey@flowbird.group
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-imx@nxp.com,
	kernel@pengutronix.de, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 12/13] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
Date: Thu, 12 Mar 2020 00:36:35 +0800	[thread overview]
Message-ID: <1583944596-23410-13-git-send-email-yibin.gong@nxp.com> (raw)
In-Reply-To: <1583944596-23410-1-git-send-email-yibin.gong@nxp.com>

Because the number of ecspi1 rx event on i.mx8mm is 0, the condition
check ignore such special case without dma channel enabled, which caused
ecspi1 rx works failed. Actually, no need to check event_id0/event_id1
and replace checking 'event_id1' with 'DMA_DEV_TO_DEV', so that configure
event_id1 only in case DEV_TO_DEV.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/imx-sdma.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 22f9f20..9d49aaf 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1183,7 +1183,7 @@ static int sdma_config_channel(struct dma_chan *chan)
 	if ((sdmac->peripheral_type != IMX_DMATYPE_MEMORY) &&
 			(sdmac->peripheral_type != IMX_DMATYPE_DSP)) {
 		/* Handle multiple event channels differently */
-		if (sdmac->event_id1) {
+		if (sdmac->direction == DMA_DEV_TO_DEV) {
 			if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP ||
 			    sdmac->peripheral_type == IMX_DMATYPE_ASRC)
 				sdma_set_watermarklevel_for_p2p(sdmac);
@@ -1351,9 +1351,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
 	sdma_channel_synchronize(chan);
 
-	if (sdmac->event_id0 >= 0)
-		sdma_event_disable(sdmac, sdmac->event_id0);
-	if (sdmac->event_id1)
+	sdma_event_disable(sdmac, sdmac->event_id0);
+
+	if (sdmac->direction == DMA_DEV_TO_DEV)
 		sdma_event_disable(sdmac, sdmac->event_id1);
 
 	sdmac->event_id0 = 0;
@@ -1651,13 +1651,11 @@ static int sdma_config(struct dma_chan *chan,
 	memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
 
 	/* Set ENBLn earlier to make sure dma request triggered after that */
-	if (sdmac->event_id0 >= 0) {
-		if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
-			return -EINVAL;
-		sdma_event_enable(sdmac, sdmac->event_id0);
-	}
+	if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
+		return -EINVAL;
+	sdma_event_enable(sdmac, sdmac->event_id0);
 
-	if (sdmac->event_id1) {
+	if (sdmac->direction == DMA_DEV_TO_DEV) {
 		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
 			return -EINVAL;
 		sdma_event_enable(sdmac, sdmac->event_id1);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-03-11  8:36 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 16:36 [PATCH v7 00/13] add ecspi ERR009165 for i.mx6/7 soc family Robin Gong
2020-03-11 16:36 ` Robin Gong
2020-03-11 16:36 ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 01/13] Revert "ARM: dts: imx6q: Use correct SDMA script for SPI5 core" Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 02/13] Revert "ARM: dts: imx6: Use correct SDMA script for SPI cores" Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 03/13] Revert "dmaengine: imx-sdma: fix context cache" Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 04/13] Revert "dmaengine: imx-sdma: refine to load context only once" Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 05/13] dmaengine: imx-sdma: remove dupilicated sdma_load_context Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 06/13] dmaengine: imx-sdma: add mcu_2_ecspi script Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 07/13] spi: imx: fix ERR009165 Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 08/13] spi: imx: remove ERR009165 workaround on i.mx6ul Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 09/13] spi: imx: add new i.mx6ul compatible name in binding doc Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 10/13] dmaengine: imx-sdma: remove ERR009165 on i.mx6ul Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 11/13] dma: imx-sdma: add i.mx6ul compatible name Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` Robin Gong [this message]
2020-03-11 16:36   ` [PATCH v7 12/13] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-03-11 16:36 ` [PATCH v7 13/13] dmaengine: imx-sdma: add uart rom script Robin Gong
2020-03-11 16:36   ` Robin Gong
2020-04-15  8:41 ` [PATCH v7 00/13] add ecspi ERR009165 for i.mx6/7 soc family Robin Gong
2020-04-15  8:41   ` Robin Gong
2020-04-15  9:19   ` Mark Brown
2020-04-15  9:19     ` Mark Brown
2020-04-15 13:57     ` Robin Gong
2020-04-15 13:57       ` Robin Gong
2020-04-15  9:47 ` Fuzzey, Martin
2020-04-15  9:47   ` Fuzzey, Martin
2020-04-15 14:06   ` Robin Gong
2020-04-15 14:06     ` Robin Gong

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=1583944596-23410-13-git-send-email-yibin.gong@nxp.com \
    --to=yibin.gong@nxp.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.fuzzey@flowbird.group \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vkoul@kernel.org \
    --cc=will.deacon@arm.com \
    /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.