devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1 0/2] Support dma channel mask
@ 2023-10-09  6:35 Mohan Kumar
  2023-10-09  6:35 ` [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma Mohan Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Mohan Kumar @ 2023-10-09  6:35 UTC (permalink / raw)
  To: vkoul, robh+dt, thierry.reding, jonathanh, ldewangan,
	krzysztof.kozlowski+dt
  Cc: dmaengine, linux-tegra, devicetree, Mohan Kumar

To reserve the dma channel using dma-channel-mask property
for Tegra platforms.

Mohan Kumar (2):
  dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
  dmaengine: tegra210-adma: Support dma-channel-mask property

 .../bindings/dma/nvidia,tegra210-adma.yaml    |  3 ++
 drivers/dma/tegra210-adma.c                   | 35 +++++++++++++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)

-- 
2.17.1


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

* [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
  2023-10-09  6:35 [PATCH V1 0/2] Support dma channel mask Mohan Kumar
@ 2023-10-09  6:35 ` Mohan Kumar
  2023-10-10 16:21   ` Rob Herring
  2023-10-09  6:35 ` [PATCH V1 2/2] dmaengine: tegra210-adma: Support dma-channel-mask property Mohan Kumar
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Mohan Kumar @ 2023-10-09  6:35 UTC (permalink / raw)
  To: vkoul, robh+dt, thierry.reding, jonathanh, ldewangan,
	krzysztof.kozlowski+dt
  Cc: dmaengine, linux-tegra, devicetree, Mohan Kumar

- Add dma-channel-mask binding doc support to nvidia,tegra210-adma
to reserve the adma channel usage

Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
---
 .../devicetree/bindings/dma/nvidia,tegra210-adma.yaml          | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml b/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
index 4003dbe94940..877147e95ecc 100644
--- a/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
+++ b/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
@@ -53,6 +53,9 @@ properties:
       ADMA_CHn_CTRL register.
     const: 1
 
+  dma-channel-mask:
+    maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.17.1


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

* [PATCH V1 2/2] dmaengine: tegra210-adma: Support dma-channel-mask property
  2023-10-09  6:35 [PATCH V1 0/2] Support dma channel mask Mohan Kumar
  2023-10-09  6:35 ` [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma Mohan Kumar
@ 2023-10-09  6:35 ` Mohan Kumar
  2023-10-16 11:09 ` [PATCH V1 0/2] Support dma channel mask Vinod Koul
  2023-12-11 15:04 ` Vinod Koul
  3 siblings, 0 replies; 8+ messages in thread
From: Mohan Kumar @ 2023-10-09  6:35 UTC (permalink / raw)
  To: vkoul, robh+dt, thierry.reding, jonathanh, ldewangan,
	krzysztof.kozlowski+dt
  Cc: dmaengine, linux-tegra, devicetree, Mohan Kumar

To support the flexibility to reserve the specific dma channels
add the support of dma-channel-mask property in the tegra210-adma
driver

Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
---
 drivers/dma/tegra210-adma.c | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index e557bada1510..f09930a5c09b 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -153,6 +153,7 @@ struct tegra_adma {
 	void __iomem			*base_addr;
 	struct clk			*ahub_clk;
 	unsigned int			nr_channels;
+	unsigned long			*dma_chan_mask;
 	unsigned long			rx_requests_reserved;
 	unsigned long			tx_requests_reserved;
 
@@ -741,6 +742,10 @@ static int __maybe_unused tegra_adma_runtime_suspend(struct device *dev)
 
 	for (i = 0; i < tdma->nr_channels; i++) {
 		tdc = &tdma->channels[i];
+		/* skip for reserved channels */
+		if (!tdc->tdma)
+			continue;
+
 		ch_reg = &tdc->ch_regs;
 		ch_reg->cmd = tdma_ch_read(tdc, ADMA_CH_CMD);
 		/* skip if channel is not active */
@@ -779,6 +784,9 @@ static int __maybe_unused tegra_adma_runtime_resume(struct device *dev)
 
 	for (i = 0; i < tdma->nr_channels; i++) {
 		tdc = &tdma->channels[i];
+		/* skip for reserved channels */
+		if (!tdc->tdma)
+			continue;
 		ch_reg = &tdc->ch_regs;
 		/* skip if channel was not active earlier */
 		if (!ch_reg->cmd)
@@ -867,10 +875,31 @@ static int tegra_adma_probe(struct platform_device *pdev)
 		return PTR_ERR(tdma->ahub_clk);
 	}
 
+	tdma->dma_chan_mask = devm_kzalloc(&pdev->dev,
+					   BITS_TO_LONGS(tdma->nr_channels) * sizeof(unsigned long),
+					   GFP_KERNEL);
+	if (!tdma->dma_chan_mask)
+		return -ENOMEM;
+
+	/* Enable all channels by default */
+	bitmap_fill(tdma->dma_chan_mask, tdma->nr_channels);
+
+	ret = of_property_read_u32_array(pdev->dev.of_node, "dma-channel-mask",
+					 (u32 *)tdma->dma_chan_mask,
+					 BITS_TO_U32(tdma->nr_channels));
+	if (ret < 0 && (ret != -EINVAL)) {
+		dev_err(&pdev->dev, "dma-channel-mask is not complete.\n");
+		return ret;
+	}
+
 	INIT_LIST_HEAD(&tdma->dma_dev.channels);
 	for (i = 0; i < tdma->nr_channels; i++) {
 		struct tegra_adma_chan *tdc = &tdma->channels[i];
 
+		/* skip for reserved channels */
+		if (!test_bit(i, tdma->dma_chan_mask))
+			continue;
+
 		tdc->chan_addr = tdma->base_addr + cdata->ch_base_offset
 				 + (cdata->ch_reg_size * i);
 
@@ -957,8 +986,10 @@ static int tegra_adma_remove(struct platform_device *pdev)
 	of_dma_controller_free(pdev->dev.of_node);
 	dma_async_device_unregister(&tdma->dma_dev);
 
-	for (i = 0; i < tdma->nr_channels; ++i)
-		irq_dispose_mapping(tdma->channels[i].irq);
+	for (i = 0; i < tdma->nr_channels; ++i) {
+		if (tdma->channels[i].irq)
+			irq_dispose_mapping(tdma->channels[i].irq);
+	}
 
 	pm_runtime_disable(&pdev->dev);
 
-- 
2.17.1


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

* Re: [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
  2023-10-09  6:35 ` [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma Mohan Kumar
@ 2023-10-10 16:21   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2023-10-10 16:21 UTC (permalink / raw)
  To: Mohan Kumar
  Cc: jonathanh, robh+dt, dmaengine, thierry.reding, devicetree,
	krzysztof.kozlowski+dt, linux-tegra, vkoul, ldewangan


On Mon, 09 Oct 2023 12:05:08 +0530, Mohan Kumar wrote:
> - Add dma-channel-mask binding doc support to nvidia,tegra210-adma
> to reserve the adma channel usage
> 
> Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
> ---
>  .../devicetree/bindings/dma/nvidia,tegra210-adma.yaml          | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH V1 0/2] Support dma channel mask
  2023-10-09  6:35 [PATCH V1 0/2] Support dma channel mask Mohan Kumar
  2023-10-09  6:35 ` [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma Mohan Kumar
  2023-10-09  6:35 ` [PATCH V1 2/2] dmaengine: tegra210-adma: Support dma-channel-mask property Mohan Kumar
@ 2023-10-16 11:09 ` Vinod Koul
  2023-10-16 11:14   ` Mohan Kumar D
  2023-12-11 15:04 ` Vinod Koul
  3 siblings, 1 reply; 8+ messages in thread
From: Vinod Koul @ 2023-10-16 11:09 UTC (permalink / raw)
  To: Mohan Kumar
  Cc: robh+dt, thierry.reding, jonathanh, ldewangan,
	krzysztof.kozlowski+dt, dmaengine, linux-tegra, devicetree

On 09-10-23, 12:05, Mohan Kumar wrote:
> To reserve the dma channel using dma-channel-mask property
> for Tegra platforms.
> 
> Mohan Kumar (2):
>   dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
>   dmaengine: tegra210-adma: Support dma-channel-mask property

This fails to apply for me, pls rebase

-- 
~Vinod

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

* RE: [PATCH V1 0/2] Support dma channel mask
  2023-10-16 11:09 ` [PATCH V1 0/2] Support dma channel mask Vinod Koul
@ 2023-10-16 11:14   ` Mohan Kumar D
  2023-10-16 11:22     ` Vinod Koul
  0 siblings, 1 reply; 8+ messages in thread
From: Mohan Kumar D @ 2023-10-16 11:14 UTC (permalink / raw)
  To: Vinod Koul
  Cc: robh+dt@kernel.org, thierry.reding@gmail.com, Jonathan Hunter,
	Laxman Dewangan, krzysztof.kozlowski+dt@linaro.org,
	dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org,
	devicetree@vger.kernel.org

Sure, will send rebased patch soon.

-----Original Message-----
From: Vinod Koul <vkoul@kernel.org> 
Sent: Monday, October 16, 2023 4:39 PM
To: Mohan Kumar D <mkumard@nvidia.com>
Cc: robh+dt@kernel.org; thierry.reding@gmail.com; Jonathan Hunter <jonathanh@nvidia.com>; Laxman Dewangan <ldewangan@nvidia.com>; krzysztof.kozlowski+dt@linaro.org; dmaengine@vger.kernel.org; linux-tegra@vger.kernel.org; devicetree@vger.kernel.org
Subject: Re: [PATCH V1 0/2] Support dma channel mask

External email: Use caution opening links or attachments


On 09-10-23, 12:05, Mohan Kumar wrote:
> To reserve the dma channel using dma-channel-mask property for Tegra 
> platforms.
>
> Mohan Kumar (2):
>   dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
>   dmaengine: tegra210-adma: Support dma-channel-mask property

This fails to apply for me, pls rebase

--
~Vinod

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

* Re: [PATCH V1 0/2] Support dma channel mask
  2023-10-16 11:14   ` Mohan Kumar D
@ 2023-10-16 11:22     ` Vinod Koul
  0 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2023-10-16 11:22 UTC (permalink / raw)
  To: Mohan Kumar D
  Cc: robh+dt@kernel.org, thierry.reding@gmail.com, Jonathan Hunter,
	Laxman Dewangan, krzysztof.kozlowski+dt@linaro.org,
	dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org,
	devicetree@vger.kernel.org

On 16-10-23, 11:14, Mohan Kumar D wrote:
> Sure, will send rebased patch soon.
> 

Please **do ** not ** top post! and use a Linux friendly MUA to send
replies!

> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org> 
> Sent: Monday, October 16, 2023 4:39 PM
> To: Mohan Kumar D <mkumard@nvidia.com>
> Cc: robh+dt@kernel.org; thierry.reding@gmail.com; Jonathan Hunter <jonathanh@nvidia.com>; Laxman Dewangan <ldewangan@nvidia.com>; krzysztof.kozlowski+dt@linaro.org; dmaengine@vger.kernel.org; linux-tegra@vger.kernel.org; devicetree@vger.kernel.org
> Subject: Re: [PATCH V1 0/2] Support dma channel mask
> 
> External email: Use caution opening links or attachments
> 
> 
> On 09-10-23, 12:05, Mohan Kumar wrote:
> > To reserve the dma channel using dma-channel-mask property for Tegra 
> > platforms.
> >
> > Mohan Kumar (2):
> >   dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
> >   dmaengine: tegra210-adma: Support dma-channel-mask property
> 
> This fails to apply for me, pls rebase
> 
> --
> ~Vinod

-- 
~Vinod

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

* Re: [PATCH V1 0/2] Support dma channel mask
  2023-10-09  6:35 [PATCH V1 0/2] Support dma channel mask Mohan Kumar
                   ` (2 preceding siblings ...)
  2023-10-16 11:09 ` [PATCH V1 0/2] Support dma channel mask Vinod Koul
@ 2023-12-11 15:04 ` Vinod Koul
  3 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2023-12-11 15:04 UTC (permalink / raw)
  To: robh+dt, thierry.reding, jonathanh, ldewangan,
	krzysztof.kozlowski+dt, Mohan Kumar
  Cc: dmaengine, linux-tegra, devicetree


On Mon, 09 Oct 2023 12:05:07 +0530, Mohan Kumar wrote:
> To reserve the dma channel using dma-channel-mask property
> for Tegra platforms.
> 
> Mohan Kumar (2):
>   dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
>   dmaengine: tegra210-adma: Support dma-channel-mask property
> 
> [...]

Applied, thanks!

[1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma
      commit: d95fcb78e7f263f909ce492c3882a704067dc534
[2/2] dmaengine: tegra210-adma: Support dma-channel-mask property
      commit: 25b636225a0816eac20b02fcb37daf6c722d0bed

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2023-12-11 15:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09  6:35 [PATCH V1 0/2] Support dma channel mask Mohan Kumar
2023-10-09  6:35 ` [PATCH V1 1/2] dt-bindings: dma: Add dma-channel-mask to nvidia,tegra210-adma Mohan Kumar
2023-10-10 16:21   ` Rob Herring
2023-10-09  6:35 ` [PATCH V1 2/2] dmaengine: tegra210-adma: Support dma-channel-mask property Mohan Kumar
2023-10-16 11:09 ` [PATCH V1 0/2] Support dma channel mask Vinod Koul
2023-10-16 11:14   ` Mohan Kumar D
2023-10-16 11:22     ` Vinod Koul
2023-12-11 15:04 ` Vinod Koul

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