diff mbox

of: amba: use of_dma_configure for AMBA devices

Message ID 90bd1ff3c93b827c12e1b3dc9ad3f227632d0f6e.1410954967.git.robin.murphy@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robin Murphy Sept. 17, 2014, 11:56 a.m. UTC
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>
---
 drivers/of/platform.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Catalin Marinas Sept. 17, 2014, 2:43 p.m. UTC | #1
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>

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@arm.com>
Will Deacon Sept. 17, 2014, 5:03 p.m. UTC | #2
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
>
Rob Herring Sept. 17, 2014, 5:47 p.m. UTC | #3
On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon <will.deacon@arm.com> 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@arm.com>
>
>   Acked-by: Will Deacon <will.deacon@arm.com>
>
> 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@kernel.org>

Rob
Will Deacon Sept. 17, 2014, 6:05 p.m. UTC | #4
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@arm.com> 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@arm.com>
> >
> >   Acked-by: Will Deacon <will.deacon@arm.com>
> >
> > 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@kernel.org>

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

Will
Robin Murphy Sept. 18, 2014, 11:35 a.m. UTC | #5
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@arm.com> 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@arm.com>
>>>
>>>    Acked-by: Will Deacon <will.deacon@arm.com>
>>>
>>> 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@kernel.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@kernel.org? (I wasn't entirely sure where this should go, hence just 
throwing at the list with CCs)

Robin.

> Will
>
Catalin Marinas Sept. 18, 2014, 12:55 p.m. UTC | #6
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@arm.com> 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@arm.com>
> >>>
> >>>    Acked-by: Will Deacon <will.deacon@arm.com>
> >>>
> >>> 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@kernel.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@kernel.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).
diff mbox

Patch

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