Skip to content

GPIO LIB API support for OF and PowerPC

Anton Vorontsov linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4OF helpers for the GPIO APIdrivers/of/Kconfig drivers/of/Makefile drivers/of/gpio.c +1 more+305 -00 replies
2/4Implement support for the GPIO LIB APIDocumentation/powerpc/booting-without-of.txt arch/powerpc/Kconfig include/asm-powerpc/gpio.h+112 -02 replies
3/4QE: split par_io_config_pin()arch/powerpc/sysdev/qe_lib/qe_io.c+39 -210 replies
4/4QE: implement support for the GPIO LIB APIDocumentation/powerpc/booting-without-of.txt arch/powerpc/platforms/Kconfig arch/powerpc/sysdev/qe_lib/qe_io.c+158 -130 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/4] GPIO LIB API support for OF and PowerPC

Hi all,

Here are few patches needed to support GPIO LIB API on PowerPC. It would be great to see these applied for the 2.6.26...

For now we use static gpio base allocation, later we'll switch to the dynamic bases. The patch below shows the idea of what needs to be done when dynamic gpio base allocation patch[1] will hit the mainline.

[1] http://lkml.org/lkml/2008/3/11/261

- - - -
Subject: of/gpio: use dynamic base allocation

Signed-off-by not yet

---

depends on http://lkml.org/lkml/2008/3/11/261

 drivers/of/gpio.c |   38 +-------------------------------------
 1 files changed, 1 insertions(+), 37 deletions(-)
drivers/of/gpio.c +1 -37
index ed1c161..a6775ff 100644
@@ -118,38 +118,6 @@ static int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
 	return *gpio;
 }
 
-/* Should be sufficient for now, later we'll use dynamic bases. */
-#if defined(CONFIG_PPC32) || defined(CONFIG_SPARC32)
-#define GPIOS_PER_CHIP 32
-#else
-#define GPIOS_PER_CHIP 64
-#endif
-
-static int of_get_gpiochip_base(struct device_node *np)
-{
-	struct device_node *gc = NULL;
-	int gpiochip_base = 0;
-
-	while ((gc = of_find_all_nodes(gc))) {
-		if (!of_get_property(gc, "gpio-controller", NULL))
-			continue;
-
-		if (gc != np) {
-			gpiochip_base += GPIOS_PER_CHIP;
-			continue;
-		}
-
-		of_node_put(gc);
-
-		if (gpiochip_base >= ARCH_NR_GPIOS)
-			return -ENOSPC;
-
-		return gpiochip_base;
-	}
-
-	return -ENOENT;
-}
-
 int of_mm_gpiochip_add(struct device_node *np,
 		       struct of_mm_gpio_chip *mm_gc)
 {
@@ -165,11 +133,7 @@ int of_mm_gpiochip_add(struct device_node *np,
 	if (!mm_gc->regs)
 		goto err1;
 
-	gc->base = of_get_gpiochip_base(np);
-	if (gc->base < 0) {
-		ret = gc->base;
-		goto err1;
-	}
+	gc->base = -1;
 
 	if (!of_gc->xlate)
 		of_gc->xlate = of_gpio_simple_xlate;
Signature · 1 line
1.5.2.2