[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200326123033.vi7l5mixgre2caon@fsr-ub1664-175>
Date: Thu, 26 Mar 2020 14:30:33 +0200
From: Abel Vesa <abel.vesa@....com>
To: Lee Jones <lee.jones@...aro.org>
Cc: Rob Herring <robh@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <kernel@...gutronix.de>,
Fabio Estevam <fabio.estevam@....com>,
Mike Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Anson Huang <anson.huang@....com>,
Leonard Crestez <leonard.crestez@....com>,
Peng Fan <peng.fan@....com>, Jacky Bai <ping.bai@....com>,
NXP Linux Team <linux-imx@....com>,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-clk@...r.kernel.org
Subject: Re: [RFC 01/11] mfd: Add i.MX generic mix support
On 20-03-26 11:03:06, Lee Jones wrote:
> On Tue, 03 Mar 2020, Abel Vesa wrote:
>
> > Some of the i.MX SoCs have a IP for interfacing the dedicated IPs with
> > clocks, resets and interrupts, plus some other specific control registers.
> > To allow the functionality to be split between drivers, this MFD driver is
> > added that has only two purposes: register the devices and map the entire
> > register addresses. Everything else is left to the dedicated drivers that will
> > bind to the registered devices.
> >
> > Signed-off-by: Abel Vesa <abel.vesa@....com>
> > ---
> > drivers/mfd/Kconfig | 11 +++++++++++
> > drivers/mfd/Makefile | 1 +
> > drivers/mfd/imx-mix.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 60 insertions(+)
> > create mode 100644 drivers/mfd/imx-mix.c
> >
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index 3c547ed..3c89288 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -460,6 +460,17 @@ config MFD_MX25_TSADC
> > i.MX25 processors. They consist of a conversion queue for general
> > purpose ADC and a queue for Touchscreens.
> >
> > +config MFD_IMX_MIX
> > + tristate "NXP i.MX Generic Mix Control Driver"
> > + depends on OF || COMPILE_TEST
> > + help
> > + Enable generic mixes support. On some i.MX platforms, there are
> > + devices that are a mix of multiple functionalities like reset
> > + controllers, clock controllers and some others. In order to split
> > + those functionalities between the right drivers, this MFD populates
> > + with virtual devices based on what's found in the devicetree node,
> > + leaving the rest of the behavior control to the dedicated driver.
> > +
> > config MFD_HI6421_PMIC
> > tristate "HiSilicon Hi6421 PMU/Codec IC"
> > depends on OF
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index f935d10..5b2ae5d 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -113,6 +113,7 @@ obj-$(CONFIG_MFD_TWL4030_AUDIO) += twl4030-audio.o
> > obj-$(CONFIG_TWL6040_CORE) += twl6040.o
> >
> > obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o
> > +obj-$(CONFIG_MFD_IMX_MIX) += imx-mix.o
> >
> > obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o
> > obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o
> > diff --git a/drivers/mfd/imx-mix.c b/drivers/mfd/imx-mix.c
> > new file mode 100644
> > index 00000000..d3f8c71
> > --- /dev/null
> > +++ b/drivers/mfd/imx-mix.c
> > @@ -0,0 +1,48 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright 2019 NXP.
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/clk-provider.h>
> > +#include <linux/err.h>
> > +#include <linux/io.h>
> > +#include <linux/module.h>
> > +#include <linux/of_address.h>
> > +#include <linux/spinlock.h>
> > +#include <linux/types.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/of_platform.h>
> > +
> > +#include <linux/mfd/core.h>
> > +
> > +static int imx_audiomix_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct resource *res;
> > + void __iomem *base;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + base = devm_ioremap_resource(dev, res);
> > + if (IS_ERR(base))
> > + return PTR_ERR(base);
> > +
> > + dev_set_drvdata(dev, base);
> > +
> > + return devm_of_platform_populate(dev);
> > +}
> > +
> > +static const struct of_device_id imx_audiomix_of_match[] = {
> > + { .compatible = "fsl,imx8mp-audiomix" },
> > + { /* Sentinel */ },
> > +};
> > +MODULE_DEVICE_TABLE(of, imx_audiomix_of_match);
>
> This needs DT binding documentation.
>
> Do the sub-device memory ranges overlap?
>
Yes, they do.
Resent another version of this series yesterday.
> > +static struct platform_driver imx_audiomix_driver = {
> > + .probe = imx_audiomix_probe,
> > + .driver = {
> > + .name = "imx-audiomix",
> > + .of_match_table = of_match_ptr(imx_audiomix_of_match),
> > + },
> > +};
> > +module_platform_driver(imx_audiomix_driver);
>
> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
Powered by blists - more mailing lists