From: charu@ti.com (Varadarajan, Charulatha)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/15] OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs
Date: Tue, 26 Apr 2011 18:03:32 +0530 [thread overview]
Message-ID: <BANLkTi=ivNqfTTscWJYk2gCEznMus_Qd-Q@mail.gmail.com> (raw)
In-Reply-To: <1303513327-14532-11-git-send-email-khilman@ti.com>
Kevin,
On Sat, Apr 23, 2011 at 04:32, Kevin Hilman <khilman@ti.com> wrote:
> Cleanup GPIO IRQ enable/disable handling by removing SoC-specific
>
> Also split enable/disable IRQ into separate functions for better
> readability and also facilitate potentially moving to generic irq_chip
> in the future.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
<<snip>>
> ?static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
> diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
> index 35e8b31..880f3cb 100644
> --- a/arch/arm/mach-omap1/gpio7xx.c
> +++ b/arch/arm/mach-omap1/gpio7xx.c
> @@ -44,6 +44,8 @@ static struct omap_gpio_reg_offs omap7xx_mpuio_regs = {
> ? ? ? ?.datain ? ? ? ? = OMAP_MPUIO_INPUT_LATCH / 2,
> ? ? ? ?.dataout ? ? ? ?= OMAP_MPUIO_OUTPUT / 2,
> ? ? ? ?.irqstatus ? ? ?= OMAP_MPUIO_GPIO_INT / 2,
> + ? ? ? .irqenable ? ? ?= OMAP_MPUIO_GPIO_MASKIT / 2,
> + ? ? ? .irqenable_inv ?= true,
> ?};
>
> ?static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
> @@ -82,6 +84,8 @@ static struct omap_gpio_reg_offs omap7xx_gpio_regs = {
> ? ? ? ?.datain ? ? ? ? = OMAP7XX_GPIO_DATA_INPUT,
> ? ? ? ?.dataout ? ? ? ?= OMAP7XX_GPIO_DATA_OUTPUT,
> ? ? ? ?.irqstatus ? ? ?= OMAP7XX_GPIO_INT_STATUS,
> + ? ? ? .irqenable ? ? ?= OMAP7XX_GPIO_INT_MASK,
> + ? ? ? .irqenable ? ? ?= true,
irqenable_inv should be true and not irqenable.
> ?};
>
> ?static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
<<snip>>
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 4f875cf..17833c8 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
<<snip>>
> -static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enable)
> +static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
> ?{
> ? ? ? ?void __iomem *reg = bank->base;
> ? ? ? ?u32 l;
>
> - ? ? ? switch (bank->method) {
> -#ifdef CONFIG_ARCH_OMAP1
> - ? ? ? case METHOD_MPUIO:
> - ? ? ? ? ? ? ? reg += OMAP_MPUIO_GPIO_MASKIT / bank->stride;
> - ? ? ? ? ? ? ? l = __raw_readl(reg);
> - ? ? ? ? ? ? ? if (enable)
> - ? ? ? ? ? ? ? ? ? ? ? l &= ~(gpio_mask);
> - ? ? ? ? ? ? ? else
> - ? ? ? ? ? ? ? ? ? ? ? l |= gpio_mask;
> - ? ? ? ? ? ? ? break;
> -#endif
> -#ifdef CONFIG_ARCH_OMAP15XX
> - ? ? ? case METHOD_GPIO_1510:
> - ? ? ? ? ? ? ? reg += OMAP1510_GPIO_INT_MASK;
> + ? ? ? if (bank->regs->set_irqenable) {
> + ? ? ? ? ? ? ? reg += bank->regs->set_irqenable;
> + ? ? ? ? ? ? ? l = gpio_mask;
> + ? ? ? } else {
> + ? ? ? ? ? ? ? reg += bank->regs->irqenable;
> ? ? ? ? ? ? ? ?l = __raw_readl(reg);
> - ? ? ? ? ? ? ? if (enable)
> - ? ? ? ? ? ? ? ? ? ? ? l &= ~(gpio_mask);
> + ? ? ? ? ? ? ? if (bank->regs->irqenable_inv)
> + ? ? ? ? ? ? ? ? ? ? ? l &= ~gpio_mask;
> ? ? ? ? ? ? ? ?else
> ? ? ? ? ? ? ? ? ? ? ? ?l |= gpio_mask;
This else case code is required for _disable_gpio_irqbank() only.
There should be no else part here.
> - ? ? ? ? ? ? ? break;
> -#endif
> -#ifdef CONFIG_ARCH_OMAP16XX
> - ? ? ? case METHOD_GPIO_1610:
> - ? ? ? ? ? ? ? if (enable)
> - ? ? ? ? ? ? ? ? ? ? ? reg += OMAP1610_GPIO_SET_IRQENABLE1;
> - ? ? ? ? ? ? ? else
> - ? ? ? ? ? ? ? ? ? ? ? reg += OMAP1610_GPIO_CLEAR_IRQENABLE1;
> + ? ? ? }
> +
> + ? ? ? __raw_writel(l, reg);
> +}
> +
> +static void _disable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
> +{
> + ? ? ? void __iomem *reg = bank->base;
> + ? ? ? u32 l;
> +
> + ? ? ? if (bank->regs->clr_irqenable) {
> + ? ? ? ? ? ? ? reg += bank->regs->clr_irqenable;
> ? ? ? ? ? ? ? ?l = gpio_mask;
> - ? ? ? ? ? ? ? break;
> -#endif
> -#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
> - ? ? ? case METHOD_GPIO_7XX:
> - ? ? ? ? ? ? ? reg += OMAP7XX_GPIO_INT_MASK;
> + ? ? ? } else {
> + ? ? ? ? ? ? ? reg += bank->regs->irqenable;
> ? ? ? ? ? ? ? ?l = __raw_readl(reg);
> - ? ? ? ? ? ? ? if (enable)
> - ? ? ? ? ? ? ? ? ? ? ? l &= ~(gpio_mask);
> - ? ? ? ? ? ? ? else
> + ? ? ? ? ? ? ? if (bank->regs->irqenable_inv)
> ? ? ? ? ? ? ? ? ? ? ? ?l |= gpio_mask;
> - ? ? ? ? ? ? ? break;
> -#endif
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> - ? ? ? case METHOD_GPIO_24XX:
> - ? ? ? ? ? ? ? if (enable)
> - ? ? ? ? ? ? ? ? ? ? ? reg += OMAP24XX_GPIO_SETIRQENABLE1;
> - ? ? ? ? ? ? ? else
> - ? ? ? ? ? ? ? ? ? ? ? reg += OMAP24XX_GPIO_CLEARIRQENABLE1;
> - ? ? ? ? ? ? ? l = gpio_mask;
> - ? ? ? ? ? ? ? break;
> -#endif
> -#ifdef CONFIG_ARCH_OMAP4
> - ? ? ? case METHOD_GPIO_44XX:
> - ? ? ? ? ? ? ? if (enable)
> - ? ? ? ? ? ? ? ? ? ? ? reg += OMAP4_GPIO_IRQSTATUSSET0;
> ? ? ? ? ? ? ? ?else
> - ? ? ? ? ? ? ? ? ? ? ? reg += OMAP4_GPIO_IRQSTATUSCLR0;
> - ? ? ? ? ? ? ? l = gpio_mask;
> - ? ? ? ? ? ? ? break;
> -#endif
> - ? ? ? default:
> - ? ? ? ? ? ? ? WARN_ON(1);
> - ? ? ? ? ? ? ? return;
> + ? ? ? ? ? ? ? ? ? ? ? l &= ~gpio_mask;
This else case code is required for _enable_gpio_irqbank() only.
There should be no else part here.
> ? ? ? ?}
> +
> ? ? ? ?__raw_writel(l, reg);
> ?}
>
-V Charulatha
next prev parent reply other threads:[~2011-04-26 12:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-22 23:01 [PATCH 00/15] OMAP: GPIO: clean up: pass register offsets via pdata Kevin Hilman
2011-04-22 23:01 ` [PATCH 01/15] OMAP: GPIO: _clear_gpio_irqbank: fix flushing of posted write Kevin Hilman
2011-04-22 23:01 ` [PATCH 02/15] OMAP: GPIO: remove MPUIO handling from _clear_gpio_irqbank() Kevin Hilman
2011-04-25 13:48 ` Varadarajan, Charulatha
2011-05-03 16:27 ` Kevin Hilman
2011-04-22 23:01 ` [PATCH 03/15] OMAP: GPIO: move bank width into struct gpio_bank Kevin Hilman
2011-04-22 23:01 ` [PATCH 04/15] OMAP: GPIO: _get_gpio_irqbank_mask: replace hard-coded mask with bank->width Kevin Hilman
2011-04-22 23:01 ` [PATCH 05/15] OMAP: GPIO: replace get_gpio_index() by using bank width Kevin Hilman
2011-04-22 23:01 ` [PATCH 06/15] OMAP: GPIO: remove get_gpio_bank() Kevin Hilman
2011-04-22 23:01 ` [PATCH 07/15] OMAP: GPIO: move register offset defines into gpio.h Kevin Hilman
2011-04-22 23:02 ` [PATCH 08/15] OMAP: GPIO: consolidate direction, input, output, remove #ifdefs Kevin Hilman
2011-04-22 23:02 ` [PATCH 09/15] OMAP: GPIO: consolidate IRQ status handling, " Kevin Hilman
2011-04-26 12:43 ` Varadarajan, Charulatha
2011-04-22 23:02 ` [PATCH 10/15] OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs Kevin Hilman
2011-04-26 12:33 ` Varadarajan, Charulatha [this message]
2011-04-22 23:02 ` [PATCH 11/15] OMAP: GPIO: convert MPUIO IRQ over to generic irq_chip Kevin Hilman
2011-04-26 12:02 ` Varadarajan, Charulatha
2011-04-22 23:02 ` [PATCH 12/15] OMAP: GPIO: remove useless gpio_valid() & check_gpio() checks Kevin Hilman
2011-04-22 23:02 ` [PATCH 13/15] OMAP: GPIO: cleanup _set_gpio_wakeup(), remove ifdefs Kevin Hilman
2011-04-26 14:44 ` Varadarajan, Charulatha
2011-05-03 16:35 ` Kevin Hilman
2011-04-22 23:02 ` [PATCH 14/15] OMAP: GPIO: debounce remove SoC specific registers, use pdata Kevin Hilman
2011-04-22 23:02 ` [PATCH 15/15] OMAP: GPIO: cleanup show revision, remove cpu_is checks, display only once Kevin Hilman
2011-04-26 11:48 ` Varadarajan, Charulatha
2011-05-03 16:38 ` Kevin Hilman
2011-05-03 23:59 ` Kevin Hilman
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='BANLkTi=ivNqfTTscWJYk2gCEznMus_Qd-Q@mail.gmail.com' \
--to=charu@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).