Skip to content

RFC OMAP: GPIO: cleanup GPIO driver

Sascha Hauer linux-arm-kernel linux-omap 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest0 of 18 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 18 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

Hi,

Quoted 10 lines · Charulatha V

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.

Quoted 6 lines

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

Signature · 4 lines
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 |