From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] ARM: mxc: add dt support for audmux-v2
Date: Fri, 6 Jan 2012 10:38:56 +0100 [thread overview]
Message-ID: <20120106093856.GI5446@pengutronix.de> (raw)
In-Reply-To: <20120106092124.GT2414@b20223-02.ap.freescale.net>
On Fri, Jan 06, 2012 at 05:21:24PM +0800, Richard Zhao wrote:
> On Fri, Jan 06, 2012 at 10:13:15AM +0100, Sascha Hauer wrote:
> > On Fri, Jan 06, 2012 at 11:25:42AM +0800, Richard Zhao wrote:
> > > If CONFIG_OF, we create a audmux device driver.
> > >
> > > For other platforms that don't set CONFIG_OF, it still initialize
> > > everything in postcore_initcall. I didn't create device driver for
> > > them, because it would be big change and one day the platforms will
> > > convert to device tree too.
> > >
> > > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > > ---
> > > arch/arm/plat-mxc/audmux-v2.c | 59 +++++++++++++++++++++++++++++++++++++++++
> > > 1 files changed, 59 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
> > > index 8cced35..87e05e2 100644
> > > --- a/arch/arm/plat-mxc/audmux-v2.c
> > > +++ b/arch/arm/plat-mxc/audmux-v2.c
> > > @@ -20,7 +20,9 @@
> > > #include <linux/io.h>
> > > #include <linux/clk.h>
> > > #include <linux/debugfs.h>
> > > +#include <linux/platform_device.h>
> > > #include <linux/slab.h>
> > > +#include <linux/of.h>
> > > #include <mach/audmux.h>
> > > #include <mach/hardware.h>
> > >
> > > @@ -184,8 +186,64 @@ int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
> > > }
> > > EXPORT_SYMBOL_GPL(mxc_audmux_v2_configure_port);
> > >
> > > +#ifdef CONFIG_OF
> > > +
> > > +static int audmux_v2_probe(struct platform_device *pdev)
> > > +{
> > > + struct resource *res;
> > > + int ret = 0;
> > > +
> > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > + if (!res)
> > > + return -ENODEV;
> > > + if (!request_mem_region(res->start, resource_size(res), "audmux_v2")) {
> > > + dev_err(&pdev->dev, "request_mem_region failed\n");
> > > + return -EBUSY;
> > > + }
> > > +
> > > + audmux_base = ioremap(res->start, resource_size(res));
> > > + if (!audmux_base) {
> > > + dev_err(&pdev->dev, "ioremap failed\n");
> > > + ret = -ENODEV;
> > > + goto failed_ioremap;
> > > + }
> > > +
> > > + audmux_clk = clk_get(NULL, "audmux");
> > > + if (IS_ERR(audmux_clk)) {
> > > + dev_warn(&pdev->dev, "%s: cannot get clock: %d\n",
> > > + __func__, ret);
> > > + audmux_clk = NULL;
> > > + }
> > > +
> > > + audmux_debugfs_init();
> > > + return 0;
> > > +
> > > +failed_ioremap:
> > > + release_mem_region(res->start, resource_size(res));
> > > +
> > > + return ret;
> > > +}
> > > +
> > > +static const struct of_device_id audmux_v2_dt_ids[] = {
> > > + { .compatible = "fsl,audmux-v2", },
> > > + { /* sentinel */ }
> > > +};
> > > +
> > > +static struct platform_driver audmux_v2_driver = {
> > > + .probe = audmux_v2_probe,
> > > + .driver = {
> > > + .name = "audmux_v2",
> > > + .of_match_table = audmux_v2_dt_ids,
> > > + },
> > > +};
> > > +
> > > +#endif
> > > +
> > > static int mxc_audmux_v2_init(void)
> > > {
> > > +#ifdef CONFIG_OF
> > > + return platform_driver_register(&audmux_v2_driver);
> > > +#else
> >
> > Don't do this. Just because CONFIG_OF is enabled does not mean that this
> > kernel is only used for OF. This #else breaks starting the kernel the
> > traditional machid way.
> You are right. Look like I have to convert audmux to platform devices
> for all platforms.
I hoped you would say this :)
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2012-01-06 9:38 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 3:25 [PATCH 0/6] imx patches when I enable imx6q sabrelite audio Richard Zhao
2012-01-06 3:25 ` [PATCH 1/6] ARM: mxc: make imx_dma_is_general_purpose more generic for sdma Richard Zhao
2012-01-06 9:07 ` Sascha Hauer
2012-01-06 3:25 ` [PATCH 2/6] ARM: imx6q: add cko1 clock Richard Zhao
2012-01-06 3:25 ` [PATCH 3/6] arm/dts: imx6q-sabrelite: add 2P5V and 3P3V regulators Richard Zhao
2012-01-08 9:06 ` Shawn Guo
2012-01-08 9:14 ` Richard Zhao
2012-01-08 9:47 ` Shawn Guo
2012-01-06 3:25 ` [PATCH 4/6] arm/dts: imx6q-sabrelite: add sgtl5000 audio codec Richard Zhao
2012-01-08 14:52 ` Shawn Guo
2012-01-08 20:55 ` Mark Brown
2012-01-09 0:56 ` Shawn Guo
2012-01-09 3:38 ` Rob Herring
2012-01-09 5:05 ` Eric Miao
2012-01-09 5:58 ` Richard Zhao
2012-01-09 6:25 ` Mark Brown
2012-01-09 6:52 ` Shawn Guo
2012-01-09 6:43 ` Mark Brown
2012-01-09 7:17 ` Shawn Guo
2012-01-09 7:12 ` Mark Brown
2012-01-11 0:57 ` Richard Zhao
2012-01-11 0:59 ` Mark Brown
2012-01-09 6:47 ` Shawn Guo
2012-01-11 1:33 ` Fabio Estevam
2012-01-11 1:40 ` Richard Zhao
2012-01-06 3:25 ` [PATCH 5/6] ARM: mxc: add dt support for audmux-v2 Richard Zhao
2012-01-06 8:56 ` Russell King - ARM Linux
2012-01-06 9:14 ` Richard Zhao
2012-01-06 9:13 ` Sascha Hauer
2012-01-06 9:21 ` Richard Zhao
2012-01-06 9:38 ` Sascha Hauer [this message]
2012-01-11 5:26 ` Shawn Guo
2012-01-11 13:02 ` Richard Zhao
2012-01-11 17:38 ` Mark Brown
2012-01-12 8:54 ` Richard Zhao
2012-01-06 3:25 ` [PATCH 6/6] ARM: imx6q-sabrelite: add audmux support Richard Zhao
2012-01-08 15:02 ` Shawn Guo
2012-01-08 14:58 ` Richard Zhao
2012-01-09 1:19 ` Shawn Guo
2012-01-09 5:27 ` Shawn Guo
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=20120106093856.GI5446@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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).