All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] gpio: add gpio api support to mx27 (v2)
Date: Thu, 23 Aug 2012 16:39:52 +0200	[thread overview]
Message-ID: <503640B8.2010605@denx.de> (raw)
In-Reply-To: <1344266963-2514-1-git-send-email-tremyfr@yahoo.fr>

On 06/08/2012 17:29, Philippe Reynes wrote:
> There is a little change on gpio_get_value because
> on mx27 the register to read is ssr and not dr.
> 
> Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>
> ---

Hi Philippe,

>  arch/arm/cpu/arm926ejs/mx27/generic.c     |   11 +++---
>  arch/arm/include/asm/arch-mx27/gpio.h     |   55 +++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-mx27/imx-regs.h |   30 ++++------------
>  drivers/gpio/mxc_gpio.c                   |   12 +++++--
>  4 files changed, 77 insertions(+), 31 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-mx27/gpio.h
> 
> diff --git a/arch/arm/cpu/arm926ejs/mx27/generic.c b/arch/arm/cpu/arm926ejs/mx27/generic.c
> index 65c4813..41bb84b 100644
> --- a/arch/arm/cpu/arm926ejs/mx27/generic.c
> +++ b/arch/arm/cpu/arm926ejs/mx27/generic.c
> @@ -24,6 +24,7 @@
>  #include <asm/io.h>
>  #include <asm/arch/imx-regs.h>
>  #include <asm/arch/clock.h>
> +#include <asm/arch/gpio.h>
>  #ifdef CONFIG_MXC_MMC
>  #include <asm/arch/mxcmmc.h>
>  #endif
> @@ -209,7 +210,7 @@ int cpu_mmc_init(bd_t *bis)
>  
>  void imx_gpio_mode(int gpio_mode)
>  {
> -	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
> +	struct gpio_port_regs *regs = (struct gpio_port_regs *)IMX_GPIO_BASE;
>  	unsigned int pin = gpio_mode & GPIO_PIN_MASK;
>  	unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
>  	unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
> @@ -228,11 +229,11 @@ void imx_gpio_mode(int gpio_mode)
>  
>  	/* Data direction */
>  	if (gpio_mode & GPIO_OUT) {
> -		writel(readl(&regs->port[port].ddir) | 1 << pin,
> -				&regs->port[port].ddir);
> +		writel(readl(&regs->port[port].gpio_dir) | 1 << pin,
> +				&regs->port[port].gpio_dir);
>  	} else {
> -		writel(readl(&regs->port[port].ddir) & ~(1 << pin),
> -				&regs->port[port].ddir);
> +		writel(readl(&regs->port[port].gpio_dir) & ~(1 << pin),
> +				&regs->port[port].gpio_dir);
>  	}

This is strange, because it does not make use of
gpio_direction_output(). However, if we use it, generic.c depends on
CONFIG_MXC_GPIO. Ok


>  
> +#ifndef CONFIG_MX27
>  	val = (readl(&regs->gpio_dr) >> gpio) & 0x01;
> +#else
> +	val = (readl(&regs->ssr) >> gpio) & 0x01;
> +#endif
>  

A recent patch uses psr on the other SOC instead of dr to read directly
the pad status instead of the internal shadow register. If you rename
your ssr into gpio_psr we do not need this #ifdef.

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  parent reply	other threads:[~2012-08-23 14:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 15:29 [U-Boot] [PATCH 1/2] gpio: add gpio api support to mx27 (v2) Philippe Reynes
2012-08-06 15:29 ` [U-Boot] [PATCH 2/2] imx27lite: update with gpio api change (v3) Philippe Reynes
2012-08-23 14:39 ` Stefano Babic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-05 18:58 [U-Boot] [PATCH 1/2] gpio: add gpio api support to mx27 (v2) Philippe Reynes

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=503640B8.2010605@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.