All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage
@ 2017-10-19 22:08 Dmitry Osipenko
       [not found] ` <cover.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Osipenko @ 2017-10-19 22:08 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Change log:

v3:
	- Addressed v2 review comments: added 'config.device_fc = false'
	  and utilize of_device_is_compatible() for dma-filter

v2:
	- Dropped DT patch as turned out it was incorrect and made things
	  work by luck.

	- Now FUSE driver requests DMA channel from the APB DMA driver
	  utilizing DMA channel filter.

	- This patchset now depends on the APB DMA driver patch that allows
	  DMA client to issue a non-flow controlled transfers. I haven't
	  included that patch to this patchset since DMA usage is broken
	  anyway right now. It will work once this patchset and APBDMA
	  patch get applied.

Dmitry Osipenko (2):
  soc/tegra: fuse: Fix reading registers using DMA on Tegra20
  soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver

 drivers/soc/tegra/fuse/fuse-tegra.c   |  1 +
 drivers/soc/tegra/fuse/fuse-tegra20.c | 13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

-- 
2.14.2

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

* [PATCH v3 1/2] soc/tegra: fuse: Fix reading registers using DMA on Tegra20
       [not found] ` <cover.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-19 22:08   ` Dmitry Osipenko
  2017-10-19 22:08   ` [PATCH v3 2/2] soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver Dmitry Osipenko
  2017-11-14 11:25   ` [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage Dmitry Osipenko
  2 siblings, 0 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2017-10-19 22:08 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

FUSE driver doesn't configure DMA channel properly, because of it DMA
transfer is never issued and tegra20_fuse_read() always return 0x0.

Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/soc/tegra/fuse/fuse-tegra.c   | 1 +
 drivers/soc/tegra/fuse/fuse-tegra20.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index b7c552e3133c..73a3a2c74021 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -132,6 +132,7 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 
 	/* take over the memory region from the early initialization */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	fuse->phys = res->start;
 	fuse->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(fuse->base))
 		return PTR_ERR(fuse->base);
diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c b/drivers/soc/tegra/fuse/fuse-tegra20.c
index 294413a969a0..27e9ac7d3165 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra20.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra20.c
@@ -59,7 +59,7 @@ static u32 tegra20_fuse_read(struct tegra_fuse *fuse, unsigned int offset)
 
 	mutex_lock(&fuse->apbdma.lock);
 
-	fuse->apbdma.config.src_addr = fuse->apbdma.phys + FUSE_BEGIN + offset;
+	fuse->apbdma.config.src_addr = fuse->phys + FUSE_BEGIN + offset;
 
 	err = dmaengine_slave_config(fuse->apbdma.chan, &fuse->apbdma.config);
 	if (err)
@@ -119,6 +119,8 @@ static int tegra20_fuse_probe(struct tegra_fuse *fuse)
 	fuse->apbdma.config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	fuse->apbdma.config.src_maxburst = 1;
 	fuse->apbdma.config.dst_maxburst = 1;
+	fuse->apbdma.config.direction = DMA_DEV_TO_MEM;
+	fuse->apbdma.config.device_fc = false;
 
 	init_completion(&fuse->apbdma.wait);
 	mutex_init(&fuse->apbdma.lock);
-- 
2.14.2

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

* [PATCH v3 2/2] soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver
       [not found] ` <cover.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-10-19 22:08   ` [PATCH v3 1/2] soc/tegra: fuse: Fix reading registers using DMA on Tegra20 Dmitry Osipenko
@ 2017-10-19 22:08   ` Dmitry Osipenko
       [not found]     ` <059ca713c7416aedeb0080ab4b8a49da430a30b9.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-11-14 11:25   ` [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage Dmitry Osipenko
  2 siblings, 1 reply; 6+ messages in thread
From: Dmitry Osipenko @ 2017-10-19 22:08 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Currently fuse driver requests DMA channel from an arbitrary DMA device,
it is not a problem since there is only one DMA provider for Tegra20 yet,
but it may become troublesome if another provider will appear.

Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/soc/tegra/fuse/fuse-tegra20.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c b/drivers/soc/tegra/fuse/fuse-tegra20.c
index 27e9ac7d3165..49ff017f3ded 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra20.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra20.c
@@ -96,6 +96,13 @@ static u32 tegra20_fuse_read(struct tegra_fuse *fuse, unsigned int offset)
 	return value;
 }
 
+static bool dma_filter(struct dma_chan *chan, void *filter_param)
+{
+	struct device_node *np = chan->device->dev->of_node;
+
+	return of_device_is_compatible(np, "nvidia,tegra20-apbdma");
+}
+
 static int tegra20_fuse_probe(struct tegra_fuse *fuse)
 {
 	dma_cap_mask_t mask;
@@ -103,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, NULL, NULL);
+	fuse->apbdma.chan = __dma_request_channel(&mask, dma_filter, NULL);
 	if (!fuse->apbdma.chan)
 		return -EPROBE_DEFER;
 
-- 
2.14.2

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

* Re: [PATCH v3 2/2] soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver
       [not found]     ` <059ca713c7416aedeb0080ab4b8a49da430a30b9.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-20 11:00       ` Jon Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: Jon Hunter @ 2017-10-20 11:00 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA


On 19/10/17 23:08, Dmitry Osipenko wrote:
> Currently fuse driver requests DMA channel from an arbitrary DMA device,
> it is not a problem since there is only one DMA provider for Tegra20 yet,
> but it may become troublesome if another provider will appear.
> 
> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/soc/tegra/fuse/fuse-tegra20.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c b/drivers/soc/tegra/fuse/fuse-tegra20.c
> index 27e9ac7d3165..49ff017f3ded 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra20.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra20.c
> @@ -96,6 +96,13 @@ static u32 tegra20_fuse_read(struct tegra_fuse *fuse, unsigned int offset)
>  	return value;
>  }
>  
> +static bool dma_filter(struct dma_chan *chan, void *filter_param)
> +{
> +	struct device_node *np = chan->device->dev->of_node;
> +
> +	return of_device_is_compatible(np, "nvidia,tegra20-apbdma");
> +}
> +
>  static int tegra20_fuse_probe(struct tegra_fuse *fuse)
>  {
>  	dma_cap_mask_t mask;
> @@ -103,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, NULL, NULL);
> +	fuse->apbdma.chan = __dma_request_channel(&mask, dma_filter, NULL);
>  	if (!fuse->apbdma.chan)
>  		return -EPROBE_DEFER;
>  

Thanks!

Acked-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Thierry, these are ready for queuing.

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage
       [not found] ` <cover.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-10-19 22:08   ` [PATCH v3 1/2] soc/tegra: fuse: Fix reading registers using DMA on Tegra20 Dmitry Osipenko
  2017-10-19 22:08   ` [PATCH v3 2/2] soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver Dmitry Osipenko
@ 2017-11-14 11:25   ` Dmitry Osipenko
       [not found]     ` <a149fdb0-64ff-fa99-734e-9335605191ce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2 siblings, 1 reply; 6+ messages in thread
From: Dmitry Osipenko @ 2017-11-14 11:25 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

On 20.10.2017 01:08, Dmitry Osipenko wrote:
> Change log:
> 
> v3:
> 	- Addressed v2 review comments: added 'config.device_fc = false'
> 	  and utilize of_device_is_compatible() for dma-filter
> 
> v2:
> 	- Dropped DT patch as turned out it was incorrect and made things
> 	  work by luck.
> 
> 	- Now FUSE driver requests DMA channel from the APB DMA driver
> 	  utilizing DMA channel filter.
> 
> 	- This patchset now depends on the APB DMA driver patch that allows
> 	  DMA client to issue a non-flow controlled transfers. I haven't
> 	  included that patch to this patchset since DMA usage is broken
> 	  anyway right now. It will work once this patchset and APBDMA
> 	  patch get applied.
> 
> Dmitry Osipenko (2):
>   soc/tegra: fuse: Fix reading registers using DMA on Tegra20
>   soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver
> 
>  drivers/soc/tegra/fuse/fuse-tegra.c   |  1 +
>  drivers/soc/tegra/fuse/fuse-tegra20.c | 13 +++++++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 

Thierry, why this patchset isn't in 'for 4.15' PR?

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

* Re: [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage
       [not found]     ` <a149fdb0-64ff-fa99-734e-9335605191ce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-11-14 15:01       ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2017-11-14 15:01 UTC (permalink / raw)
  To: Dmitry Osipenko; +Cc: Jonathan Hunter, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]

On Tue, Nov 14, 2017 at 02:25:28PM +0300, Dmitry Osipenko wrote:
> On 20.10.2017 01:08, Dmitry Osipenko wrote:
> > Change log:
> > 
> > v3:
> > 	- Addressed v2 review comments: added 'config.device_fc = false'
> > 	  and utilize of_device_is_compatible() for dma-filter
> > 
> > v2:
> > 	- Dropped DT patch as turned out it was incorrect and made things
> > 	  work by luck.
> > 
> > 	- Now FUSE driver requests DMA channel from the APB DMA driver
> > 	  utilizing DMA channel filter.
> > 
> > 	- This patchset now depends on the APB DMA driver patch that allows
> > 	  DMA client to issue a non-flow controlled transfers. I haven't
> > 	  included that patch to this patchset since DMA usage is broken
> > 	  anyway right now. It will work once this patchset and APBDMA
> > 	  patch get applied.
> > 
> > Dmitry Osipenko (2):
> >   soc/tegra: fuse: Fix reading registers using DMA on Tegra20
> >   soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver
> > 
> >  drivers/soc/tegra/fuse/fuse-tegra.c   |  1 +
> >  drivers/soc/tegra/fuse/fuse-tegra20.c | 13 +++++++++++--
> >  2 files changed, 12 insertions(+), 2 deletions(-)
> > 
> 
> Thierry, why this patchset isn't in 'for 4.15' PR?

Looking at the date, this was sent on the same day that I sent out the
pull requests. For ARM-SoC (and many other trees) the cut-off point is
-rc6 of the prior release cycle. This means that any work you'd like
to see go into a release needs to be on the list a couple of days
before that. I usually do pull requests on Thursday or Friday before
an -rc6 release and by that time I want things to have cooked in -next
for a day or two at least.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-11-14 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 22:08 [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage Dmitry Osipenko
     [not found] ` <cover.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-19 22:08   ` [PATCH v3 1/2] soc/tegra: fuse: Fix reading registers using DMA on Tegra20 Dmitry Osipenko
2017-10-19 22:08   ` [PATCH v3 2/2] soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver Dmitry Osipenko
     [not found]     ` <059ca713c7416aedeb0080ab4b8a49da430a30b9.1508450681.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-20 11:00       ` Jon Hunter
2017-11-14 11:25   ` [PATCH v3 0/2] Correct Tegra20 FUSE driver DMA usage Dmitry Osipenko
     [not found]     ` <a149fdb0-64ff-fa99-734e-9335605191ce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-14 15:01       ` Thierry Reding

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.