public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@uclinux.org>
To: sfking@fdwdc.com
Cc: geert@linux-m68k.org, linux-m68k@vger.kernel.org
Subject: Re: [PATCH 4/4] Implement gpio support for m54xx.
Date: Thu, 22 May 2014 11:24:24 +1000	[thread overview]
Message-ID: <537D51C8.10908@uclinux.org> (raw)
In-Reply-To: <1400713233-9155-5-git-send-email-sfking@fdwdc.com>

On 22/05/14 09:00, sfking@fdwdc.com wrote:
> From: Steven King <sfking@fdwdc.com>
> 
> ---
>  arch/m68k/include/asm/m54xxsim.h |   12 +++++++++---
>  arch/m68k/include/asm/mcfgpio.h  |   12 ++++++++----
>  2 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
> index d3bd838..a5fbd17 100644
> --- a/arch/m68k/include/asm/m54xxsim.h
> +++ b/arch/m68k/include/asm/m54xxsim.h
> @@ -55,9 +55,15 @@
>  /*
>   *	Generic GPIO support
>   */
> -#define MCFGPIO_PIN_MAX		0	/* I am too lazy to count */
> -#define MCFGPIO_IRQ_MAX		-1
> -#define MCFGPIO_IRQ_VECBASE	-1
> +#define MCFGPIO_PODR		(MCF_MBAR + 0xA00)
> +#define MCFGPIO_PDDR		(MCF_MBAR + 0xA10)
> +#define MCFGPIO_PPDR		(MCF_MBAR + 0xA20)
> +#define MCFGPIO_SETR		(MCF_MBAR + 0xA20)
> +#define MCFGPIO_CLRR		(MCF_MBAR + 0xA30)
> +
> +#define MCFGPIO_PIN_MAX		136	/* 128 gpio + 8 eport */
> +#define MCFGPIO_IRQ_MAX		8
> +#define MCFGPIO_IRQ_VECBASE	MCFINT_VECBASE
>  
>  /*
>   *	EDGE Port support.
> diff --git a/arch/m68k/include/asm/mcfgpio.h b/arch/m68k/include/asm/mcfgpio.h
> index c41ebf4..66203c3 100644
> --- a/arch/m68k/include/asm/mcfgpio.h
> +++ b/arch/m68k/include/asm/mcfgpio.h
> @@ -139,7 +139,8 @@ static inline void gpio_free(unsigned gpio)
>  
>  #if defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
>      defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
> -    defined(CONFIG_M53xx) || defined(CONFIG_M5441x)
> +    defined(CONFIG_M53xx) || defined(CONFIG_M54xx) || \
> +    defined(CONFIG_M5441x)
>  /*
>   * These parts have an 'Edge' Port module (external interrupt/GPIO) which uses
>   * read-modify-write to change an output and a GPIO module which has separate
> @@ -195,7 +196,8 @@ static inline u32 __mcfgpio_ppdr(unsigned gpio)
>  		return MCFSIM2_GPIO1READ;
>  #elif defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
>        defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
> -      defined(CONFIG_M53xx) || defined(CONFIG_M5441x)
> +      defined(CONFIG_M53xx) || defined(CONFIG_M54xx) || \
> +      defined(CONFIG_M5441x)

Not proposing for this patch... But I wonder if this could be done
a little more cleanly by basing the #elif on the presence of the
MCFEPORT_EPPDR definition.

Same goes for the other #ifdef/#elif clauses.

Just a thought.

Regards
Greg



>  #if !defined(CONFIG_M5441x)
>  	if (gpio < 8)
>  		return MCFEPORT_EPPDR;
> @@ -237,7 +239,8 @@ static inline u32 __mcfgpio_podr(unsigned gpio)
>  		return MCFSIM2_GPIO1WRITE;
>  #elif defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
>        defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
> -      defined(CONFIG_M53xx) || defined(CONFIG_M5441x)
> +      defined(CONFIG_M53xx) || defined(CONFIG_M54xx) || \
> +      defined(CONFIG_M5441x)
>  #if !defined(CONFIG_M5441x)
>  	if (gpio < 8)
>  		return MCFEPORT_EPDR;
> @@ -279,7 +282,8 @@ static inline u32 __mcfgpio_pddr(unsigned gpio)
>  		return MCFSIM2_GPIO1ENABLE;
>  #elif defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
>        defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
> -      defined(CONFIG_M53xx) || defined(CONFIG_M5441x)
> +      defined(CONFIG_M53xx) || defined(CONFIG_M54xx) || \
> +      defined(CONFIG_M5441x)
>  #if !defined(CONFIG_M5441x)
>  	if (gpio < 8)
>  		return MCFEPORT_EPDDR;
> 

  reply	other threads:[~2014-05-22  1:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 23:00 [PATCH 0/4] m68knommu: Coldfire gpio fixes and updates sfking
2014-05-21 23:00 ` [PATCH 1/4] add to_irq function so we can map gpios to external interrupts sfking
2014-05-21 23:00 ` [PATCH 2/4] setting the gpio data direction register to output doesn't dependent upon the value to output! sfking
2014-05-21 23:00 ` [PATCH 3/4] Make everything thats not exported, static sfking
2014-05-21 23:00 ` [PATCH 4/4] Implement gpio support for m54xx sfking
2014-05-22  1:24   ` Greg Ungerer [this message]
2014-05-22  2:51     ` Steven King
2014-05-22  6:39   ` Geert Uytterhoeven
2014-05-22 13:46     ` Steven King
2014-05-22  1:15 ` [PATCH 0/4] m68knommu: Coldfire gpio fixes and updates Greg Ungerer
2014-05-22  2:00   ` Steven King

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=537D51C8.10908@uclinux.org \
    --to=gerg@uclinux.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=sfking@fdwdc.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