Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Robin Gong <yibin.gong@nxp.com>
To: "robh@kernel.org" <robh@kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"plyatov@gmail.com" <plyatov@gmail.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH v4 11/14] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
Date: Wed, 22 May 2019 10:00:44 +0000
Message-ID: <1558548188-1155-12-git-send-email-yibin.gong@nxp.com> (raw)
In-Reply-To: <1558548188-1155-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>
---
 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 a495c7f..b692783 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1202,7 +1202,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);
@@ -1370,9 +1370,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
 	sdma_channel_synchronize(chan);
 
-	if (sdmac->event_id0)
-		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;
@@ -1670,13 +1670,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) {
-		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 index

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  9:59 [PATCH v4 00/14] add ecspi ERR009165 for i.mx6/7 soc family Robin Gong
2019-05-22  9:59 ` [PATCH v4 01/14] Revert "ARM: dts: imx6q: Use correct SDMA script for SPI5 core" Robin Gong
2019-05-22  9:59 ` [PATCH v4 02/14] Revert "ARM: dts: imx6: Use correct SDMA script for SPI cores" Robin Gong
2019-05-22  9:59 ` [PATCH v4 03/14] Revert "dmaengine: imx-sdma: refine to load context only once" Robin Gong
2019-05-22 10:00 ` [PATCH v4 04/14] dmaengine: imx-sdma: remove dupilicated sdma_load_context Robin Gong
2019-05-22 10:00 ` [PATCH v4 05/14] dmaengine: imx-sdma: add mcu_2_ecspi script Robin Gong
2019-05-22 10:00 ` [PATCH v4 06/14] spi: imx: fix ERR009165 Robin Gong
2019-05-22 10:00 ` [PATCH v4 07/14] spi: imx: remove ERR009165 workaround on i.mx6ul Robin Gong
2019-05-22 10:00 ` [PATCH v4 08/14] spi: imx: add new i.mx6ul compatible name in binding doc Robin Gong
2019-05-22 10:00 ` [PATCH v4 09/14] dmaengine: imx-sdma: remove ERR009165 on i.mx6ul Robin Gong
2019-05-22 10:00 ` [PATCH v4 10/14] dma: imx-sdma: add i.mx6ul/6sx compatible name Robin Gong
2019-05-22 13:51   ` Rob Herring
2019-05-23  2:08     ` [EXT] " Robin Gong
2019-05-22 10:00 ` Robin Gong [this message]
2019-05-23  5:34   ` [PATCH v4 11/14] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm Vinod Koul
2019-05-22 10:00 ` [PATCH v4 12/14] ARM: dts: imx6ul: add dma support on ecspi Robin Gong
2019-05-22 10:00 ` [PATCH v4 13/14] ARM: dts: imx6sll: correct sdma compatible Robin Gong
2019-05-22 10:01 ` [PATCH v4 14/14] arm64: defconfig: Enable SDMA on i.mx8mq/8mm Robin Gong
2019-05-22 10:10 ` [PATCH v4 00/14] add ecspi ERR009165 for i.mx6/7 soc family Lucas Stach

Reply instructions:

You may reply publically 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=1558548188-1155-12-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=plyatov@gmail.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vkoul@kernel.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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox