lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 19 Jun 2013 11:11:27 +0200
From:	Samuel Ortiz <sameo@...ux.intel.com>
To:	Linus Walleij <linus.walleij@...aro.org>
Cc:	Kevin Strasser <kevin.strasser@...ux.intel.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Darren Hart <dvhart@...ux.intel.com>,
	Guenter Roeck <linux@...ck-us.net>,
	Michael Brunner <Michael.Brunner@...tron.com>,
	Michael Brunner <mibru@....de>,
	Chris Healy <chealy@...co-us.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Dirk Hohndel <Dirk.Hohndel@...el.com>,
	Wolfram Sang <wsa@...-dreams.de>,
	Ben Dooks <ben-linux@...ff.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	Wim Van Sebroeck <wim@...ana.be>,
	Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH v2 1/4] mfd: Kontron PLD mfd driver

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@...ux.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@...ux.intel.com>
> > Signed-off-by: Michael Brunner <michael.brunner@...tron.com>
> > Acked-by: Guenter Roeck <linux@...ck-us.net>
> > Acked-by: Darren Hart <dvhart@...ux.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/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ