Re: [PATCH 1/8] OMAP:GPIO:Move architecture specific macros to specific header

Tony Lindgren
2010-04-01T09:39:28Z

* Varadarajan, Charulatha <charu@ti.com> [100401 01:48]:
> >
> > Add prefixes to these defines and remove the ifdefs.
> > This breaks multi-omap builds.
>
> AFAIK multi-omap build not applicable for OMAP1

Wrong. Multi-omap for omap1 has been mostly working for
about 5 years. In general, we don't want to apply patches
that obviously break things like that.

If you take a look at arch/arm/mach-omap1/Kconfig, there's
no "choice" there between omap1 socs.

> >
> > >-struct gpio_bank {
> > >- unsigned long pbase;
> > >- void __iomem *base;
> > >- u16 irq;
> > >- u16 virtual_irq_start;
> > >- int method;
> > >-#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
> > >- u32 suspend_wakeup;
> > >- u32 saved_wakeup;
> > >-#endif
> > >-#ifdef CONFIG_ARCH_OMAP2PLUS
> > >- u32 non_wakeup_gpios;
> > >- u32 enabled_non_wakeup_gpios;
> > >-
> > >- u32 saved_datain;
> > >- u32 saved_fallingdetect;
> > >- u32 saved_risingdetect;
> > >-#endif
> > >- u32 level_mask;
> > >- u32 toggle_mask;
> > >- spinlock_t lock;
> > >- struct gpio_chip chip;
> > >- struct clk *dbck;
> > >- u32 mod_usage;
> > >-};
> >
> > defines are fine, but this structure belongs to this driver. Nobody else
> > should need to poke on it. Keep it here.
>
> This would get used in mach-omap layers in the later patches.
> Hence moving it to gpio.h

Why would the hwmod code need to know about the register layout?
That's totally gpio specific.

> > >@@ -625,10 +421,12 @@ void omap_set_gpio_debounce(int gpio, int enable)
> > > bank = get_gpio_bank(gpio);
> > > reg = bank->base;
> > >
> > >+#ifdef CONFIG_ARCH_OMAP2PLUS
> > > if (cpu_is_omap44xx())
> > > reg += OMAP4_GPIO_DEBOUNCENABLE;
> > > else
> > > reg += OMAP24XX_GPIO_DEBOUNCE_EN;
> > >+#endif
> >
> > you should try to remove ifdefs not add more.
>
> As mentioned in the beginning of this patch, these are
> only temporary and all possible #ifdefs are removed at
> the end of this patch series when plat-omap/gpio.c handles
> only common APIs.

You need to first implement just initializing things using the
platform data. Only then start messing with the functions.

Tony