LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Thomas Gleixner <tglx@linutronix.de>,
Samuel Ortiz <sameo@linux.intel.com>,
Wim Van Sebroeck <wim@iguana.be>,
Guenter Roeck <linux@roeck-us.net>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v3 2/8] mfd: Add atmel-st driver
Date: Tue, 20 Jan 2015 09:47:39 +0000 [thread overview]
Message-ID: <20150120094739.GM5767@x1> (raw)
In-Reply-To: <20150119225923.GG5014@piout.net>
On Mon, 19 Jan 2015, Alexandre Belloni wrote:
> Hi Lee,
>
> On 19/01/2015 at 09:42:24 +0000, Lee Jones wrote :
> > On Mon, 12 Jan 2015, Alexandre Belloni wrote:
> >
> > > The Atmel System Timer IP available on the at91rm9200 exposes both a timer and a
> > > watchdog.
> > >
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > > Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > > ---
> > > drivers/mfd/Kconfig | 7 ++++
> > > drivers/mfd/Makefile | 1 +
> > > drivers/mfd/atmel-st.c | 77 ++++++++++++++++++++++++++++++++++++++++++++
> > > include/linux/mfd/atmel-st.h | 47 +++++++++++++++++++++++++++
> > > 4 files changed, 132 insertions(+)
> > > create mode 100644 drivers/mfd/atmel-st.c
> > > create mode 100644 include/linux/mfd/atmel-st.h
> >
> > This driver looks pretty pointless. Why can't you request the sysconf
> > registers from within the drivers themselves?
> >
>
> How would you probe the watchdog driver then? Would you had the
> "atmel,at91rm9200-st" compatible there?
>
> At some point in time, we should add the reset driver, would you also
> match it on "atmel,at91rm9200-st"?
>
> I'm fine with that as this allows to avoid the mfd driver.
I'm sorry, I don't follow. Why can't each driver have their own
compatible strings?
> > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > index 2e6b7311fabc..3c5185c0cf06 100644
> > > --- a/drivers/mfd/Kconfig
> > > +++ b/drivers/mfd/Kconfig
> > > @@ -78,6 +78,13 @@ config MFD_BCM590XX
> > > help
> > > Support for the BCM590xx PMUs from Broadcom
> > >
> > > +config MFD_ATMEL_ST
> > > + bool "Atmel System Timer"
> > > + select MFD_CORE
> > > + default SOC_AT91RM9200
> > > + help
> > > + If you say Y here you get support for the Atmel System Timer.
> > > +
> > > config MFD_AXP20X
> > > bool "X-Powers AXP20X"
> > > select MFD_CORE
> > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > > index 53467e211381..1ecd416f25c5 100644
> > > --- a/drivers/mfd/Makefile
> > > +++ b/drivers/mfd/Makefile
> > > @@ -104,6 +104,7 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-core.o
> > > obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
> > > obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
> > > obj-$(CONFIG_MFD_AXP20X) += axp20x.o
> > > +obj-$(CONFIG_MFD_ATMEL_ST) += atmel-st.o
> > >
> > > obj-$(CONFIG_MFD_LP3943) += lp3943.o
> > > obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
> > > diff --git a/drivers/mfd/atmel-st.c b/drivers/mfd/atmel-st.c
> > > new file mode 100644
> > > index 000000000000..54106fcfe898
> > > --- /dev/null
> > > +++ b/drivers/mfd/atmel-st.c
> > > @@ -0,0 +1,77 @@
> > > +/*
> > > + * Copyright (C) 2014 Free Electrons
> > > + * Copyright (C) 2014 Atmel
> > > + *
> > > + * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify it
> > > + * under the terms of the GNU General Public License version 2 as published by
> > > + * the Free Software Foundation.
> > > + *
> > > + * This program is distributed in the hope that it will be useful, but WITHOUT
> > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> > > + * more details.
> > > + *
> > > + * You should have received a copy of the GNU General Public License along with
> > > + * this program. If not, see <http://www.gnu.org/licenses/>.
> > > + */
> > > +
> > > +#include <linux/mfd/atmel-st.h>
> > > +#include <linux/mfd/core.h>
> > > +#include <linux/mfd/syscon.h>
> > > +#include <linux/module.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/regmap.h>
> > > +
> > > +static const struct mfd_cell atmel_st_cells[] = {
> > > + {
> > > + .name = "atmel_st_timer",
> > > + },
> > > + {
> > > + .name = "atmel_st_watchdog",
> > > + },
> > > +};
> > > +
> > > +static int atmel_st_probe(struct platform_device *pdev)
> > > +{
> > > + struct device *dev = &pdev->dev;
> > > + struct regmap *regmap_st;
> > > +
> > > + regmap_st = syscon_node_to_regmap(dev->of_node);
> > > + if (IS_ERR(regmap_st))
> > > + return PTR_ERR(regmap_st);
> > > + dev_set_drvdata(dev, regmap_st);
> > > +
> > > + return mfd_add_devices(dev, -1, atmel_st_cells,
> > > + ARRAY_SIZE(atmel_st_cells),
> > > + NULL, 0, NULL);
> > > +}
> > > +
> > > +static int atmel_st_remove(struct platform_device *pdev)
> > > +{
> > > + mfd_remove_devices(&pdev->dev);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static const struct of_device_id atmel_st_match[] = {
> > > + { .compatible = "atmel,at91rm9200-st" },
> > > + { /* sentinel */ },
> > > +};
> > > +
> > > +static struct platform_driver atmel_st_driver = {
> > > + .probe = atmel_st_probe,
> > > + .remove = atmel_st_remove,
> > > + .driver = {
> > > + .name = "atmel-system-timer",
> > > + .owner = THIS_MODULE,
> > > + .of_match_table = atmel_st_match,
> > > + },
> > > +};
> > > +module_platform_driver(atmel_st_driver);
> > > +
> > > +MODULE_ALIAS("platform:atmel-st");
> > > +MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>");
> > > +MODULE_DESCRIPTION("Atmel ST (System Timer) driver");
> > > +MODULE_LICENSE("GPL");
> > > diff --git a/include/linux/mfd/atmel-st.h b/include/linux/mfd/atmel-st.h
> > > new file mode 100644
> > > index 000000000000..88c6cf8eeb2b
> > > --- /dev/null
> > > +++ b/include/linux/mfd/atmel-st.h
> > > @@ -0,0 +1,47 @@
> > > +/*
> > > + * Copyright (C) 2005 Ivan Kokshaysky
> > > + * Copyright (C) SAN People
> > > + *
> > > + * System Timer (ST) - System peripherals registers.
> > > + * Based on AT91RM9200 datasheet revision E.
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License as published by
> > > + * the Free Software Foundation; either version 2 of the License, or
> > > + * (at your option) any later version.
> > > + */
> > > +
> > > +#ifndef __LINUX_MFD_ATMEL_ST_H
> > > +#define __LINUX_MFD_ATMEL_ST_H
> > > +
> > > +#define AT91_ST_CR 0x00 /* Control Register */
> > > +#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
> > > +
> > > +#define AT91_ST_PIMR 0x04 /* Period Interval Mode Register */
> > > +#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
> > > +
> > > +#define AT91_ST_WDMR 0x08 /* Watchdog Mode Register */
> > > +#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
> > > +#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
> > > +#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
> > > +
> > > +#define AT91_ST_RTMR 0x0c /* Real-time Mode Register */
> > > +#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
> > > +
> > > +#define AT91_ST_SR 0x10 /* Status Register */
> > > +#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
> > > +#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
> > > +#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
> > > +#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
> > > +
> > > +#define AT91_ST_IER 0x14 /* Interrupt Enable Register */
> > > +#define AT91_ST_IDR 0x18 /* Interrupt Disable Register */
> > > +#define AT91_ST_IMR 0x1c /* Interrupt Mask Register */
> > > +
> > > +#define AT91_ST_RTAR 0x20 /* Real-time Alarm Register */
> > > +#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
> > > +
> > > +#define AT91_ST_CRTR 0x24 /* Current Real-time Register */
> > > +#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
> > > +
> > > +#endif /* __LINUX_MFD_ATMEL_ST_H */
> >
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2015-01-20 9:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 15:36 [PATCH v3 0/8] Atmel System Timer cleanups Alexandre Belloni
2015-01-12 15:36 ` [PATCH v3 1/8] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon Alexandre Belloni
2015-01-12 15:36 ` [PATCH v3 2/8] mfd: Add atmel-st driver Alexandre Belloni
2015-01-19 9:42 ` Lee Jones
2015-01-19 22:59 ` Alexandre Belloni
2015-01-20 9:47 ` Lee Jones [this message]
2015-01-20 15:05 ` Alexandre Belloni
2015-01-20 15:36 ` Lee Jones
2015-01-20 15:49 ` Nicolas Ferre
2015-01-20 16:45 ` Lee Jones
2015-01-12 15:36 ` [PATCH v3 3/8] watchdog: at91rm9200: use the regmap from mfd Alexandre Belloni
2015-01-12 17:28 ` Guenter Roeck
2015-01-12 15:36 ` [PATCH v3 4/8] ARM: at91: time: move the system timer driver to drivers/clocksource Alexandre Belloni
2015-01-15 16:17 ` Daniel Lezcano
2015-01-12 15:37 ` [PATCH v3 5/8] ARM: at91: move the restart function to the system timer driver Alexandre Belloni
2015-01-15 16:39 ` Daniel Lezcano
2015-01-15 17:01 ` Alexandre Belloni
2015-01-15 17:13 ` Alexandre Belloni
2015-01-12 15:37 ` [PATCH v3 6/8] clocksource: atmel-st: properly initialize driver Alexandre Belloni
2015-01-15 16:05 ` Daniel Lezcano
2015-01-12 15:37 ` [PATCH v3 7/8] clocksource: atmel-st: use syscon/regmap Alexandre Belloni
2015-01-15 16:40 ` Daniel Lezcano
2015-01-15 17:02 ` Alexandre Belloni
2015-01-12 15:37 ` [PATCH v3 8/8] ARM: at91: remove useless include Alexandre Belloni
2015-01-15 16:29 ` Daniel Lezcano
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=20150120094739.GM5767@x1 \
--to=lee.jones@linaro.org \
--cc=alexandre.belloni@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=sameo@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=wim@iguana.be \
--subject='Re: [PATCH v3 2/8] mfd: Add atmel-st driver' \
/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
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).