[U-Boot] [PATCH v2 1/2] gpio: Add GPIO driver framework for Marvell SoCs
Simon Guinot
simon at sequanux.org
Tue Aug 2 16:10:42 CEST 2011
Hi Ajay,
On Fri, Jul 22, 2011 at 12:46:33PM +0530, Ajay Bhargav wrote:
> This patch adds generic GPIO driver framework support for Marvell SoCs.
>
> To enable GPIO driver define CONFIG_MARVELL_GPIO and for GPIO commands
> define CONFIG_CMD_GPIO in your board configuration file.
>
> Signed-off-by: Ajay Bhargav <ajay.bhargav at einfochips.com>
> ---
> drivers/gpio/Makefile | 1 +
> drivers/gpio/mvgpio.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 115 insertions(+), 0 deletions(-)
> create mode 100644 drivers/gpio/mvgpio.c
... snip ...
> +int gpio_direction_input(int gp)
> +{
> + struct gpio_reg *gpio_reg_bank;
> +
> + if (gp >= MV_MAX_GPIO) {
> + printf("%s: Invalid GPIO %d\n", __func__, gp);
> + return -EINVAL;
> + }
> +
> + gpio_reg_bank = get_gpio_base(GPIO_TO_REG(gp));
> + writel(GPIO_TO_BIT(gp), &gpio_reg_bank->gcdr);
AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear for
GPIO output/direction registers. Instead, a register must be read
first to leave other bits unchanged (see __set_direction in kw_gpio.c).
Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada struct gpio_reg array) ?
If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybe armada_gpio is a better name...
Regards,
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110802/3932c5e3/attachment.pgp
More information about the U-Boot
mailing list