public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel•com (Nicolas Ferre)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH RESEND 6/6 v13] gpio: Add block gpio to several gpio drivers
Date: Tue, 15 Jan 2013 14:18:53 +0100	[thread overview]
Message-ID: <50F5573D.4060007@atmel.com> (raw)
In-Reply-To: <1358250716-21986-7-git-send-email-stigge@antcom.de>

Hi,

Le 15/01/2013 12:51, Roland Stigge a ?crit :
> This patch adds block GPIO support to several gpio drivers.
>
> This implements block GPIO only for some selected drivers since block GPIO is
> an optional feature which may not be suitable for every GPIO hardware. (With
> automatic fallback to the single GPIO functions if not available in a driver.)
>
> Signed-off-by: Roland Stigge <stigge@antcom•de>
>
> ---
>   drivers/gpio/Kconfig              |    2
>   drivers/gpio/gpio-em.c            |   23 ++++++++++
>   drivers/gpio/gpio-ge.c            |   29 +++++++++++++
>   drivers/gpio/gpio-generic.c       |   56 +++++++++++++++++++++++++
>   drivers/gpio/gpio-ks8695.c        |   34 +++++++++++++++
>   drivers/gpio/gpio-lpc32xx.c       |   82 ++++++++++++++++++++++++++++++++++++++
>   drivers/gpio/gpio-max730x.c       |   61 ++++++++++++++++++++++++++++
>   drivers/gpio/gpio-max732x.c       |   59 +++++++++++++++++++++++++++
>   drivers/gpio/gpio-mc33880.c       |   16 +++++++
>   drivers/gpio/gpio-ml-ioh.c        |   27 ++++++++++++
>   drivers/gpio/gpio-mm-lantiq.c     |   22 ++++++++++
>   drivers/gpio/gpio-mpc5200.c       |   64 +++++++++++++++++++++++++++++
>   drivers/gpio/gpio-mpc8xxx.c       |   41 +++++++++++++++++++
>   drivers/gpio/gpio-pca953x.c       |   64 +++++++++++++++++++++++++++++
>   drivers/gpio/gpio-pcf857x.c       |   24 +++++++++++
>   drivers/gpio/gpio-pch.c           |   27 ++++++++++++
>   drivers/gpio/gpio-pl061.c         |   17 +++++++
>   drivers/gpio/gpio-sa1100.c        |   20 +++++++++
>   drivers/gpio/gpio-samsung.c       |   31 ++++++++++++++
>   drivers/gpio/gpio-twl6040.c       |   32 ++++++++++++++
>   drivers/gpio/gpio-ucb1400.c       |   23 ++++++++++
>   drivers/gpio/gpio-vt8500.c        |   24 +++++++++++
>   drivers/gpio/gpio-xilinx.c        |   44 ++++++++++++++++++++
>   drivers/pinctrl/pinctrl-at91.c    |   29 +++++++++++++

I do not want to delay the process of inclusion for this patch series. 
But I have a little question on AT91 driver modification...

>   drivers/pinctrl/pinctrl-nomadik.c |   36 ++++++++++++++++
>   25 files changed, 887 insertions(+)

[..]

> --- linux-2.6.orig/drivers/pinctrl/pinctrl-at91.c
> +++ linux-2.6/drivers/pinctrl/pinctrl-at91.c
> @@ -49,6 +49,7 @@ struct at91_gpio_chip {
>   	struct clk		*clock;		/* associated clock */
>   	struct irq_domain	*domain;	/* associated irq domain */
>   	struct at91_pinctrl_mux_ops *ops;	/* ops */
> +	unsigned long		mask_cache;	/* cached mask for block gpio */
>   };
>
>   #define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
> @@ -1125,6 +1126,32 @@ static void at91_gpio_set(struct gpio_ch
>   	writel_relaxed(mask, pio + (val ? PIO_SODR : PIO_CODR));
>   }
>
> +static unsigned long at91_gpio_get_block(struct gpio_chip *chip,
> +					 unsigned long mask)
> +{
> +	struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
> +	void __iomem *pio = at91_gpio->regbase;
> +	u32 pdsr;
> +
> +	pdsr = __raw_readl(pio + PIO_PDSR);

Maybe you should use readl_relaxed() here as it is used in the 
at91_gpio_[get|set]() functions.


> +	return pdsr & mask;
> +}
> +
> +static void at91_gpio_set_block(struct gpio_chip *chip, unsigned long mask,
> +				unsigned long val)
> +{
> +	struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
> +	void __iomem *pio = at91_gpio->regbase;
> +
> +	/* Do synchronous data output with a single write access */
> +	if (mask != at91_gpio->mask_cache) {
> +		at91_gpio->mask_cache = mask;
> +		__raw_writel(~mask, pio + PIO_OWDR);
> +		__raw_writel(mask, pio + PIO_OWER);
> +	}
> +	__raw_writel(val, pio + PIO_ODSR);

Ditto.

> +}
> +
>   static int at91_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
>   				int val)
>   {
> @@ -1435,8 +1462,10 @@ static struct gpio_chip at91_gpio_templa
>   	.free			= at91_gpio_free,
>   	.direction_input	= at91_gpio_direction_input,
>   	.get			= at91_gpio_get,
> +	.get_block		= at91_gpio_get_block,
>   	.direction_output	= at91_gpio_direction_output,
>   	.set			= at91_gpio_set,
> +	.set_block		= at91_gpio_set_block,
>   	.to_irq			= at91_gpio_to_irq,
>   	.dbg_show		= at91_gpio_dbg_show,
>   	.can_sleep		= 0,
> --- linux-2.6.orig/drivers/pinctrl/pinctrl-nomadik.c
> +++ linux-2.6/drivers/pinctrl/pinctrl-nomadik.c

[..]

Otherwise, seems ok to me ; for AT91 part:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel•com>

Best regards,
-- 
Nicolas Ferre

  reply	other threads:[~2013-01-15 13:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 11:51 [PATCH RESEND 0/6 v13] gpio: Add block GPIO Roland Stigge
2013-01-15 11:51 ` [PATCH RESEND 1/6 v13] gpio: Add a block GPIO API to gpiolib Roland Stigge
2013-01-18 12:13   ` Stijn Devriendt
2013-01-18 13:18     ` Roland Stigge
2013-02-15 13:16     ` Grant Likely
2013-02-15 14:47   ` Grant Likely
2013-02-15 16:34   ` Grant Likely
2013-01-15 11:51 ` [PATCH RESEND 2/6 v13] gpio: Add sysfs support to block GPIO API Roland Stigge
2013-02-15 21:50   ` Grant Likely
2013-01-15 11:51 ` [PATCH RESEND 3/6 v13] gpio: Add userland device interface to block GPIO Roland Stigge
2013-01-15 11:51 ` [PATCH RESEND 4/6 v13] gpiolib: Fix default attributes for class Roland Stigge
2013-02-15 22:55   ` Grant Likely
2013-01-15 11:51 ` [PATCH RESEND 5/6 v13] gpio: Add device tree support to block GPIO API Roland Stigge
2013-01-15 11:51 ` [PATCH RESEND 6/6 v13] gpio: Add block gpio to several gpio drivers Roland Stigge
2013-01-15 13:18   ` Nicolas Ferre [this message]
2013-01-15 13:30     ` Roland Stigge

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=50F5573D.4060007@atmel.com \
    --to=nicolas.ferre@atmel$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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