mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/4] gpio: add ARM Primcell pl061 support
Date: Fri, 5 Oct 2012 14:29:29 +0200	[thread overview]
Message-ID: <20121005122929.GR1322@pengutronix.de> (raw)
In-Reply-To: <1349435923-29233-3-git-send-email-plagnioj@jcrosoft.com>

On Fri, Oct 05, 2012 at 01:18:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> +
> +	ret = gpiochip_add(&chip->gc);
> +	if (ret) {
> +		dev_err(&dev->dev, "couldn't add gpiochip\n");

Print error value?

> +		goto free_mem;
> +	}
> +
> +	writeb(0, chip->base + GPIOIE); /* disable irqs */
> +
> +	for (i = 0; i < PL061_GPIO_NR; i++) {
> +		if (pdata) {
> +			if (pdata->directions & (1 << i))
> +				pl061_direction_output(&chip->gc, i,
> +						pdata->values & (1 << i));
> +			else
> +				pl061_direction_input(&chip->gc, i);

I don't think a gpio driver should alter the directions without being
asked. Just leave the directions untouched without platform_data.

> +
> +MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
> +MODULE_DESCRIPTION("PL061 GPIO driver");
> +MODULE_LICENSE("GPL");
> diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
> new file mode 100644
> index 0000000..fb83c04
> --- /dev/null
> +++ b/include/linux/amba/pl061.h
> @@ -0,0 +1,16 @@
> +#include <linux/types.h>
> +
> +/* platform data for the PL061 GPIO driver */
> +
> +struct pl061_platform_data {
> +	/* number of the first GPIO */
> +	unsigned	gpio_base;
> +
> +	/* number of the first IRQ.
> +	 * If the IRQ functionality in not desired this must be set to 0.
> +	 */
> +	unsigned	irq_base;
> +
> +	u8		directions;	/* startup directions, 1: out, 0: in */
> +	u8		values;		/* startup values */
> +};

include file protection?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-10-05 12:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 11:04 [PATCH 0/4] add gpio primcell " Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 11:18 ` [PATCH 1/4] gpiolib: select GENERIC_GPIO Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 11:18   ` [PATCH 2/4] gpio: provide generic gpio header Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 12:21     ` Sascha Hauer
2012-10-05 11:18   ` [PATCH 3/4] gpio: add ARM Primcell pl061 support Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 12:29     ` Sascha Hauer [this message]
2012-10-05 11:18   ` [PATCH 4/4] versatilepb: add gpio support Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 13:20 [PATCH 0/4 v2] add gpio primcell pl061 support Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 13:25 ` [PATCH 1/4] gpiolib: select GENERIC_GPIO Jean-Christophe PLAGNIOL-VILLARD
2012-10-05 13:25   ` [PATCH 3/4] gpio: add ARM Primcell pl061 support Jean-Christophe PLAGNIOL-VILLARD

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=20121005122929.GR1322@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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