DMA Engine development
 help / color / mirror / Atom feed
* Re: [V2 1/2] dmaengine: fsl-qdma: fixed the source/destination descriptor format
From: Vinod Koul @ 2019-05-21  4:34 UTC (permalink / raw)
  To: Peng Ma; +Cc: dan.j.williams, leoyang.li, dmaengine, linux-kernel
In-Reply-To: <20190506022111.31751-1-peng.ma@nxp.com>

On 06-05-19, 10:21, Peng Ma wrote:
> CMD of Source/Destination descriptor format should be lower of
> struct fsl_qdma_engine number data address.
> 
> Signed-off-by: Peng Ma <peng.ma@nxp.com>
> ---
> changed for V2:
> 	- Fix descriptor spelling
> 
>  drivers/dma/fsl-qdma.c |   25 +++++++++++++++++--------
>  1 files changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c
> index aa1d0ae..2e8b46b 100644
> --- a/drivers/dma/fsl-qdma.c
> +++ b/drivers/dma/fsl-qdma.c
> @@ -113,6 +113,7 @@
>  /* Field definition for Descriptor offset */
>  #define QDMA_CCDF_STATUS		20
>  #define QDMA_CCDF_OFFSET		20
> +#define QDMA_SDDF_CMD(x)		(((u64)(x)) << 32)
>  
>  /* Field definition for safe loop count*/
>  #define FSL_QDMA_HALT_COUNT		1500
> @@ -214,6 +215,12 @@ struct fsl_qdma_engine {
>  
>  };
>  
> +static inline void
> +qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val)
> +{
> +	sddf->data = QDMA_SDDF_CMD(val);
> +}

Do you really need this helper which calls another macro!

> +
>  static inline u64
>  qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)
>  {
> @@ -341,6 +348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan)
>  static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
>  				      dma_addr_t dst, dma_addr_t src, u32 len)
>  {
> +	u32 cmd;
>  	struct fsl_qdma_format *sdf, *ddf;
>  	struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest;
>  
> @@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
>  
>  	memset(fsl_comp->virt_addr, 0, FSL_QDMA_COMMAND_BUFFER_SIZE);
>  	memset(fsl_comp->desc_virt_addr, 0, FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
> +

why did you add a blank line in this 'fix', it does not belong here!

>  	/* Head Command Descriptor(Frame Descriptor) */
>  	qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16);
>  	qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf));
> @@ -369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
>  	/* This entry is the last entry. */
>  	qdma_csgf_set_f(csgf_dest, len);
>  	/* Descriptor Buffer */
> -	sdf->data =
> -		cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
> -			    FSL_QDMA_CMD_RWTTYPE_OFFSET);
> -	ddf->data =
> -		cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
> -			    FSL_QDMA_CMD_RWTTYPE_OFFSET);
> -	ddf->data |=
> -		cpu_to_le64(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
> +	cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
> +			  FSL_QDMA_CMD_RWTTYPE_OFFSET);
> +	qdma_sddf_set_cmd(sdf, cmd);

why not do sddf->data = QDMA_SDDF_CMD(cmd);

> +
> +	cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
> +			  FSL_QDMA_CMD_RWTTYPE_OFFSET);
> +	cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
> +	qdma_sddf_set_cmd(ddf, cmd);
>  }
>  
>  /*
> -- 
> 1.7.1

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH] dmaengine: jz4780: Fix transfers being ACKed too soon
From: Vinod Koul @ 2019-05-21  4:30 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Dan Williams, od, dmaengine, linux-kernel
In-Reply-To: <20190504213757.6693-1-paul@crapouillou.net>

On 04-05-19, 23:37, Paul Cercueil wrote:
> When a multi-descriptor DMA transfer is in progress, the "IRQ pending"
> flag will apparently be set for that channel as soon as the last
> descriptor loads, way before the IRQ actually happens. This behaviour
> has been observed on the JZ4725B, but maybe other SoCs are affected.
> 
> In the case where another DMA transfer is running into completion on a
> separate channel, the IRQ handler would then run the completion handler
> for our previous channel even if the transfer didn't actually finish.
> 
> Fix this by checking in the completion handler that we're indeed done;
> if not the interrupted DMA transfer will simply be resumed.

Applied, thanks

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH] dmaengine: jz4780: Use SPDX license notifier
From: Vinod Koul @ 2019-05-21  4:27 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Zubair Lutfullah Kakakhel, Dan Williams, od, dmaengine,
	linux-kernel
In-Reply-To: <20190504213432.6356-1-paul@crapouillou.net>

On 04-05-19, 23:34, Paul Cercueil wrote:
> Use SPDX license notifier instead of plain text in the header.

Applied, thanks

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH v2] dmaengine: sudmac: remove unused driver
From: Vinod Koul @ 2019-05-21  4:23 UTC (permalink / raw)
  To: Simon Horman
  Cc: dmaengine, linux-renesas-soc, Magnus Damm, Yoshihiro Shimoda,
	Sergei Shtylyov
In-Reply-To: <20190513113951.14817-1-horms+renesas@verge.net.au>

On 13-05-19, 13:39, Simon Horman wrote:
> SUDMAC driver was introduced in v3.10 but was never integrated for use
> by any platform. As it is unused remove it.

Applied, thanks

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH v3 11/14] dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
From: Vinod Koul @ 2019-05-21  4:18 UTC (permalink / raw)
  To: Robin Gong
  Cc: robh@kernel.org, broonie@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, festevam@gmail.com, mark.rutland@arm.com,
	u.kleine-koenig@pengutronix.de, plyatov@gmail.com,
	dan.j.williams@intel.com, catalin.marinas@arm.com,
	will.deacon@arm.com, l.stach@pengutronix.de, dl-linux-imx,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org, kernel@pengutronix.de
In-Reply-To: <1557249513-4903-12-git-send-email-yibin.gong@nxp.com>

On 07-05-19, 09:16, Robin Gong wrote:
> 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, checking
> event_id1 is enough for DEV_2_DEV case because it's so lucky that event_id1
> never be 0.

Well is that by chance or design that event_id1 will be never 0?

> 
> Signed-off-by: Robin Gong <yibin.gong@nxp.com>
> ---
>  drivers/dma/imx-sdma.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index a495c7f..86594fc 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -1370,8 +1370,8 @@ 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);
> +	sdma_event_disable(sdmac, sdmac->event_id0);
> +
>  	if (sdmac->event_id1)
>  		sdma_event_disable(sdmac, sdmac->event_id1);
>  
> @@ -1670,11 +1670,9 @@ 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->event_id1 >= sdmac->sdma->drvdata->num_events)
> -- 
> 2.7.4
> 

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH v3 09/14] dmaengine: imx-sdma: remove ERR009165 on i.mx6ul
From: Vinod Koul @ 2019-05-21  4:17 UTC (permalink / raw)
  To: Robin Gong
  Cc: robh@kernel.org, broonie@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, festevam@gmail.com, mark.rutland@arm.com,
	u.kleine-koenig@pengutronix.de, plyatov@gmail.com,
	dan.j.williams@intel.com, catalin.marinas@arm.com,
	will.deacon@arm.com, l.stach@pengutronix.de, dl-linux-imx,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org, kernel@pengutronix.de
In-Reply-To: <1557249513-4903-10-git-send-email-yibin.gong@nxp.com>

On 07-05-19, 09:16, Robin Gong wrote:
> ECSPI issue fixed from i.mx6ul at hardware level, no need
> ERR009165 anymore on those chips such as i.mx8mq. Add i.mx6sx
> from where i.mx6ul source.

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH v3 05/14] dmaengine: imx-sdma: add mcu_2_ecspi script
From: Vinod Koul @ 2019-05-21  4:16 UTC (permalink / raw)
  To: Robin Gong
  Cc: robh@kernel.org, broonie@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, festevam@gmail.com, mark.rutland@arm.com,
	u.kleine-koenig@pengutronix.de, plyatov@gmail.com,
	dan.j.williams@intel.com, catalin.marinas@arm.com,
	will.deacon@arm.com, l.stach@pengutronix.de, dl-linux-imx,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org, kernel@pengutronix.de
In-Reply-To: <1557249513-4903-6-git-send-email-yibin.gong@nxp.com>

On 07-05-19, 09:16, Robin Gong wrote:
> Add mcu_2_ecspi script to fix ecspi errata ERR009165.

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

^ permalink raw reply

* Re: [PATCH v3 04/14] dmaengine: imx-sdma: remove dupilicated sdma_load_context
From: Vinod Koul @ 2019-05-21  4:15 UTC (permalink / raw)
  To: Robin Gong
  Cc: robh@kernel.org, broonie@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, festevam@gmail.com, mark.rutland@arm.com,
	u.kleine-koenig@pengutronix.de, plyatov@gmail.com,
	dan.j.williams@intel.com, catalin.marinas@arm.com,
	will.deacon@arm.com, l.stach@pengutronix.de, dl-linux-imx,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org, kernel@pengutronix.de
In-Reply-To: <1557249513-4903-5-git-send-email-yibin.gong@nxp.com>

On 07-05-19, 09:16, Robin Gong wrote:
> Since sdma_transfer_init() will do sdma_load_context before any
> sdma transfer, no need once more in sdma_config_channel().

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

^ permalink raw reply

* [PATCH v2 8/8] dmaengine: sh: usb-dmac: Let the core do the device node validation
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/sh/usb-dmac.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index 59403f6..0afabf3 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -636,9 +636,6 @@ static bool usb_dmac_chan_filter(struct dma_chan *chan, void *arg)
 	struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
 	struct of_phandle_args *dma_spec = arg;
 
-	if (dma_spec->np != chan->device->dev->of_node)
-		return false;
-
 	/* USB-DMAC should be used with fixed usb controller's FIFO */
 	if (uchan->index != dma_spec->args[0])
 		return false;
@@ -659,7 +656,8 @@ static struct dma_chan *usb_dmac_of_xlate(struct of_phandle_args *dma_spec,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	chan = dma_request_channel(mask, usb_dmac_chan_filter, dma_spec);
+	chan = __dma_request_channel(&mask, usb_dmac_chan_filter, dma_spec,
+				     ofdma->of_node);
 	if (!chan)
 		return NULL;
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 7/8] dmaengine: sh: rcar-dmac: Let the core do the device node validation
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/sh/rcar-dmac.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 33ab1b6..67df54a 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1654,8 +1654,7 @@ static bool rcar_dmac_chan_filter(struct dma_chan *chan, void *arg)
 	 * Forcing it to call dma_request_channel() and iterate through all
 	 * channels from all controllers is just pointless.
 	 */
-	if (chan->device->device_config != rcar_dmac_device_config ||
-	    dma_spec->np != chan->device->dev->of_node)
+	if (chan->device->device_config != rcar_dmac_device_config)
 		return false;
 
 	return !test_and_set_bit(dma_spec->args[0], dmac->modules);
@@ -1675,7 +1674,8 @@ static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	chan = dma_request_channel(mask, rcar_dmac_chan_filter, dma_spec);
+	chan = __dma_request_channel(&mask, rcar_dmac_chan_filter, dma_spec,
+				     ofdma->of_node);
 	if (!chan)
 		return NULL;
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 6/8] dmaengine: mxs-dma: Let the core do the device node validation
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/mxs-dma.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 22cc7f6..8ce5e79 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -716,7 +716,6 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
 }
 
 struct mxs_dma_filter_param {
-	struct device_node *of_node;
 	unsigned int chan_id;
 };
 
@@ -727,9 +726,6 @@ static bool mxs_dma_filter_fn(struct dma_chan *chan, void *fn_param)
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
 	int chan_irq;
 
-	if (mxs_dma->dma_device.dev->of_node != param->of_node)
-		return false;
-
 	if (chan->chan_id != param->chan_id)
 		return false;
 
@@ -752,13 +748,13 @@ static struct dma_chan *mxs_dma_xlate(struct of_phandle_args *dma_spec,
 	if (dma_spec->args_count != 1)
 		return NULL;
 
-	param.of_node = ofdma->of_node;
 	param.chan_id = dma_spec->args[0];
 
 	if (param.chan_id >= mxs_dma->nr_channels)
 		return NULL;
 
-	return dma_request_channel(mask, mxs_dma_filter_fn, &param);
+	return __dma_request_channel(&mask, mxs_dma_filter_fn, &param,
+				     ofdma->of_node);
 }
 
 static int __init mxs_dma_probe(struct platform_device *pdev)
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 5/8] dmaengine: mmp_tdma: Let the core do the device node validation
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/mmp_tdma.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index 0c56faa0..e76858b 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -586,18 +586,12 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev,
 }
 
 struct mmp_tdma_filter_param {
-	struct device_node *of_node;
 	unsigned int chan_id;
 };
 
 static bool mmp_tdma_filter_fn(struct dma_chan *chan, void *fn_param)
 {
 	struct mmp_tdma_filter_param *param = fn_param;
-	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
-	struct dma_device *pdma_device = tdmac->chan.device;
-
-	if (pdma_device->dev->of_node != param->of_node)
-		return false;
 
 	if (chan->chan_id != param->chan_id)
 		return false;
@@ -615,13 +609,13 @@ static struct dma_chan *mmp_tdma_xlate(struct of_phandle_args *dma_spec,
 	if (dma_spec->args_count != 1)
 		return NULL;
 
-	param.of_node = ofdma->of_node;
 	param.chan_id = dma_spec->args[0];
 
 	if (param.chan_id >= TDMA_CHANNEL_NUM)
 		return NULL;
 
-	return dma_request_channel(mask, mmp_tdma_filter_fn, &param);
+	return __dma_request_channel(&mask, mmp_tdma_filter_fn, &param,
+				     ofdma->of_node);
 }
 
 static const struct of_device_id mmp_tdma_dt_ids[] = {
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 4/8] dmaengine: dma-jz4780: Let the core do the device node validation
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/dma-jz4780.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index 9ce0a38..7e1d381 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -160,7 +160,6 @@ struct jz4780_dma_dev {
 };
 
 struct jz4780_dma_filter_data {
-	struct device_node *of_node;
 	uint32_t transfer_type;
 	int channel;
 };
@@ -765,8 +764,6 @@ static bool jz4780_dma_filter_fn(struct dma_chan *chan, void *param)
 	struct jz4780_dma_dev *jzdma = jz4780_dma_chan_parent(jzchan);
 	struct jz4780_dma_filter_data *data = param;
 
-	if (jzdma->dma_device.dev->of_node != data->of_node)
-		return false;
 
 	if (data->channel > -1) {
 		if (data->channel != jzchan->id)
@@ -790,7 +787,6 @@ static struct dma_chan *jz4780_of_dma_xlate(struct of_phandle_args *dma_spec,
 	if (dma_spec->args_count != 2)
 		return NULL;
 
-	data.of_node = ofdma->of_node;
 	data.transfer_type = dma_spec->args[0];
 	data.channel = dma_spec->args[1];
 
@@ -815,7 +811,8 @@ static struct dma_chan *jz4780_of_dma_xlate(struct of_phandle_args *dma_spec,
 		return dma_get_slave_channel(
 			&jzdma->chan[data.channel].vchan.chan);
 	} else {
-		return dma_request_channel(mask, jz4780_dma_filter_fn, &data);
+		return __dma_request_channel(&mask, jz4780_dma_filter_fn, &data,
+					     ofdma->of_node);
 	}
 }
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 3/8] dmaengine: imx-sdma: Let the core do the device node validation
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/imx-sdma.c                |    9 ++-------
 include/linux/platform_data/dma-imx.h |    1 -
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 99d9f43..ca296f0 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1934,16 +1934,11 @@ static int sdma_init(struct sdma_engine *sdma)
 static bool sdma_filter_fn(struct dma_chan *chan, void *fn_param)
 {
 	struct sdma_channel *sdmac = to_sdma_chan(chan);
-	struct sdma_engine *sdma = sdmac->sdma;
 	struct imx_dma_data *data = fn_param;
 
 	if (!imx_dma_is_general_purpose(chan))
 		return false;
 
-	/* return false if it's not the right device */
-	if (sdma->dev->of_node != data->of_node)
-		return false;
-
 	sdmac->data = *data;
 	chan->private = &sdmac->data;
 
@@ -1971,9 +1966,9 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
 	 * be set to sdmac->event_id1.
 	 */
 	data.dma_request2 = 0;
-	data.of_node = ofdma->of_node;
 
-	return dma_request_channel(mask, sdma_filter_fn, &data);
+	return __dma_request_channel(&mask, sdma_filter_fn, &data,
+				     ofdma->of_node);
 }
 
 static int sdma_probe(struct platform_device *pdev)
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index 9daea8d..7d964e7 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -55,7 +55,6 @@ struct imx_dma_data {
 	int dma_request2; /* secondary DMA request line */
 	enum sdma_peripheral_type peripheral_type;
 	int priority;
-	struct device_node *of_node;
 };
 
 static inline int imx_dma_is_ipu(struct dma_chan *chan)
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 2/8] soc: tegra: fuse: Use dma_request_channel instead of __dma_request_channel()
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

The __dma_request_channel() prototype has been changed to help to do
device node validation, thus we can use dma_request_channel() instead
of __dma_request_channel() to keep kernel bisectable.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/soc/tegra/fuse/fuse-tegra20.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c b/drivers/soc/tegra/fuse/fuse-tegra20.c
index 49ff017..f40a06f 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra20.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra20.c
@@ -110,7 +110,7 @@ static int tegra20_fuse_probe(struct tegra_fuse *fuse)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	fuse->apbdma.chan = __dma_request_channel(&mask, dma_filter, NULL);
+	fuse->apbdma.chan = dma_request_channel(mask, dma_filter, NULL);
 	if (!fuse->apbdma.chan)
 		return -EPROBE_DEFER;
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 1/8] dmaengine: Add matching device node validation in __dma_request_channel()
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel
In-Reply-To: <cover.1558351667.git.baolin.wang@linaro.org>

When user try to request one DMA channel by __dma_request_channel(), it won't
validate if it is the correct DMA device to request, that will lead each DMA
engine driver to validate the correct device node in their filter function
if it is necessary.

Thus we can add the matching device node validation in the DMA engine core,
to remove all of device node validation in the drivers.

Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/dmaengine.c   |   10 ++++++++--
 drivers/dma/of-dma.c      |    4 ++--
 include/linux/dmaengine.h |   12 ++++++++----
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 3a11b10..610080c 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -641,11 +641,13 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
  * @mask: capabilities that the channel must satisfy
  * @fn: optional callback to disposition available channels
  * @fn_param: opaque parameter to pass to dma_filter_fn
+ * @np: device node to look for DMA channels
  *
  * Returns pointer to appropriate DMA channel on success or NULL.
  */
 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
-				       dma_filter_fn fn, void *fn_param)
+				       dma_filter_fn fn, void *fn_param,
+				       struct device_node *np)
 {
 	struct dma_device *device, *_d;
 	struct dma_chan *chan = NULL;
@@ -653,6 +655,10 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
 	/* Find a channel */
 	mutex_lock(&dma_list_mutex);
 	list_for_each_entry_safe(device, _d, &dma_device_list, global_node) {
+		/* Finds a DMA controller with matching device node */
+		if (np && device->dev->of_node && np != device->dev->of_node)
+			continue;
+
 		chan = find_candidate(device, mask, fn, fn_param);
 		if (!IS_ERR(chan))
 			break;
@@ -769,7 +775,7 @@ struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask)
 	if (!mask)
 		return ERR_PTR(-ENODEV);
 
-	chan = __dma_request_channel(mask, NULL, NULL);
+	chan = __dma_request_channel(mask, NULL, NULL, NULL);
 	if (!chan) {
 		mutex_lock(&dma_list_mutex);
 		if (list_empty(&dma_device_list))
diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 91fd395..6b43d04 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -316,8 +316,8 @@ struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
 	if (count != 1)
 		return NULL;
 
-	return dma_request_channel(info->dma_cap, info->filter_fn,
-			&dma_spec->args[0]);
+	return __dma_request_channel(&info->dma_cap, info->filter_fn,
+				     &dma_spec->args[0], dma_spec->np);
 }
 EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
 
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d49ec5c..504085b 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1314,7 +1314,8 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
 enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
 void dma_issue_pending_all(void);
 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
-					dma_filter_fn fn, void *fn_param);
+				       dma_filter_fn fn, void *fn_param,
+				       struct device_node *np);
 struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
 
 struct dma_chan *dma_request_chan(struct device *dev, const char *name);
@@ -1339,7 +1340,9 @@ static inline void dma_issue_pending_all(void)
 {
 }
 static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
-					      dma_filter_fn fn, void *fn_param)
+						     dma_filter_fn fn,
+						     void *fn_param,
+						     struct device_node *np)
 {
 	return NULL;
 }
@@ -1411,7 +1414,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
 void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
 struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
 struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
-#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
+#define dma_request_channel(mask, x, y) \
+	__dma_request_channel(&(mask), x, y, NULL)
 #define dma_request_slave_channel_compat(mask, x, y, dev, name) \
 	__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
 
@@ -1429,6 +1433,6 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
 	if (!fn || !fn_param)
 		return NULL;
 
-	return __dma_request_channel(mask, fn, fn_param);
+	return __dma_request_channel(mask, fn, fn_param, NULL);
 }
 #endif /* DMAENGINE_H */
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 0/8] Add matching device node validation in DMA engine core
From: Baolin Wang @ 2019-05-20 11:32 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: thierry.reding, jonathanh, linux-tegra, shawnguo, s.hauer, kernel,
	festevam, linux-imx, wsa+renesas, jroedel, vincent.guittot,
	baolin.wang, dmaengine, linux-kernel, linux-arm-kernel

Hi,

This patch set adds a device node validation in DMA engine core, that will
help some drivers to remove the duplicate device node validation in each
driver.

Any comments are welcome. Thanks.

Changes from v1:
 - Add test-by tag from Peter.
 - Use dma_request_channel instead of __dma_request_channel() for
 the fuse-tegra20.c driver to keep bisectable.

Baolin Wang (8):
  dmaengine: Add matching device node validation in
    __dma_request_channel()
  soc: tegra: fuse: Use dma_request_channel instead of
    __dma_request_channel()
  dmaengine: imx-sdma: Let the core do the device node validation
  dmaengine: dma-jz4780: Let the core do the device node validation
  dmaengine: mmp_tdma: Let the core do the device node validation
  dmaengine: mxs-dma: Let the core do the device node validation
  dmaengine: sh: rcar-dmac: Let the core do the device node validation
  dmaengine: sh: usb-dmac: Let the core do the device node validation

 drivers/dma/dma-jz4780.c              |    7 ++-----
 drivers/dma/dmaengine.c               |   10 ++++++++--
 drivers/dma/imx-sdma.c                |    9 ++-------
 drivers/dma/mmp_tdma.c                |   10 ++--------
 drivers/dma/mxs-dma.c                 |    8 ++------
 drivers/dma/of-dma.c                  |    4 ++--
 drivers/dma/sh/rcar-dmac.c            |    6 +++---
 drivers/dma/sh/usb-dmac.c             |    6 ++----
 drivers/soc/tegra/fuse/fuse-tegra20.c |    2 +-
 include/linux/dmaengine.h             |   12 ++++++++----
 include/linux/platform_data/dma-imx.h |    1 -
 11 files changed, 32 insertions(+), 43 deletions(-)

-- 
1.7.9.5


^ permalink raw reply

* Re: [PATCH 1/8] dmaengine: Add matching device node validation in __dma_request_channel()
From: Baolin Wang @ 2019-05-20 11:27 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Dan Williams, Vinod Koul, Thierry Reding, Jon Hunter, linux-tegra,
	Shawn Guo, s.hauer, kernel, festevam, linux-imx, Zubair.Kakakhel,
	Wolfram Sang, jroedel, Vincent Guittot, dmaengine, LKML,
	Linux ARM
In-Reply-To: <42b84cfe-3281-7f4e-03cc-6ca126e16191@ti.com>

On Tue, 7 May 2019 at 16:37, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
>
> Hi,
>
> On 07/05/2019 9.09, Baolin Wang wrote:
> > When user try to request one DMA channel by __dma_request_channel(), it won't
> > validate if it is the correct DMA device to request, that will lead each DMA
> > engine driver to validate the correct device node in their filter function
> > if it is necessary.
> >
> > Thus we can add the matching device node validation in the DMA engine core,
> > to remove all of device node validation in the drivers.
>
> I have picked this patch to my TI UDMA series and with
> __dma_request_channel() it works as expected - picking the channel from
> the correct DMA device.
>
> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Thanks Peter.

>
> >
> > Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> > ---
> >  drivers/dma/dmaengine.c   |   10 ++++++++--
> >  drivers/dma/of-dma.c      |    4 ++--
> >  include/linux/dmaengine.h |   12 ++++++++----
> >  3 files changed, 18 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> > index 3a11b10..610080c 100644
> > --- a/drivers/dma/dmaengine.c
> > +++ b/drivers/dma/dmaengine.c
> > @@ -641,11 +641,13 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
> >   * @mask: capabilities that the channel must satisfy
> >   * @fn: optional callback to disposition available channels
> >   * @fn_param: opaque parameter to pass to dma_filter_fn
> > + * @np: device node to look for DMA channels
> >   *
> >   * Returns pointer to appropriate DMA channel on success or NULL.
> >   */
> >  struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
> > -                                    dma_filter_fn fn, void *fn_param)
> > +                                    dma_filter_fn fn, void *fn_param,
> > +                                    struct device_node *np)
> >  {
> >       struct dma_device *device, *_d;
> >       struct dma_chan *chan = NULL;
> > @@ -653,6 +655,10 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
> >       /* Find a channel */
> >       mutex_lock(&dma_list_mutex);
> >       list_for_each_entry_safe(device, _d, &dma_device_list, global_node) {
> > +             /* Finds a DMA controller with matching device node */
> > +             if (np && device->dev->of_node && np != device->dev->of_node)
> > +                     continue;
> > +
> >               chan = find_candidate(device, mask, fn, fn_param);
> >               if (!IS_ERR(chan))
> >                       break;
> > @@ -769,7 +775,7 @@ struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask)
> >       if (!mask)
> >               return ERR_PTR(-ENODEV);
> >
> > -     chan = __dma_request_channel(mask, NULL, NULL);
> > +     chan = __dma_request_channel(mask, NULL, NULL, NULL);
> >       if (!chan) {
> >               mutex_lock(&dma_list_mutex);
> >               if (list_empty(&dma_device_list))
> > diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
> > index 91fd395..6b43d04 100644
> > --- a/drivers/dma/of-dma.c
> > +++ b/drivers/dma/of-dma.c
> > @@ -316,8 +316,8 @@ struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> >       if (count != 1)
> >               return NULL;
> >
> > -     return dma_request_channel(info->dma_cap, info->filter_fn,
> > -                     &dma_spec->args[0]);
> > +     return __dma_request_channel(&info->dma_cap, info->filter_fn,
> > +                                  &dma_spec->args[0], dma_spec->np);
> >  }
> >  EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
> >
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index d49ec5c..504085b 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -1314,7 +1314,8 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
> >  enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
> >  void dma_issue_pending_all(void);
> >  struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
> > -                                     dma_filter_fn fn, void *fn_param);
> > +                                    dma_filter_fn fn, void *fn_param,
> > +                                    struct device_node *np);
> >  struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
> >
> >  struct dma_chan *dma_request_chan(struct device *dev, const char *name);
> > @@ -1339,7 +1340,9 @@ static inline void dma_issue_pending_all(void)
> >  {
> >  }
> >  static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
> > -                                           dma_filter_fn fn, void *fn_param)
> > +                                                  dma_filter_fn fn,
> > +                                                  void *fn_param,
> > +                                                  struct device_node *np)
> >  {
> >       return NULL;
> >  }
> > @@ -1411,7 +1414,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
> >  void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
> >  struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
> >  struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
> > -#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
> > +#define dma_request_channel(mask, x, y) \
> > +     __dma_request_channel(&(mask), x, y, NULL)
> >  #define dma_request_slave_channel_compat(mask, x, y, dev, name) \
> >       __dma_request_slave_channel_compat(&(mask), x, y, dev, name)
> >
> > @@ -1429,6 +1433,6 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
> >       if (!fn || !fn_param)
> >               return NULL;
> >
> > -     return __dma_request_channel(mask, fn, fn_param);
> > +     return __dma_request_channel(mask, fn, fn_param, NULL);
> >  }
> >  #endif /* DMAENGINE_H */
> >
>
> - Péter
>
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



-- 
Baolin Wang
Best Regards

^ permalink raw reply

* Re: [EXT] Re: [PATCH v3 00/14] add ecspi ERR009165 for i.mx6/7 soc family
From: Robin Gong @ 2019-05-17  9:54 UTC (permalink / raw)
  To: u.kleine-koenig@pengutronix.de, festevam@gmail.com,
	plyatov@gmail.com, broonie@kernel.org, dan.j.williams@intel.com,
	mark.rutland@arm.com, catalin.marinas@arm.com,
	will.deacon@arm.com, robh@kernel.org, shawnguo@kernel.org,
	vkoul@kernel.org, l.stach@pengutronix.de, s.hauer@pengutronix.de
  Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	dmaengine@vger.kernel.org, dl-linux-imx, kernel@pengutronix.de,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
In-Reply-To: <1557739890.3997.1.camel@pengutronix.de>

On 2019-05-13 at 09:31 +0000, Lucas Stach wrote:
> PS:
> >   Please get sdma firmware from below linux-firmware and copy it to
> > your
> > local rootfs /lib/firmware/imx/sdma.
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fg
> > it.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ffirmware%2Flinux
> > -firmware.git%2Ftree%2Fimx%2Fsdma&amp;data=02%7C01%7Cyibin.gong%40n
> > xp.com%7C57eb30c03c9345e2c27e08d6d785cca3%7C686ea1d3bc2b4c6fa92cd99
> > c5c301635%7C0%7C0%7C636933366995692430&amp;sdata=wLKa2qwkIMlN%2BeeD
> > 4LOGE%2FtIFzvGKXyIhoZ4Fekr4vI%3D&amp;reserved=0
> This series is unfit for merging, as long as it depends on a SDMA RAM
> script that is known to break serial DMA. When can we expect to get a
> firmware version with the broken serial script removed out into the
> public?
Hi Lucas,
  I want to sent another patch for fixing UART failure on ram script
later after this ecspi patch set accepted. But now I'm still waiting
for ack from Vinod who is owner of dmaengine.
> 
> Regards,
> Lucas
> 
> > 
> > v2:
> >   1. add commit log for reverted patches.
> >   2. add comment for 'ecspi_fixed' in sdma driver.
> >   3. add 'fsl,imx6sll-ecspi' compatible instead of 'fsl,imx6ul-
> > ecspi'
> >      rather than remove.
> > v3:
> >   1. confirm with design team make sure ERR009165 fixed on
> > i.mx6ul/i.mx6ull
> >   /i.mx6sll, not fixed on i.mx8m/8mm and other i.mx6/7 legacy
> > chips.
> >   Correct dts related dts patch in v2.
> >   2. clean eratta information in binding doc and new
> > 'tx_glitch_fixed' flag
> >   in spi-imx driver to state ERR009165 fixed or not.
> >   3. Enlarge burst size to fifo size for tx since tx_wml set to 0
> > in the
> >   errata workaroud, thus improve performance as possible.
> > 
> > Robin Gong (14):
> >   Revert "ARM: dts: imx6q: Use correct SDMA script for SPI5 core"
> >   Revert "ARM: dts: imx6: Use correct SDMA script for SPI cores"
> >   Revert "dmaengine: imx-sdma: refine to load context only once"
> >   dmaengine: imx-sdma: remove dupilicated sdma_load_context
> >   dmaengine: imx-sdma: add mcu_2_ecspi script
> >   spi: imx: fix ERR009165
> >   spi: imx: remove ERR009165 workaround on i.mx6ul
> >   dt-bindings: spi: imx: add new i.mx6ul compatible name
> >   dmaengine: imx-sdma: remove ERR009165 on i.mx6ul
> >   dt-bindings: dma: imx-sdma: add i.mx6ul/6sx compatible name
> >   dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
> >   ARM: dts: imx6ul: add dma support on ecspi
> >   ARM: dts: imx6sll: correct sdma compatible
> >   arm64: defconfig: Enable SDMA on i.mx8mq/8mm
> > 
> >  .../devicetree/bindings/dma/fsl-imx-sdma.txt       |  2 +
> >  .../devicetree/bindings/spi/fsl-imx-cspi.txt       |  1 +
> >  arch/arm/boot/dts/imx6q.dtsi                       |  2 +-
> >  arch/arm/boot/dts/imx6qdl.dtsi                     |  8 +--
> >  arch/arm/boot/dts/imx6sll.dtsi                     |  2 +-
> >  arch/arm/boot/dts/imx6ul.dtsi                      |  8 +++
> >  arch/arm64/configs/defconfig                       |  3 +
> >  drivers/dma/imx-sdma.c                             | 78
> > ++++++++++++++++------
> >  drivers/spi/spi-imx.c                              | 61
> > ++++++++++++++---
> >  include/linux/platform_data/dma-imx-sdma.h         |  1 +
> >  10 files changed, 132 insertions(+), 34 deletions(-)
> > 
> > --
> > 2.7.4
> > 

^ permalink raw reply

* Re: [PATCH 4/4] serial: 8250-mtk: modify uart DMA rx
From: Long Cheng @ 2019-05-17  7:36 UTC (permalink / raw)
  To: Nicolas Boichat
  Cc: Vinod Koul, Randy Dunlap, Rob Herring, Mark Rutland, Ryder Lee,
	Sean Wang, Matthias Brugger, Dan Williams, Greg Kroah-Hartman,
	Jiri Slaby, Sean Wang, dmaengine, devicetree,
	linux-arm Mailing List, moderated list:ARM/Mediatek SoC support,
	lkml, linux-serial, srv_heupstream, Yingjoe Chen, YT Shen,
	Zhenbao Liu
In-Reply-To: <CANMq1KDTyu48joV6uMksGBMz9EmjFH9SEpGAm93YCZ40jxgBpQ@mail.gmail.com>

On Wed, 2019-05-15 at 21:48 +0800, Nicolas Boichat wrote:
> On Sat, Apr 27, 2019 at 11:36 AM Long Cheng <long.cheng@mediatek.com> wrote:
> >
> > Modify uart rx and complete for DMA.
> 
> I don't know much about the DMA framework, but can you please explain
> why you are making the changes in this CL? I see that you are dropping
> dma_sync_single_for_device calls, for example, why?
> 

the rx buffer is create by 'dma_alloc_coherent'. in the function, the
buffer is uncache. We don't need to sync between CPU and DMA. So I
remove it.

> >
> > Signed-off-by: Long Cheng <long.cheng@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c |   53 ++++++++++++++++--------------------
> >  1 file changed, 23 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index c1fdbc0..04081a6 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -30,7 +30,6 @@
> >  #define MTK_UART_DMA_EN_TX     0x2
> >  #define MTK_UART_DMA_EN_RX     0x5
> >
> > -#define MTK_UART_TX_SIZE       UART_XMIT_SIZE
> >  #define MTK_UART_RX_SIZE       0x8000
> >  #define MTK_UART_TX_TRIGGER    1
> >  #define MTK_UART_RX_TRIGGER    MTK_UART_RX_SIZE
> > @@ -64,28 +63,30 @@ static void mtk8250_dma_rx_complete(void *param)
> >         struct mtk8250_data *data = up->port.private_data;
> >         struct tty_port *tty_port = &up->port.state->port;
> >         struct dma_tx_state state;
> > +       int copied, cnt, tmp;
> >         unsigned char *ptr;
> > -       int copied;
> >
> > -       dma_sync_single_for_cpu(dma->rxchan->device->dev, dma->rx_addr,
> > -                               dma->rx_size, DMA_FROM_DEVICE);
> > +       if (data->rx_status == DMA_RX_SHUTDOWN)
> > +               return;
> >
> >         dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > +       cnt = dma->rx_size - state.residue;
> > +       tmp = cnt;
> 
> I ponder, maybe we should rename cnt to left? (like, how many bytes
> are left to transfer, in total) Or maybe "total"
> Then maybe rename tmp to cnt.
> 
like better.

> >
> > -       if (data->rx_status == DMA_RX_SHUTDOWN)
> > -               return;
> > +       if ((data->rx_pos + cnt) > dma->rx_size)
> > +               tmp = dma->rx_size - data->rx_pos;
> 
> Maybe replace this and the line above:
> tmp = max_t(int, cnt, dma->rx_size - data->rx_pos);
> 
Yes. It's better.

> >
> > -       if ((data->rx_pos + state.residue) <= dma->rx_size) {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr, state.residue);
> > -       } else {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr,
> > -                                               dma->rx_size - data->rx_pos);
> > +       ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > +       copied = tty_insert_flip_string(tty_port, ptr, tmp);
> > +       data->rx_pos += tmp;
> > +
> > +       if (cnt > tmp) {
> >                 ptr = (unsigned char *)(dma->rx_buf);
> > -               copied += tty_insert_flip_string(tty_port, ptr,
> > -                               data->rx_pos + state.residue - dma->rx_size);
> > +               tmp = cnt - tmp;
> > +               copied += tty_insert_flip_string(tty_port, ptr, tmp);
> > +               data->rx_pos = tmp;
> >         }
> > +
> >         up->port.icount.rx += copied;
> >
> >         tty_flip_buffer_push(tty_port);
> > @@ -96,9 +97,7 @@ static void mtk8250_dma_rx_complete(void *param)
> >  static void mtk8250_rx_dma(struct uart_8250_port *up)
> >  {
> >         struct uart_8250_dma *dma = up->dma;
> > -       struct mtk8250_data *data = up->port.private_data;
> >         struct dma_async_tx_descriptor  *desc;
> > -       struct dma_tx_state      state;
> >
> >         desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
> >                                            dma->rx_size, DMA_DEV_TO_MEM,
> > @@ -113,12 +112,6 @@ static void mtk8250_rx_dma(struct uart_8250_port *up)
> >
> >         dma->rx_cookie = dmaengine_submit(desc);
> >
> > -       dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > -       data->rx_pos = state.residue;
> > -
> > -       dma_sync_single_for_device(dma->rxchan->device->dev, dma->rx_addr,
> > -                                  dma->rx_size, DMA_FROM_DEVICE);
> > -
> >         dma_async_issue_pending(dma->rxchan);
> >  }
> >
> > @@ -131,13 +124,13 @@ static void mtk8250_dma_enable(struct uart_8250_port *up)
> >         if (data->rx_status != DMA_RX_START)
> >                 return;
> >
> > -       dma->rxconf.direction           = DMA_DEV_TO_MEM;
> > -       dma->rxconf.src_addr_width      = dma->rx_size / 1024;
> > -       dma->rxconf.src_addr            = dma->rx_addr;
> > +       dma->rxconf.direction                           = DMA_DEV_TO_MEM;
> > +       dma->rxconf.src_port_window_size        = dma->rx_size;
> > +       dma->rxconf.src_addr                            = dma->rx_addr;
> >
> > -       dma->txconf.direction           = DMA_MEM_TO_DEV;
> > -       dma->txconf.dst_addr_width      = MTK_UART_TX_SIZE / 1024;
> > -       dma->txconf.dst_addr            = dma->tx_addr;
> > +       dma->txconf.direction                           = DMA_MEM_TO_DEV;
> > +       dma->txconf.dst_port_window_size        = UART_XMIT_SIZE;
> > +       dma->txconf.dst_addr                            = dma->tx_addr;
> >
> >         serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
> >                 UART_FCR_CLEAR_XMIT);
> > @@ -217,7 +210,7 @@ static void mtk8250_shutdown(struct uart_port *port)
> >          * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS)
> >          *
> >          * We need to recalcualte the quot register, as the claculation depends
> > -        * on the vaule in the highspeed register.
> > +        * on the value in the highspeed register.
> 
> Since you're doing some cosmetic changes here, you might as well fix
> recalcualte => recalculate and claculation => calculation on the line
> above.
> 

I see.

> But technically, this should belong in another patch...
> 
> >          *
> >          * Some baudrates are not supported by the chip, so we use the next
> >          * lower rate supported and update termios c_flag.
> > --
> > 1.7.9.5
> >



^ permalink raw reply

* Re: [PATCH] dmaengine: ioatdma: fix unprotected timer deletion
From: Dave Jiang @ 2019-05-16 16:11 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, dan.j.williams, fan.du
In-Reply-To: <155744504539.8006.16459393524018173816.stgit@djiang5-desk3.ch.intel.com>



On 5/9/19 4:37 PM, Dave Jiang wrote:
> When ioat_free_chan_resources() gets called, ioat_stop() is called without
> chan->cleanup_lock. ioat_stop modifies IOAT_RUN bit.  It needs to be
> protected by cleanup_lock. Also, in the __cleanup() path, if IOAT_RUN is
> cleared, we should not touch the timer again. We observed that the timer
> routine was run after timer was deleted.
> 
> Fixes: 3372de5813e ("dmaengine: ioatdma: removal of dma_v3.c and relevant ioat3
> references")
> 
> Reported-by: Fan Du <fan.du@intel.com>
> Tested-by: Fan Du <fan.du@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Vinod, can you hold off on this please? There may be more changes. Thanks.

> ---
>  drivers/dma/ioat/dma.c |   16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
> index f373a139e0c3..78598ba5c73b 100644
> --- a/drivers/dma/ioat/dma.c
> +++ b/drivers/dma/ioat/dma.c
> @@ -138,11 +138,14 @@ void ioat_stop(struct ioatdma_chan *ioat_chan)
>  	struct pci_dev *pdev = ioat_dma->pdev;
>  	int chan_id = chan_num(ioat_chan);
>  	struct msix_entry *msix;
> +	unsigned long flags;
>  
> -	/* 1/ stop irq from firing tasklets
> -	 * 2/ stop the tasklet from re-arming irqs
> -	 */
> +	spin_lock_irqsave(&ioat_chan->cleanup_lock, flags);
>  	clear_bit(IOAT_RUN, &ioat_chan->state);
> +	spin_unlock_irqrestore(&ioat_chan->cleanup_lock, flags);
> +
> +	/* flush inflight timers */
> +	del_timer_sync(&ioat_chan->timer);
>  
>  	/* flush inflight interrupts */
>  	switch (ioat_dma->irq_mode) {
> @@ -158,9 +161,6 @@ void ioat_stop(struct ioatdma_chan *ioat_chan)
>  		break;
>  	}
>  
> -	/* flush inflight timers */
> -	del_timer_sync(&ioat_chan->timer);
> -
>  	/* flush inflight tasklet runs */
>  	tasklet_kill(&ioat_chan->cleanup_task);
>  
> @@ -652,7 +652,9 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete)
>  	if (active - i == 0) {
>  		dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n",
>  			__func__);
> -		mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
> +
> +		if (test_bit(IOAT_RUN, &ioat_chan->state))
> +			mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
>  	}
>  
>  	/* microsecond delay by sysfs variable  per pending descriptor */
> 

^ permalink raw reply

* [PATCH 3/3] dmaengine: tegra210-adma: Fix spelling
From: Jon Hunter @ 2019-05-16 15:53 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine, linux-tegra, Sameer Pujar, Jon Hunter
In-Reply-To: <1558022034-19911-1-git-send-email-jonathanh@nvidia.com>

Correct spelling of 'register' in Tegra210 ADMA driver.

Fixes: ded1f3db4cd6 ("dmaengine: tegra210-adma: prepare for supporting newer Tegra chips")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/dma/tegra210-adma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 3f50fd11c380..17ea4dd99c62 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -95,7 +95,7 @@ struct tegra_adma;
  * @global_int_clear: Register offset of DMA global interrupt clear.
  * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
  * @ch_req_rx_shift: Register offset for AHUB receive channel select.
- * @ch_base_offset: Reister offset of DMA channel registers.
+ * @ch_base_offset: Register offset of DMA channel registers.
  * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
  * @ch_req_mask: Mask for Tx or Rx channel select.
  * @ch_req_max: Maximum number of Tx or Rx channels available.
-- 
2.7.4


^ permalink raw reply related

* [PATCH 2/3] dmaengine: tegra210-adma: Fix channel FIFO configuration
From: Jon Hunter @ 2019-05-16 15:53 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine, linux-tegra, Sameer Pujar, Jon Hunter
In-Reply-To: <1558022034-19911-1-git-send-email-jonathanh@nvidia.com>

Commit ded1f3db4cd6 ("dmaengine: tegra210-adma: prepare for supporting
newer Tegra chips") removed the default settings DMA channel RX and TX
FIFO sizes and this is breaking DMA transfers. The intention was to
move the default settings to the chip specific data structure because
this commit was preparing for adding support for Tegra186 where the
fields for the FIFO CTRL register are slightly different.

Fix the configuration of the FIFO sizes by adding default values for
the FIFO CTRL register for both Tegra210 and Tegra186 and store the
values in the chip specific structure.

Fixes: ded1f3db4cd6 ("dmaengine: tegra210-adma: prepare for supporting newer Tegra chips")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/dma/tegra210-adma.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 3ec3d71acd25..3f50fd11c380 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -53,10 +53,14 @@
 #define ADMA_CH_CONFIG_MAX_BUFS				8
 
 #define ADMA_CH_FIFO_CTRL				0x2c
-#define ADMA_CH_FIFO_CTRL_OVRFW_THRES(val)		(((val) & 0xf) << 24)
-#define ADMA_CH_FIFO_CTRL_STARV_THRES(val)		(((val) & 0xf) << 16)
-#define ADMA_CH_FIFO_CTRL_TX_FIFO_SIZE_SHIFT		8
-#define ADMA_CH_FIFO_CTRL_RX_FIFO_SIZE_SHIFT		0
+#define TEGRA210_ADMA_CH_FIFO_CTRL_OFLWTHRES(val)	(((val) & 0xf) << 24)
+#define TEGRA210_ADMA_CH_FIFO_CTRL_STRVTHRES(val)	(((val) & 0xf) << 16)
+#define TEGRA210_ADMA_CH_FIFO_CTRL_TXSIZE(val)		(((val) & 0xf) << 8)
+#define TEGRA210_ADMA_CH_FIFO_CTRL_RXSIZE(val)		((val) & 0xf)
+#define TEGRA186_ADMA_CH_FIFO_CTRL_OFLWTHRES(val)	(((val) & 0x1f) << 24)
+#define TEGRA186_ADMA_CH_FIFO_CTRL_STRVTHRES(val)	(((val) & 0x1f) << 16)
+#define TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(val)		(((val) & 0x1f) << 8)
+#define TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(val)		((val) & 0x1f)
 
 #define ADMA_CH_LOWER_SRC_ADDR				0x34
 #define ADMA_CH_LOWER_TRG_ADDR				0x3c
@@ -71,8 +75,15 @@
 
 #define TEGRA_ADMA_BURST_COMPLETE_TIME			20
 
-#define ADMA_CH_FIFO_CTRL_DEFAULT	(ADMA_CH_FIFO_CTRL_OVRFW_THRES(1) | \
-					 ADMA_CH_FIFO_CTRL_STARV_THRES(1))
+#define TEGRA210_FIFO_CTRL_DEFAULT (TEGRA210_ADMA_CH_FIFO_CTRL_OFLWTHRES(1) | \
+				    TEGRA210_ADMA_CH_FIFO_CTRL_STRVTHRES(1) | \
+				    TEGRA210_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
+				    TEGRA210_ADMA_CH_FIFO_CTRL_RXSIZE(3))
+
+#define TEGRA186_FIFO_CTRL_DEFAULT (TEGRA186_ADMA_CH_FIFO_CTRL_OFLWTHRES(1) | \
+				    TEGRA186_ADMA_CH_FIFO_CTRL_STRVTHRES(1) | \
+				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
+				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
 #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
@@ -85,6 +96,7 @@ struct tegra_adma;
  * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
  * @ch_req_rx_shift: Register offset for AHUB receive channel select.
  * @ch_base_offset: Reister offset of DMA channel registers.
+ * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
  * @ch_req_mask: Mask for Tx or Rx channel select.
  * @ch_req_max: Maximum number of Tx or Rx channels available.
  * @ch_reg_size: Size of DMA channel register space.
@@ -97,6 +109,7 @@ struct tegra_adma_chip_data {
 	unsigned int ch_req_tx_shift;
 	unsigned int ch_req_rx_shift;
 	unsigned int ch_base_offset;
+	unsigned int ch_fifo_ctrl;
 	unsigned int ch_req_mask;
 	unsigned int ch_req_max;
 	unsigned int ch_reg_size;
@@ -600,7 +613,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
 			 ADMA_CH_CTRL_FLOWCTRL_EN;
 	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
 	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
-	ch_regs->fifo_ctrl = ADMA_CH_FIFO_CTRL_DEFAULT;
+	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
 	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
 	return tegra_adma_request_alloc(tdc, direction);
@@ -784,6 +797,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
 	.ch_req_tx_shift	= 28,
 	.ch_req_rx_shift	= 24,
 	.ch_base_offset		= 0,
+	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0xf,
 	.ch_req_max		= 10,
 	.ch_reg_size		= 0x80,
@@ -797,6 +811,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
 	.ch_req_tx_shift	= 27,
 	.ch_req_rx_shift	= 22,
 	.ch_base_offset		= 0x10000,
+	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0x1f,
 	.ch_req_max		= 20,
 	.ch_reg_size		= 0x100,
-- 
2.7.4


^ permalink raw reply related

* [PATCH 1/3] dmaengine: tegra210-adma: Fix crash during probe
From: Jon Hunter @ 2019-05-16 15:53 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine, linux-tegra, Sameer Pujar, Jon Hunter
In-Reply-To: <1558022034-19911-1-git-send-email-jonathanh@nvidia.com>

Commit f33e7bb3eb92 ("dmaengine: tegra210-adma: restore channel status")
added support to save and restore the DMA channel registers when runtime
suspending the ADMA. This change is causing the kernel to crash when
probing the ADMA, if the device is probed deferred when looking up the
channel interrupts. The crash occurs because not all of the channel base
addresses have been setup at this point and in the clean-up path of the
probe, pm_runtime_suspend() is called invoking its callback which
expects all the channel base addresses to be initialised.

Although this could be fixed by simply checking for a NULL address, on
further review of the driver it seems more appropriate that we only call
pm_runtime_get_sync() after all the channel interrupts and base
addresses have been configured. Therefore, fix this crash by moving the
calls to pm_runtime_enable(), pm_runtime_get_sync() and
tegra_adma_init() after the DMA channels have been initialised.

Fixes: f33e7bb3eb92 ("dmaengine: tegra210-adma: restore channel status")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/dma/tegra210-adma.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 21f6be16d013..3ec3d71acd25 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -845,16 +845,6 @@ static int tegra_adma_probe(struct platform_device *pdev)
 		return PTR_ERR(tdma->ahub_clk);
 	}
 
-	pm_runtime_enable(&pdev->dev);
-
-	ret = pm_runtime_get_sync(&pdev->dev);
-	if (ret < 0)
-		goto rpm_disable;
-
-	ret = tegra_adma_init(tdma);
-	if (ret)
-		goto rpm_put;
-
 	INIT_LIST_HEAD(&tdma->dma_dev.channels);
 	for (i = 0; i < tdma->nr_channels; i++) {
 		struct tegra_adma_chan *tdc = &tdma->channels[i];
@@ -873,6 +863,16 @@ static int tegra_adma_probe(struct platform_device *pdev)
 		tdc->tdma = tdma;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+
+	ret = pm_runtime_get_sync(&pdev->dev);
+	if (ret < 0)
+		goto rpm_disable;
+
+	ret = tegra_adma_init(tdma);
+	if (ret)
+		goto rpm_put;
+
 	dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
 	dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
 	dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
@@ -916,13 +916,13 @@ static int tegra_adma_probe(struct platform_device *pdev)
 
 dma_remove:
 	dma_async_device_unregister(&tdma->dma_dev);
-irq_dispose:
-	while (--i >= 0)
-		irq_dispose_mapping(tdma->channels[i].irq);
 rpm_put:
 	pm_runtime_put_sync(&pdev->dev);
 rpm_disable:
 	pm_runtime_disable(&pdev->dev);
+irq_dispose:
+	while (--i >= 0)
+		irq_dispose_mapping(tdma->channels[i].irq);
 
 	return ret;
 }
-- 
2.7.4


^ permalink raw reply related

* [PATCH 0/3] dmaengine: tegra210-adma: Fixes for v5.2
From: Jon Hunter @ 2019-05-16 15:53 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine, linux-tegra, Sameer Pujar, Jon Hunter

Here are 3 fixes for the Tegra210 ADMA driver for v5.2.

Jon Hunter (3):
  dmaengine: tegra210-adma: Fix crash during probe
  dmaengine: tegra210-adma: Fix channel FIFO configuration
  dmaengine: tegra210-adma: Fix spelling

 drivers/dma/tegra210-adma.c | 57 ++++++++++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 21 deletions(-)

-- 
2.7.4


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox