From: Samuel Ortiz <sameo@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Kevin Strasser <kevin.strasser@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Darren Hart <dvhart@linux.intel.com>,
Guenter Roeck <linux@roeck-us.net>,
Michael Brunner <Michael.Brunner@kontron.com>,
Michael Brunner <mibru@gmx.de>, Chris Healy <chealy@imsco-us.com>,
Thomas Gleixner <tglx@linutronix.de>,
Dirk Hohndel <Dirk.Hohndel@intel.com>,
Wolfram Sang <wsa@the-dreams.de>, Ben Dooks <ben-linux@fluff.org>,
Grant Likely <grant.likely@secretlab.ca>,
Wim Van Sebroeck <wim@iguana.be>, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v2 1/4] mfd: Kontron PLD mfd driver
Date: Wed, 19 Jun 2013 11:11:27 +0200 [thread overview]
Message-ID: <20130619091127.GW7161@zurbaran> (raw)
In-Reply-To: <CACRpkdap753rf82jqDx4CGRcsNRUYwsrsfpJe4=331NQom6SuA@mail.gmail.com>
Hi Linus,
On Wed, Jun 19, 2013 at 10:40:04AM +0200, Linus Walleij wrote:
> On Tue, Jun 18, 2013 at 11:04 PM, Kevin Strasser
> <kevin.strasser@linux.intel.com> wrote:
> > Add core MFD driver for the on-board PLD found on some Kontron embedded
> > modules. The PLD device may provide functions like watchdog, GPIO, UART
> > and I2C bus.
> >
> > The following modules are supported:
> > * COMe-bIP#
> > * COMe-bPC2 (ETXexpress-PC)
> > * COMe-bSC# (ETXexpress-SC T#)
> > * COMe-cCT6
> > * COMe-cDC2 (microETXexpress-DC)
> > * COMe-cPC2 (microETXexpress-PC)
> > * COMe-mCT10
> > * ETX-OH
> >
> > Signed-off-by: Kevin Strasser <kevin.strasser@linux.intel.com>
> > Signed-off-by: Michael Brunner <michael.brunner@kontron.com>
> > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > Acked-by: Darren Hart <dvhart@linux.intel.com>
>
> (...)
> > +/**
> > + * kempld_read8 - read 8 bit register
> > + * @pld: kempld_device_data structure describing the PLD
> > + * @index: register index on the chip
> > + *
> > + * kempld_get_mutex must be called prior to calling this function.
> > + */
> > +u8 kempld_read8(struct kempld_device_data *pld, u8 index)
> > +{
> > + iowrite8(index, pld->io_index);
> > + return ioread8(pld->io_data);
> > +}
> > +EXPORT_SYMBOL_GPL(kempld_read8);
> > +
> > +/**
> > + * kempld_write8 - write 8 bit register
> > + * @pld: kempld_device_data structure describing the PLD
> > + * @index: register index on the chip
> > + * @data: new register value
> > + *
> > + * kempld_get_mutex must be called prior to calling this function.
> > + */
> > +void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data)
> > +{
> > + iowrite8(index, pld->io_index);
> > + iowrite8(data, pld->io_data);
> > +}
> > +EXPORT_SYMBOL_GPL(kempld_write8);
> > +
> > +/**
> > + * kempld_read16 - read 16 bit register
> > + * @pld: kempld_device_data structure describing the PLD
> > + * @index: register index on the chip
> > + *
> > + * kempld_get_mutex must be called prior to calling this function.
> > + */
> > +u16 kempld_read16(struct kempld_device_data *pld, u8 index)
> > +{
> > + return kempld_read8(pld, index) | kempld_read8(pld, index + 1) << 8;
> > +}
> > +EXPORT_SYMBOL_GPL(kempld_read16);
> > +
> > +/**
> > + * kempld_write16 - write 16 bit register
> > + * @pld: kempld_device_data structure describing the PLD
> > + * @index: register index on the chip
> > + * @data: new register value
> > + *
> > + * kempld_get_mutex must be called prior to calling this function.
> > + */
> > +void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data)
> > +{
> > + kempld_write8(pld, index, (u8)data);
> > + kempld_write8(pld, index + 1, (u8)(data >> 8));
> > +}
> > +EXPORT_SYMBOL_GPL(kempld_write16);
> > +
> > +/**
> > + * kempld_read32 - read 32 bit register
> > + * @pld: kempld_device_data structure describing the PLD
> > + * @index: register index on the chip
> > + *
> > + * kempld_get_mutex must be called prior to calling this function.
> > + */
> > +u32 kempld_read32(struct kempld_device_data *pld, u8 index)
> > +{
> > + return kempld_read16(pld, index) | kempld_read16(pld, index + 2) << 16;
> > +}
> > +EXPORT_SYMBOL_GPL(kempld_read32);
> > +
> > +/**
> > + * kempld_write32 - write 32 bit register
> > + * @pld: kempld_device_data structure describing the PLD
> > + * @index: register index on the chip
> > + * @data: new register value
> > + *
> > + * kempld_get_mutex must be called prior to calling this function.
> > + */
> > +void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data)
> > +{
> > + kempld_write16(pld, index, (u16)data);
> > + kempld_write16(pld, index + 2, (u16)(data >> 16));
> > +}
> > +EXPORT_SYMBOL_GPL(kempld_write32);
> (...)
> > +extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
> > +extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
> > +extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
> > +extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
> > +extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
> > +extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
>
> Not really my business, but I think if I was to implement this
> inter-module API I would use regmap for this read/write marshalling
> right here.
I thought about this one and was under the impression that the regmap
API would not let us implement this kind of stuff. I don't see how the
reg_read and reg_write hooks would allow us to implement that, but I may
be missing something here. Maybe Mark can provide some more input.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
next prev parent reply other threads:[~2013-06-19 9:11 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 17:15 [PATCH 1/4] mfd: Kontron PLD mfd driver Kevin Strasser
2013-04-08 17:15 ` [PATCH 2/4] i2c: Kontron PLD i2c bus driver Kevin Strasser
2013-04-10 17:02 ` Guenter Roeck
2013-04-16 9:53 ` Wolfram Sang
2013-04-08 17:15 ` [PATCH 3/4] gpio: Kontron PLD gpio driver Kevin Strasser
2013-04-09 8:46 ` Linus Walleij
2013-04-09 16:41 ` Guenter Roeck
2013-04-10 20:06 ` Linus Walleij
2013-04-10 20:45 ` Linus Walleij
2013-04-12 11:09 ` Michael Brunner
2013-04-12 22:05 ` Linus Walleij
2013-04-08 17:15 ` [PATCH 4/4] watchdog: Kontron PLD watchdog timer Kevin Strasser
2013-04-10 16:47 ` Guenter Roeck
2013-04-10 16:57 ` Kevin Strasser
2013-05-26 14:38 ` Wim Van Sebroeck
2013-04-13 20:38 ` [PATCH 1/4] mfd: Kontron PLD mfd driver Thomas Gleixner
2013-04-18 4:19 ` Guenter Roeck
2013-04-18 4:40 ` Joe Perches
2013-04-18 13:35 ` Guenter Roeck
2013-04-18 16:42 ` Joe Perches
2013-04-18 18:40 ` Guenter Roeck
2013-06-18 21:04 ` [PATCH v2 0/4] Kontron PLD drivers Kevin Strasser
2013-06-18 21:04 ` [PATCH v2 1/4] mfd: Kontron PLD mfd driver Kevin Strasser
2013-06-19 8:40 ` Linus Walleij
2013-06-19 9:11 ` Samuel Ortiz [this message]
2013-06-19 9:48 ` Mark Brown
2013-06-19 9:12 ` Thomas Gleixner
2013-06-19 18:03 ` Kevin Strasser
2013-06-19 20:35 ` Guenter Roeck
2013-06-18 21:04 ` [PATCH v2 2/4] i2c: Kontron PLD i2c bus driver Kevin Strasser
2013-06-18 21:04 ` [PATCH v2 3/4] gpio: Kontron PLD gpio driver Kevin Strasser
2013-06-19 8:36 ` Linus Walleij
2013-06-27 22:14 ` Kevin Strasser
2013-06-18 21:04 ` [PATCH v2 4/4] watchdog: Kontron PLD watchdog timer driver Kevin Strasser
2013-06-24 4:00 ` [PATCH v3 0/4] Kontron PLD drivers Kevin Strasser
2013-06-24 4:00 ` [PATCH v3 1/4] mfd: Kontron PLD mfd driver Kevin Strasser
2013-06-24 4:00 ` [PATCH v3 2/4] i2c: Kontron PLD i2c bus driver Kevin Strasser
2013-07-01 6:40 ` Wolfram Sang
2013-06-24 4:00 ` [PATCH v3 3/4] gpio: Kontron PLD gpio driver Kevin Strasser
2013-07-21 14:31 ` Linus Walleij
2013-06-24 4:00 ` [PATCH v3 4/4] watchdog: Kontron PLD watchdog timer driver Kevin Strasser
2013-06-27 18:23 ` Kevin Strasser
2013-06-27 21:47 ` Samuel Ortiz
2013-06-27 22:05 ` Kevin Strasser
2013-06-24 12:06 ` [PATCH v3 0/4] Kontron PLD drivers Samuel Ortiz
2013-06-24 16:09 ` Wolfram Sang
2013-06-27 20:34 ` Wim Van Sebroeck
2013-06-27 21:48 ` Samuel Ortiz
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=20130619091127.GW7161@zurbaran \
--to=sameo@linux.intel.com \
--cc=Dirk.Hohndel@intel.com \
--cc=Michael.Brunner@kontron.com \
--cc=ben-linux@fluff.org \
--cc=broonie@kernel.org \
--cc=chealy@imsco-us.com \
--cc=dvhart@linux.intel.com \
--cc=grant.likely@secretlab.ca \
--cc=kevin.strasser@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mibru@gmx.de \
--cc=tglx@linutronix.de \
--cc=wim@iguana.be \
--cc=wsa@the-dreams.de \
/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).