Re: [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tarun,

On Mon, May 16, 2011 at 17:11, Tarun Kanti DebBarma <tarun.kanti@xxxxxx> wrote:
> We can get rid of ifdef / if checks of OMAP revision in set_24xx_gpio_triggering()
> and omap_gpio_free().
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@xxxxxx>
> Cc: Charulatha V <charu@xxxxxx>
> Cc: Santosh Shilimkar <santosh.shilimkar@xxxxxx>
> Cc: Kevin Hilman <khilman@xxxxxx>
> Cc: Tony Lindgren <tony@xxxxxxxxxxx>
> ---
>  arch/arm/plat-omap/gpio.c |   38 ++++++++------------------------------
>  1 files changed, 8 insertions(+), 30 deletions(-)
>
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 714626a..bc07559 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -269,15 +269,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
>                        bank->enabled_non_wakeup_gpios &= ~gpio_bit;
>        }
>
> -       if (cpu_is_omap44xx()) {
> -               bank->level_mask =
> -                       __raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT0) |
> -                       __raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT1);
> -       } else {
> -               bank->level_mask =
> -                       __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) |
> -                       __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> -       }
> +       bank->level_mask =
> +               __raw_readl(bank->base + bank->regs->leveldetect0) |
> +               __raw_readl(bank->base + bank->regs->leveldetect1);
>  }
>  #endif
>
> @@ -609,29 +603,13 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
>  {
>        struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
>        unsigned long flags;
> +       void __iomem *reg;
>
>        spin_lock_irqsave(&bank->lock, flags);
> -#ifdef CONFIG_ARCH_OMAP16XX
> -       if (bank->method == METHOD_GPIO_1610) {
> -               /* Disable wake-up during idle for dynamic tick */
> -               void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
> -               __raw_writel(1 << offset, reg);
> -       }
> -#endif
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> -       if (bank->method == METHOD_GPIO_24XX) {
> -               /* Disable wake-up during idle for dynamic tick */
> -               void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
> -               __raw_writel(1 << offset, reg);
> -       }
> -#endif
> -#ifdef CONFIG_ARCH_OMAP4
> -       if (bank->method == METHOD_GPIO_44XX) {
> -               /* Disable wake-up during idle for dynamic tick */
> -               void __iomem *reg = bank->base + OMAP4_GPIO_IRQWAKEN0;
> -               __raw_writel(1 << offset, reg);
> -       }
> -#endif
> +       /* Disable wake-up during idle for dynamic tick */
> +       reg = bank->base + bank->regs->wkupclear;

Consider using bank->wake_clear instead of extracting reg here.

> +
> +       __raw_writel(1 << offset, reg);

This is wrong on OMAP15xx & OMAP7xx as wkupclear is NULL.

-V Charulatha

>        bank->mod_usage &= ~(1 << offset);
>
>        if ((bank->regs->ctrl != USHRT_MAX) && (!bank->mod_usage)) {
> --
> 1.6.0.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux