linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] GPIO LIB API support for OF and PowerPC
@ 2008-03-11 18:40 Anton Vorontsov
  2008-03-11 18:42 ` [PATCH 1/4] OF helpers for the GPIO API Anton Vorontsov
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Anton Vorontsov @ 2008-03-11 18:40 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: David Miller

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(-)

diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
index ed1c161..a6775ff 100644
--- a/drivers/of/gpio.c
+++ b/drivers/of/gpio.c
@@ -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;
-- 
1.5.2.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-03 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11 18:40 [PATCH 0/4] GPIO LIB API support for OF and PowerPC Anton Vorontsov
2008-03-11 18:42 ` [PATCH 1/4] OF helpers for the GPIO API Anton Vorontsov
2008-03-11 18:42 ` [PATCH 2/4] [POWERPC] Implement support for the GPIO LIB API Anton Vorontsov
2008-04-03 11:05   ` Laurent Pinchart
2008-04-03 12:18     ` Anton Vorontsov
2008-03-11 18:42 ` [PATCH 3/4] [POWERPC] QE: split par_io_config_pin() Anton Vorontsov
2008-03-11 18:42 ` [PATCH 4/4] [POWERPC] QE: implement support for the GPIO LIB API Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).