[RFC PATCH 00/18] OMAP: GPIO: cleanup GPIO driver

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 22 10:02:39 EDT 2011


Hi,

On Fri, Apr 22, 2011 at 04:38:14PM +0530, Charulatha V wrote:
> Modifies the OMAP GPIO driver to avoid usage of cpu_is* checks
> for different OMAP architectures. This is done by moving some
> architecture specific code to mach-omap* and call them from
> plat-omap* using function pointers. Also remove the register offset
> macros from OMAP GPIO driver and handle the same in mach-omap*.
> 
> Avoid usage of gpio_bank_count and gpio_bank pointer array by
> means of maintaining a list. Removes the bank->method flag from
> the GPIO driver.
> 
> All OMAP1 SoCs has one MPUIO type GPIO bank. OMAP2+ does not have
> any MPUIO type GPIO bank. Since MPUIO type GPIO bank is the same for
> all OMAP1 CPUs, they are handled in plat-omap/ itself as
> there is no common gpio.c file for all cpu types in mach-omap1.
> They are identified by using bank->stride flag as it is '0'
> for other than MPUIO type banks.

The omap gpio code clearly deserves a cleanup, but I think this series
does not go far enough. There are only a handful of possible ways to
implement a gpio hardware, most of them can be abstracted in a similar
way Thomas did for the irq handlers and then we can handle most SoC
specific gpio code in generic code.

Something like the following comes to my mind:

struct gpio_chip_mmio_regs {
	unsigned long output_set_reg;
	unsigned long output_clean_reg;
	unsigned long direction_reg;
	unsigned long status_reg;
};

struct gpio_chip_mmio {
	struct gpio_chip_mmio_regs *regs;
	void __iomem *base;
	void (*direction_output)(struct gpio_chip_mmio *, int);
	void (*direction_input)(struct gpio_chip_mmio *, int);
	struct gpio_chip chip;
};

int gpio_chip_mmio_add(struct gpio_chip_mmio *);

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-arm-kernel mailing list