[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 8 Aug 2012 11:11:45 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: vt8500-wm8505-linux-kernel@...glegroups.com,
Tony Prisk <linux@...sktech.co.nz>
Cc: Russell King <linux@....linux.org.uk>,
Arnd Bergmann <arnd@...db.de>,
Alessandro Zummo <a.zummo@...ertech.it>,
Grant Likely <grant.likely@...retlab.ca>,
Rob Herring <rob.herring@...xeda.com>,
Alan Cox <alan@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Stern <stern@...land.harvard.edu>,
Hauke Mehrtens <hauke@...ke-m.de>, Felipe Balbi <balbi@...com>,
Neil Zhang <zhangwm@...vell.com>,
Florian Tobias Schandinat <FlorianSchandinat@....de>,
Rob Landley <rob@...dley.net>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Stephen Warren <swarren@...dia.com>,
Eric Andersson <eric.andersson@...xphere.com>,
Linus Walleij <linus.walleij@...ricsson.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-fbdev@...r.kernel.org,
linux-usb@...r.kernel.org, linux-serial@...r.kernel.org,
devicetree-discuss@...ts.ozlabs.org
Subject: Re: [rtc-linux] [PATCH 8/8] ARM: vt8500: gpio: Devicetree support for arch-vt8500
On Wed, Aug 8, 2012 at 3:39 AM, Tony Prisk <linux@...sktech.co.nz> wrote:
> Converted the existing arch-vt8500 gpio to a platform_device.
> Added support for WM8505 and WM8650 GPIO controllers.
(...)
> +++ b/drivers/gpio/gpio-vt8500.c
This driver looks very one-bit-per-gpio typed. Are you sure you cannot
just reuse drivers/gpio/gpio-generic.c? Make a compelling case please...
> +struct vt8500_gpio_bank_regs {
> + int en;
> + int dir;
> + int data_out;
> + int data_in;
Why are all these members int? They should be u8 from reading your code.
> + int ngpio;
> +};
> +static struct vt8500_gpio_data vt8500_data = {
> + .num_banks = 7,
> + .banks = {
> + VT8500_BANK(0x00, 0x20, 0x40, 0x60, 26),
> + VT8500_BANK(0x04, 0x24, 0x44, 0x64, 28),
> + VT8500_BANK(0x08, 0x28, 0x48, 0x68, 31),
> + VT8500_BANK(0x0C, 0x2C, 0x4C, 0x6C, 19),
> + VT8500_BANK(0x10, 0x30, 0x50, 0x70, 19),
> + VT8500_BANK(0x14, 0x34, 0x54, 0x74, 23),
> + VT8500_BANK(-1, 0x3C, 0x5C, 0x7C, 9), /* external gpio */
What on earth are all those magic numbers?
I *guess* they're enabling some default GPIO settings etc.
But it really needs better structure, #defines for each one or
atleast include <linux/bitops.h> and say:
= BIT(4) | /* Enable GPIO pin 5 on this bank */
BIT(5); /* Enable GPIO pin 6 on this bank */
However I suspect this is board specific and should
be taken from device tree. Please elaborate on this...
Ditto for the different instances.
(...)
> + unsigned val;
Looks like all of these should be u8.
> + val = readl(vt8500_chip->base + vt8500_chip->regs->en +
> + vt8500_chip->regoff);
val = (u8) readl(...);
usw
> + val |= (1 << offset);
Use <linux/bitops.h>
val |= BIT(offset);
Apart from these remarks it's looking good...
Yours,
Linus Walleij
--
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