public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org,
	Magnus Damm <magnus.damm@gmail.com>,
	Simon Horman <horms@verge.net.au>,
	Vinod Koul <vinod.koul@intel.com>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Subject: Re: [PATCH v2 05/15] DMA: shdma: pass SoC-specific configuration to the driver via OF matching
Date: Mon, 22 Jul 2013 00:12:22 +0200	[thread overview]
Message-ID: <1625139.lQ0AJJW8Dp@avalon> (raw)
In-Reply-To: <1374251374-30186-6-git-send-email-g.liakhovetski@gmx.de>

Hi Guennadi,

Thanks for the patch.

On Friday 19 July 2013 18:29:30 Guennadi Liakhovetski wrote:
> Similar to the non-DT case, this patch passes SoC-specific configuration
> to the driver via device ID matching, instead of platform data.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> 
> v2: adjust spacing within array definitions to keep a uniform style.
> 
>  Documentation/devicetree/bindings/dma/shdma.txt |    7 +++++--
>  drivers/dma/sh/shdmac.c                         |   22 +++++++++++++-------
>  2 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/shdma.txt
> b/Documentation/devicetree/bindings/dma/shdma.txt index c15994a..7702e35
> 100644
> --- a/Documentation/devicetree/bindings/dma/shdma.txt
> +++ b/Documentation/devicetree/bindings/dma/shdma.txt
> @@ -22,7 +22,10 @@ Optional properties (currently unused):
>  * DMA controller
> 
>  Required properties:
> -- compatible:	should be "renesas,shdma"
> +- compatible:	should be one of
> +		"renesas,shdma-r8a73a4" for the system DMAC on r8a73a4 SoC
> +		"renesas,shdma-r8a7740" for the DMACs (not RTDMAC) on r8a7740
> +		"renesas,shdma" for a generic DMAC
> 
>  Example:
>  	dmac: dma-mux0 {
> @@ -36,7 +39,7 @@ Example:
>  		ranges;
> 
>  		dma0: shdma@fe008020 {
> -			compatible = "renesas,shdma";
> +			compatible = "renesas,shdma-r8a7740";
>  			reg = <0xfe008020 0x270>,
>  				<0xfe009000 0xc>;
>  			interrupt-parent = <&gic>;
> diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
> index 859ddbe..f80543c 100644
> --- a/drivers/dma/sh/shdmac.c
> +++ b/drivers/dma/sh/shdmac.c
> @@ -20,6 +20,8 @@
> 
>  #include <linux/init.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>  #include <linux/slab.h>
>  #include <linux/interrupt.h>
>  #include <linux/dmaengine.h>
> @@ -663,6 +665,14 @@ static const struct shdma_ops sh_dmae_shdma_ops = {
>  	.get_partial = sh_dmae_get_partial,
>  };
> 
> +static const struct of_device_id sh_dmae_of_match[] = {
> +	{.compatible = "renesas,shdma",},
> +	{.compatible = "renesas,shdma-r8a73a4", .data = r8a73a4_shdma_devid,},
> +	{.compatible = "renesas,shdma-r8a7740", .data = r8a7740_shdma_devid,},

Nit-picking here, OF device ID entries are usually ordered from most specific 
to most generic compatible strings. It's up to you.

> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, sh_dmae_of_match);

Shouldn't you guard the table with #ifdef CONFIG_OF ? If the driver can only 
be used on ARM platforms it might not be worth it, but if it can be used on SH 
as well that would make sense.

> +
>  static int sh_dmae_probe(struct platform_device *pdev)
>  {
>  	const struct sh_dmae_pdata *pdata;
> @@ -674,7 +684,11 @@ static int sh_dmae_probe(struct platform_device *pdev)
>  	struct dma_device *dma_dev;
>  	struct resource *chan, *dmars, *errirq_res, *chanirq_res;
> 
> -	pdata = (void *)pdev->id_entry->driver_data ? : pdev->dev.platform_data;
> +	if (pdev->dev.of_node)
> +		pdata = of_match_device(sh_dmae_of_match, &pdev->dev)->data;
> +	else
> +		pdata = (void *)pdev->id_entry->driver_data ? :
> +			pdev->dev.platform_data;
> 
>  	/* get platform data */
>  	if (!pdata || !pdata->channel_num)
> @@ -899,12 +913,6 @@ static int sh_dmae_remove(struct platform_device *pdev)
> return 0;
>  }
> 
> -static const struct of_device_id sh_dmae_of_match[] = {
> -	{ .compatible = "renesas,shdma", },
> -	{ }
> -};
> -MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
> -
>  const struct platform_device_id sh_dmae_id_table[] = {
>  	{.name = SH_DMAE_DRV_NAME,},
>  	{.name = "shdma-r8a73a4", .driver_data =
> (kernel_ulong_t)r8a73a4_shdma_devid,},
-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2013-07-21 22:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 16:29 [PATCH v2 00/15] ARM: shmobile: move DMAC configuration data in the driver Guennadi Liakhovetski
2013-07-19 16:29 ` [PATCH v2 01/15] DMA: shdma: add support for DMAC configuration data, supplied via device ID Guennadi Liakhovetski
2013-07-19 16:29 ` [PATCH v2 02/15] DMA: shdma: add r8a7740 DMAC data to the device ID table Guennadi Liakhovetski
2013-07-19 16:29 ` [PATCH v2 03/15] DMA: shdma: add r8a73a4 " Guennadi Liakhovetski
2013-07-19 16:29 ` [PATCH v2 04/15] DMA: shdma: make a pointer const Guennadi Liakhovetski
2013-07-21 21:54   ` Laurent Pinchart
2013-07-22  7:53     ` Guennadi Liakhovetski
2013-07-22 23:37       ` Laurent Pinchart
2013-07-19 16:29 ` [PATCH v2 05/15] DMA: shdma: pass SoC-specific configuration to the driver via OF matching Guennadi Liakhovetski
2013-07-21 22:12   ` Laurent Pinchart [this message]
2013-07-22  7:29     ` Guennadi Liakhovetski
2013-07-22 23:23       ` Laurent Pinchart
2013-07-19 16:29 ` [PATCH v2 06/15] DMA: shdma: make multiplexer platform data optional Guennadi Liakhovetski
2013-07-19 16:29 ` [PATCH v2 07/15] DMA: shdma: add sh73a0 DMAC data to the device ID table Guennadi Liakhovetski
2013-07-20 11:28   ` [PATCH v3 " Guennadi Liakhovetski
2013-07-23  1:29     ` Simon Horman
2013-07-19 16:29 ` [PATCH v2 08/15] DMA: shdma: move two macros to a header Guennadi Liakhovetski
2013-07-21 22:16   ` Laurent Pinchart
2013-07-22  6:40     ` Guennadi Liakhovetski
2013-07-22 23:30       ` Laurent Pinchart
2013-07-19 16:29 ` [PATCH v2 09/15] DMA: shdma: support referencing specific DMACs within a multiplexer in DT Guennadi Liakhovetski
2013-07-21 22:23   ` Laurent Pinchart
2013-07-22  6:34     ` Guennadi Liakhovetski
2013-07-22 23:35       ` Laurent Pinchart
2013-07-19 20:22 ` [PATCH v2 10/15] ARM: shmobile: r8a73a4: add a DMAC platform device and clock for it Guennadi Liakhovetski
2013-07-19 20:22 ` [PATCH v2 11/15] ARM: shmobile: r8a7740: switch DMAC controllers to using device ID data Guennadi Liakhovetski
2013-07-19 20:22 ` [PATCH v2 12/15] ARM: shmobile: r8a7740: add DT nodes and clock aliases for three DMAC instances Guennadi Liakhovetski
2013-07-19 20:22 ` [PATCH v2 13/15] ARM: shmobile: r8a73a4: add a DT node and a clock alias for the DMAC Guennadi Liakhovetski
2013-07-19 20:22 ` [PATCH v2 14/15] ARM: shmobile: sh73a0: switch DMAC controllers to using device ID data Guennadi Liakhovetski
2013-07-19 20:22 ` [PATCH v2 15/15] ARM: shmobile: r8a7740: add support for 2 RTDMACs Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1625139.lQ0AJJW8Dp@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=g.liakhovetski+renesas@gmail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox