From: Huang Shijie <b32955@freescale.com>
To: Dong Aisheng <b29396@freescale.com>
Cc: devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, vinod.koul@linux.intel.com,
s.hauer@pengutronix.de, rob.herring@calxeda.com,
grant.likely@secretlab.ca, rdunlap@xenotime.net,
kernel@pengutronix.de, cjb@laptop.org, shawn.guo@freescale.com
Subject: Re: [PATCH v1 4/5] dma: mxs-dma: add dt probe support
Date: Wed, 14 Mar 2012 15:54:37 +0800 [thread overview]
Message-ID: <4F604EBD.7060400@freescale.com> (raw)
In-Reply-To: <1331628428-24017-5-git-send-email-b29396@freescale.com>
Hi Aisheng:
> From: Dong Aisheng<dong.aisheng@linaro.org>
>
> Signed-off-by: Dong Aisheng<dong.aisheng@linaro.org>
> ---
> .../devicetree/bindings/dma/fsl-mxs-dma.txt | 17 ++++++++
> drivers/dma/mxs-dma.c | 44 +++++++++++++------
> 2 files changed, 47 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> new file mode 100644
> index 0000000..cfa1730
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> @@ -0,0 +1,17 @@
> +* Freescale MXS DMA
> +
> +Required properties:
> +- compatible : Should be "fsl,mxs-dma-apbh" or "fsl,mxs-dma-apbx"
> +- reg : Should contain registers location and length
> +
> +Examples:
> +
> +dma-apbh@80004000 {
> + compatible = "fsl,mxs-dma-apbh";
> + reg =<0x80004000 2000>;
> +};
> +
> +dma-apbx@80024000 {
> + compatible = "fsl,mxs-dma-apbx";
> + reg =<0x80024000 2000>;
> +};
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index b06cd4c..45e8d46 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -22,6 +22,9 @@
> #include<linux/platform_device.h>
> #include<linux/dmaengine.h>
> #include<linux/delay.h>
> +#include<linux/module.h>
> +#include<linux/of.h>
> +#include<linux/of_device.h>
>
> #include<asm/irq.h>
> #include<mach/mxs.h>
> @@ -130,6 +133,25 @@ struct mxs_dma_engine {
> struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
> };
>
> +static struct platform_device_id mxs_dma_type[] = {
> + {
> + .name = "mxs-dma-apbh",
> + .driver_data = MXS_DMA_APBH,
> + }, {
> + .name = "mxs-dma-apbx",
> + .driver_data = MXS_DMA_APBX,
> + }, {
> + /* end of list */
> + }
> +};
> +
I think you should use the platform_device_id to distinguish different
archs.
In the mx6q, you will meet some compiler error for the macro cpu_is_mx23().
BR
Huang Shijie
> +static const struct of_device_id mxs_dma_dt_ids[] = {
> + { .compatible = "fsl,mxs-dma-apbh", .data =&mxs_dma_type[0], },
> + { .compatible = "fsl,mxs-dma-apbx", .data =&mxs_dma_type[1], },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
> +
> static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
> {
> struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> @@ -587,8 +609,8 @@ err_out:
>
> static int __init mxs_dma_probe(struct platform_device *pdev)
> {
> - const struct platform_device_id *id_entry =
> - platform_get_device_id(pdev);
> + const struct platform_device_id *id_entry;
> + const struct of_device_id *of_id;
> struct mxs_dma_engine *mxs_dma;
> struct resource *iores;
> int ret, i;
> @@ -597,6 +619,11 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
> if (!mxs_dma)
> return -ENOMEM;
>
> + of_id = of_match_device(mxs_dma_dt_ids,&pdev->dev);
> + if (of_id)
> + id_entry = of_id->data;
> + else
> + id_entry = platform_get_device_id(pdev);
> mxs_dma->dev_id = id_entry->driver_data;
>
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -679,21 +706,10 @@ err_request_region:
> return ret;
> }
>
> -static struct platform_device_id mxs_dma_type[] = {
> - {
> - .name = "mxs-dma-apbh",
> - .driver_data = MXS_DMA_APBH,
> - }, {
> - .name = "mxs-dma-apbx",
> - .driver_data = MXS_DMA_APBX,
> - }, {
> - /* end of list */
> - }
> -};
> -
> static struct platform_driver mxs_dma_driver = {
> .driver = {
> .name = "mxs-dma",
> + .of_match_table = mxs_dma_dt_ids,
> },
> .id_table = mxs_dma_type,
> };
next prev parent reply other threads:[~2012-03-14 7:51 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 8:47 [PATCH v1 0/5] dt: add basic imx28 support Dong Aisheng
2012-03-13 8:47 ` [PATCH v1 1/5] ARM: imx28: add basic dt support Dong Aisheng
2012-03-13 14:35 ` Rob Herring
2012-03-13 14:59 ` Zach Sadecki
2012-03-13 17:28 ` Grant Likely
2012-03-14 5:38 ` Shawn Guo
2012-03-14 6:23 ` Dong Aisheng
2012-03-14 6:51 ` Marek Vasut
2012-03-14 13:05 ` Rob Herring
2012-03-15 2:57 ` Dong Aisheng
2012-03-13 17:23 ` Grant Likely
2012-03-14 5:41 ` Shawn Guo
2012-03-14 5:56 ` Marek Vasut
2012-03-14 6:30 ` Dong Aisheng
2012-03-14 12:45 ` Dong Aisheng
2012-03-14 14:16 ` s.hauer
2012-03-15 3:02 ` Dong Aisheng
2012-03-15 6:53 ` Lothar Waßmann
2012-03-15 10:59 ` Dong Aisheng
[not found] ` <20120315105927.GE13022-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-03-15 11:22 ` Lothar Waßmann
2012-03-16 3:01 ` Dong Aisheng
2012-03-16 7:48 ` Lothar Waßmann
2012-03-16 8:22 ` Dong Aisheng
[not found] ` <20120316030134.GA5161-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-03-18 18:47 ` Grant Likely
2012-03-19 6:54 ` Lothar Waßmann
[not found] ` <20326.55337.249575.289067-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
2012-03-19 15:06 ` Grant Likely
2012-03-19 16:49 ` Lothar Waßmann
[not found] ` <20327.25470.723875.916422-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
2012-03-19 22:02 ` Grant Likely
2012-03-20 12:49 ` Dong Aisheng
2012-03-20 13:17 ` Lothar Waßmann
2012-03-21 11:06 ` Dong Aisheng
2012-03-16 8:49 ` Shawn Guo
2012-03-15 11:24 ` s.hauer
2012-03-16 3:05 ` Dong Aisheng
2012-03-14 19:41 ` Sascha Hauer
2012-03-15 3:05 ` Dong Aisheng
2012-03-13 8:47 ` [PATCH v1 2/5] mmc: mxs-mmc: add dt probe support Dong Aisheng
2012-03-13 17:42 ` Grant Likely
2012-03-14 6:42 ` Dong Aisheng
2012-03-14 5:58 ` Marek Vasut
2012-03-14 6:55 ` Dong Aisheng
2012-03-14 7:09 ` Marek Vasut
2012-03-14 7:13 ` s.hauer
2012-03-14 7:26 ` Dong Aisheng
2012-03-14 11:17 ` Marek Vasut
2012-03-14 7:23 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-14 8:09 ` Dong Aisheng
[not found] ` <20120314080939.GA1180-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-03-14 8:52 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13 8:47 ` [PATCH v1 3/5] ARM: imx28evk: add mmc dt support Dong Aisheng
2012-03-13 14:39 ` Rob Herring
2012-03-13 16:52 ` Sascha Hauer
2012-03-13 17:45 ` Rob Herring
2012-03-14 7:30 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-14 8:20 ` Dong Aisheng
2012-03-14 8:54 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-14 7:28 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13 8:47 ` [PATCH v1 4/5] dma: mxs-dma: add dt probe support Dong Aisheng
2012-03-14 7:54 ` Huang Shijie [this message]
2012-03-14 8:23 ` Dong Aisheng
2012-03-13 8:47 ` [PATCH v1 5/5] ARM: mxs: add mxs dma dt support Dong Aisheng
2012-03-14 7:58 ` Huang Shijie
2012-03-14 8:30 ` Dong Aisheng
2012-03-14 8:43 ` Huang Shijie
2012-03-14 6:01 ` [PATCH v1 0/5] dt: add basic imx28 support Marek Vasut
2012-03-14 7:34 ` Dong Aisheng
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=4F604EBD.7060400@freescale.com \
--to=b32955@freescale.com \
--cc=b29396@freescale.com \
--cc=cjb@laptop.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=rob.herring@calxeda.com \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@freescale.com \
--cc=vinod.koul@linux.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;
as well as URLs for NNTP newsgroup(s).