devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: amba: use of_dma_configure for AMBA devices
@ 2014-09-17 11:56 Robin Murphy
       [not found] ` <90bd1ff3c93b827c12e1b3dc9ad3f227632d0f6e.1410954967.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
  2014-09-17 17:03 ` Will Deacon
  0 siblings, 2 replies; 9+ messages in thread
From: Robin Murphy @ 2014-09-17 11:56 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	will.deacon-5wv7dgnIgG8, catalin.marinas-5wv7dgnIgG8

Commit 591c1e ("of: configure the platform device dma parameters)
introduced a common mechanism to configure DMA from DT properties.
AMBA devices created from DT can take advantage of this, too.

Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
---
 drivers/of/platform.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 0197725..3b64d0b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -160,11 +160,10 @@ EXPORT_SYMBOL(of_device_alloc);
  * can use Platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE event
  * to fix up DMA configuration.
  */
-static void of_dma_configure(struct platform_device *pdev)
+static void of_dma_configure(struct device *dev)
 {
 	u64 dma_addr, paddr, size;
 	int ret;
-	struct device *dev = &pdev->dev;
 
 	/*
 	 * Set default dma-mask to 32 bit. Drivers are expected to setup
@@ -229,7 +228,7 @@ static struct platform_device *of_platform_device_create_pdata(
 	if (!dev)
 		goto err_clear_flag;
 
-	of_dma_configure(dev);
+	of_dma_configure(&dev->dev);
 	dev->dev.bus = &platform_bus_type;
 	dev->dev.platform_data = platform_data;
 
@@ -291,7 +290,6 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 	}
 
 	/* setup generic device info */
-	dev->dev.coherent_dma_mask = ~0;
 	dev->dev.of_node = of_node_get(node);
 	dev->dev.parent = parent;
 	dev->dev.platform_data = platform_data;
@@ -299,6 +297,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 		dev_set_name(&dev->dev, "%s", bus_id);
 	else
 		of_device_make_bus_id(&dev->dev);
+	of_dma_configure(&dev->dev);
 
 	/* Allow the HW Peripheral ID to be overridden */
 	prop = of_get_property(node, "arm,primecell-periphid", NULL);
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found] ` <90bd1ff3c93b827c12e1b3dc9ad3f227632d0f6e.1410954967.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
@ 2014-09-17 14:43   ` Catalin Marinas
  0 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2014-09-17 14:43 UTC (permalink / raw)
  To: Robin Murphy
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org, Will Deacon

On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
> Commit 591c1e ("of: configure the platform device dma parameters)
> introduced a common mechanism to configure DMA from DT properties.
> AMBA devices created from DT can take advantage of this, too.
> 
> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>

It looks fine to me (and we could get rid of the AMBA bus hook on arm64
as well).

Acked-by: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
  2014-09-17 11:56 [PATCH] of: amba: use of_dma_configure for AMBA devices Robin Murphy
       [not found] ` <90bd1ff3c93b827c12e1b3dc9ad3f227632d0f6e.1410954967.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
@ 2014-09-17 17:03 ` Will Deacon
       [not found]   ` <20140917170338.GC18532-5wv7dgnIgG8@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Will Deacon @ 2014-09-17 17:03 UTC (permalink / raw)
  To: Robin Murphy
  Cc: devicetree@vger.kernel.org, linux@arm.linux.org.uk, arm,
	Catalin Marinas, robh+dt@kernel.org, grant.likely@linaro.org,
	linux-arm-kernel@lists.infradead.org

On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
> Commit 591c1e ("of: configure the platform device dma parameters)
> introduced a common mechanism to configure DMA from DT properties.
> AMBA devices created from DT can take advantage of this, too.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

  Acked-by: Will Deacon <will.deacon@arm.com>

It would be great if the arm-soc guys can pick this up.

Will

> ---
>  drivers/of/platform.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 0197725..3b64d0b 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -160,11 +160,10 @@ EXPORT_SYMBOL(of_device_alloc);
>   * can use Platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE event
>   * to fix up DMA configuration.
>   */
> -static void of_dma_configure(struct platform_device *pdev)
> +static void of_dma_configure(struct device *dev)
>  {
>  	u64 dma_addr, paddr, size;
>  	int ret;
> -	struct device *dev = &pdev->dev;
>  
>  	/*
>  	 * Set default dma-mask to 32 bit. Drivers are expected to setup
> @@ -229,7 +228,7 @@ static struct platform_device *of_platform_device_create_pdata(
>  	if (!dev)
>  		goto err_clear_flag;
>  
> -	of_dma_configure(dev);
> +	of_dma_configure(&dev->dev);
>  	dev->dev.bus = &platform_bus_type;
>  	dev->dev.platform_data = platform_data;
>  
> @@ -291,7 +290,6 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
>  	}
>  
>  	/* setup generic device info */
> -	dev->dev.coherent_dma_mask = ~0;
>  	dev->dev.of_node = of_node_get(node);
>  	dev->dev.parent = parent;
>  	dev->dev.platform_data = platform_data;
> @@ -299,6 +297,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
>  		dev_set_name(&dev->dev, "%s", bus_id);
>  	else
>  		of_device_make_bus_id(&dev->dev);
> +	of_dma_configure(&dev->dev);
>  
>  	/* Allow the HW Peripheral ID to be overridden */
>  	prop = of_get_property(node, "arm,primecell-periphid", NULL);
> -- 
> 1.9.1
> 

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found]   ` <20140917170338.GC18532-5wv7dgnIgG8@public.gmane.org>
@ 2014-09-17 17:47     ` Rob Herring
       [not found]       ` <CAL_JsqKTZyPgbxy=pPmFPKRxa97oaWqC6u6pBvqvja_URLno4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2014-09-17 17:47 UTC (permalink / raw)
  To: Will Deacon
  Cc: Robin Murphy,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org, Catalin Marinas,
	arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
>> Commit 591c1e ("of: configure the platform device dma parameters)
>> introduced a common mechanism to configure DMA from DT properties.
>> AMBA devices created from DT can take advantage of this, too.
>>
>> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
>
>   Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
>
> It would be great if the arm-soc guys can pick this up.

Is this a dependency for something else? If so,

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found]       ` <CAL_JsqKTZyPgbxy=pPmFPKRxa97oaWqC6u6pBvqvja_URLno4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-09-17 18:05         ` Will Deacon
       [not found]           ` <20140917180524.GG18532-5wv7dgnIgG8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Will Deacon @ 2014-09-17 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Robin Murphy,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org, Catalin Marinas,
	arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

On Wed, Sep 17, 2014 at 06:47:19PM +0100, Rob Herring wrote:
> On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> > On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
> >> Commit 591c1e ("of: configure the platform device dma parameters)
> >> introduced a common mechanism to configure DMA from DT properties.
> >> AMBA devices created from DT can take advantage of this, too.
> >>
> >> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> >
> >   Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
> >
> > It would be great if the arm-soc guys can pick this up.
> 
> Is this a dependency for something else? If so,
> 
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Yeah, it's going to be needed by my IOMMU init rework so that AMBA devices
get registered with their IOMMUs.

Will
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found]           ` <20140917180524.GG18532-5wv7dgnIgG8@public.gmane.org>
@ 2014-09-18 11:35             ` Robin Murphy
       [not found]               ` <541AC384.8010806-5wv7dgnIgG8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Robin Murphy @ 2014-09-18 11:35 UTC (permalink / raw)
  To: Will Deacon, Rob Herring
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org, Catalin Marinas,
	arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Thanks Catalin/Will/Rob,

On 17/09/14 19:05, Will Deacon wrote:
> On Wed, Sep 17, 2014 at 06:47:19PM +0100, Rob Herring wrote:
>> On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
>>> On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
>>>> Commit 591c1e ("of: configure the platform device dma parameters)
>>>> introduced a common mechanism to configure DMA from DT properties.
>>>> AMBA devices created from DT can take advantage of this, too.
>>>>
>>>> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
>>>
>>>    Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
>>>
>>> It would be great if the arm-soc guys can pick this up.
>>
>> Is this a dependency for something else? If so,
>>
>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>
> Yeah, it's going to be needed by my IOMMU init rework so that AMBA devices
> get registered with their IOMMUs.
>

Noob question: Does that mean I should resend (with ACKs) to 
arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org? (I wasn't entirely sure where this should go, hence just 
throwing at the list with CCs)

Robin.

> Will
>


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found]               ` <541AC384.8010806-5wv7dgnIgG8@public.gmane.org>
@ 2014-09-18 12:55                 ` Catalin Marinas
       [not found]                   ` <20140918125535.GB17701-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2014-09-18 12:55 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Will Deacon, Rob Herring,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

On Thu, Sep 18, 2014 at 12:35:32PM +0100, Robin Murphy wrote:
> On 17/09/14 19:05, Will Deacon wrote:
> > On Wed, Sep 17, 2014 at 06:47:19PM +0100, Rob Herring wrote:
> >> On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> >>> On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
> >>>> Commit 591c1e ("of: configure the platform device dma parameters)
> >>>> introduced a common mechanism to configure DMA from DT properties.
> >>>> AMBA devices created from DT can take advantage of this, too.
> >>>>
> >>>> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> >>>
> >>>    Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
> >>>
> >>> It would be great if the arm-soc guys can pick this up.
> >>
> >> Is this a dependency for something else? If so,
> >>
> >> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> >
> > Yeah, it's going to be needed by my IOMMU init rework so that AMBA devices
> > get registered with their IOMMUs.
> 
> Noob question: Does that mean I should resend (with ACKs) to 
> arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org? (I wasn't entirely sure where this should go, hence just 
> throwing at the list with CCs)

If it is not part of a larger series you want to merge, Rob could pick
it up (he could add the acks as well).

Alternatively, I can get it via the arm64 tree together with an
additional patch removing the bus hooks in dma-mapping.c (maybe that's a
better option if no-one objects).

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found]                   ` <20140918125535.GB17701-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2014-09-22 10:55                     ` Catalin Marinas
       [not found]                       ` <20140922105515.GI30085-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2014-09-22 10:55 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Will Deacon, Rob Herring,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Mark Salter

On Thu, Sep 18, 2014 at 01:55:36PM +0100, Catalin Marinas wrote:
> On Thu, Sep 18, 2014 at 12:35:32PM +0100, Robin Murphy wrote:
> > On 17/09/14 19:05, Will Deacon wrote:
> > > On Wed, Sep 17, 2014 at 06:47:19PM +0100, Rob Herring wrote:
> > >> On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> > >>> On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
> > >>>> Commit 591c1e ("of: configure the platform device dma parameters)
> > >>>> introduced a common mechanism to configure DMA from DT properties.
> > >>>> AMBA devices created from DT can take advantage of this, too.
> > >>>>
> > >>>> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> > >>>
> > >>>    Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
> > >>>
> > >>> It would be great if the arm-soc guys can pick this up.
> > >>
> > >> Is this a dependency for something else? If so,
> > >>
> > >> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > >
> > > Yeah, it's going to be needed by my IOMMU init rework so that AMBA devices
> > > get registered with their IOMMUs.
> > 
> > Noob question: Does that mean I should resend (with ACKs) to 
> > arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org? (I wasn't entirely sure where this should go, hence just 
> > throwing at the list with CCs)
> 
> If it is not part of a larger series you want to merge, Rob could pick
> it up (he could add the acks as well).
> 
> Alternatively, I can get it via the arm64 tree together with an
> additional patch removing the bus hooks in dma-mapping.c (maybe that's a
> better option if no-one objects).

So I plan to take this patch via the arm64 tree together with the patch
below (after some more testing):

----8<----------------------------

>From 2189064795dc3fb4101e5c34d28c6b62b8a3bfd9 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>
Date: Mon, 22 Sep 2014 11:48:31 +0100
Subject: [PATCH] arm64: Implement set_arch_dma_coherent_ops() to replace bus
 notifiers

Commit 6ecba8eb51b7 (arm64: Use bus notifiers to set per-device coherent
DMA ops) introduced bus notifiers to set the coherent dma ops based on
the 'dma-coherent' DT property. Since the generic of_dma_configure()
handles this property for platform and AMBA devices, replace the
notifiers with set_arch_dma_coherent_ops().

Signed-off-by: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>
---
 arch/arm64/include/asm/dma-mapping.h |  7 +++++++
 arch/arm64/mm/dma-mapping.c          | 31 -------------------------------
 2 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index dc82e52acdb3..adeae3f6f0fc 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -52,6 +52,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
 	dev->archdata.dma_ops = ops;
 }
 
+static inline int set_arch_dma_coherent_ops(struct device *dev)
+{
+	set_dma_ops(dev, &coherent_swiotlb_dma_ops);
+	return 0;
+}
+#define set_arch_dma_coherent_ops	set_arch_dma_coherent_ops
+
 #include <asm-generic/dma-mapping-common.h>
 
 static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4164c5ace9f8..d6ceb3df0047 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -22,11 +22,8 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-contiguous.h>
-#include <linux/of.h>
-#include <linux/platform_device.h>
 #include <linux/vmalloc.h>
 #include <linux/swiotlb.h>
-#include <linux/amba/bus.h>
 
 #include <asm/cacheflush.h>
 
@@ -308,40 +305,12 @@ struct dma_map_ops coherent_swiotlb_dma_ops = {
 };
 EXPORT_SYMBOL(coherent_swiotlb_dma_ops);
 
-static int dma_bus_notifier(struct notifier_block *nb,
-			    unsigned long event, void *_dev)
-{
-	struct device *dev = _dev;
-
-	if (event != BUS_NOTIFY_ADD_DEVICE)
-		return NOTIFY_DONE;
-
-	if (of_property_read_bool(dev->of_node, "dma-coherent"))
-		set_dma_ops(dev, &coherent_swiotlb_dma_ops);
-
-	return NOTIFY_OK;
-}
-
-static struct notifier_block platform_bus_nb = {
-	.notifier_call = dma_bus_notifier,
-};
-
-static struct notifier_block amba_bus_nb = {
-	.notifier_call = dma_bus_notifier,
-};
-
 extern int swiotlb_late_init_with_default_size(size_t default_size);
 
 static int __init swiotlb_late_init(void)
 {
 	size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT);
 
-	/*
-	 * These must be registered before of_platform_populate().
-	 */
-	bus_register_notifier(&platform_bus_type, &platform_bus_nb);
-	bus_register_notifier(&amba_bustype, &amba_bus_nb);
-
 	dma_ops = &noncoherent_swiotlb_dma_ops;
 
 	return swiotlb_late_init_with_default_size(swiotlb_size);
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of: amba: use of_dma_configure for AMBA devices
       [not found]                       ` <20140922105515.GI30085-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2014-09-25 22:36                         ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2014-09-25 22:36 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Robin Murphy, Will Deacon, Rob Herring,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Mark Salter

On Monday 22 September 2014, Catalin Marinas wrote:
> On Thu, Sep 18, 2014 at 01:55:36PM +0100, Catalin Marinas wrote:
> > On Thu, Sep 18, 2014 at 12:35:32PM +0100, Robin Murphy wrote:
> > > On 17/09/14 19:05, Will Deacon wrote:
> > > > On Wed, Sep 17, 2014 at 06:47:19PM +0100, Rob Herring wrote:
> > > >> On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> > > >>> On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote:
> > > >>>> Commit 591c1e ("of: configure the platform device dma parameters)
> > > >>>> introduced a common mechanism to configure DMA from DT properties.
> > > >>>> AMBA devices created from DT can take advantage of this, too.
> > > >>>>
> > > >>>> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> > > >>>
> > > >>>    Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
> > > >>>
> > > >>> It would be great if the arm-soc guys can pick this up.
> > > >>
> > > >> Is this a dependency for something else? If so,
> > > >>
> > > >> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > > >
> > > > Yeah, it's going to be needed by my IOMMU init rework so that AMBA devices
> > > > get registered with their IOMMUs.
> > > 
> > > Noob question: Does that mean I should resend (with ACKs) to 
> > > arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org? (I wasn't entirely sure where this should go, hence just 
> > > throwing at the list with CCs)
> > 
> > If it is not part of a larger series you want to merge, Rob could pick
> > it up (he could add the acks as well).
> > 
> > Alternatively, I can get it via the arm64 tree together with an
> > additional patch removing the bus hooks in dma-mapping.c (maybe that's a
> > better option if no-one objects).
> 
> So I plan to take this patch via the arm64 tree together with the patch
> below (after some more testing):

Sounds good to me. If you haven't already done so, please add

Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>


	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2014-09-25 22:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17 11:56 [PATCH] of: amba: use of_dma_configure for AMBA devices Robin Murphy
     [not found] ` <90bd1ff3c93b827c12e1b3dc9ad3f227632d0f6e.1410954967.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2014-09-17 14:43   ` Catalin Marinas
2014-09-17 17:03 ` Will Deacon
     [not found]   ` <20140917170338.GC18532-5wv7dgnIgG8@public.gmane.org>
2014-09-17 17:47     ` Rob Herring
     [not found]       ` <CAL_JsqKTZyPgbxy=pPmFPKRxa97oaWqC6u6pBvqvja_URLno4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-17 18:05         ` Will Deacon
     [not found]           ` <20140917180524.GG18532-5wv7dgnIgG8@public.gmane.org>
2014-09-18 11:35             ` Robin Murphy
     [not found]               ` <541AC384.8010806-5wv7dgnIgG8@public.gmane.org>
2014-09-18 12:55                 ` Catalin Marinas
     [not found]                   ` <20140918125535.GB17701-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-09-22 10:55                     ` Catalin Marinas
     [not found]                       ` <20140922105515.GI30085-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-09-25 22:36                         ` Arnd Bergmann

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).