Skip to contentSkip to conversation

xtensa: register gpio chip before use

PATCH New Johannes Weiner 1 participant 1 message Apr 7, 2009 Tensilica Xtensa port (xtensa)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xtensa: register gpio chip before use

Platform initialization sets up the LED heartbeat that is controlled via GPIO. Requesting the GPIO pins fails, however, as the chip is only initialized later by a device_initcall().

Fix this up by exporting the initialization function. Let the platform set up the chip before it starts using it.

---
 arch/xtensa/platforms/s6105/setup.c               |    3 +++
 arch/xtensa/variants/s6000/gpio.c                 |    3 +--
 arch/xtensa/variants/s6000/include/variant/gpio.h |    6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 arch/xtensa/variants/s6000/include/variant/gpio.h
arch/xtensa/platforms/s6105/setup.c +3 -0
index ae041d5..855ddea 100644
@@ -10,6 +10,8 @@
 #include <asm/bootparam.h>
 
 #include <variant/hardware.h>
+#include <variant/gpio.h>
+
 #include <platform/gpio.h>
 
 void platform_halt(void)
@@ -47,6 +49,7 @@ void __init platform_setup(char **cmdline)
 
 void __init platform_init(bp_tag_t *first)
 {
+	s6_gpio_init();
 	gpio_request(GPIO_LED1_NGREEN, "led1_green");
 	gpio_request(GPIO_LED1_RED, "led1_red");
 	gpio_direction_output(GPIO_LED1_NGREEN, 1);
arch/xtensa/variants/s6000/gpio.c +1 -2
index 33a8d95..79317fd 100644
@@ -64,8 +64,7 @@ static struct gpio_chip gpiochip = {
 	.exported = 0, /* no exporting to userspace */
 };
 
-static int gpio_init(void)
+int s6_gpio_init(void)
 {
 	return gpiochip_add(&gpiochip);
 }
-device_initcall(gpio_init);
arch/xtensa/variants/s6000/include/variant/gpio.h new file +6 -0
new file mode 100644
index 0000000..8327f62
@@ -0,0 +1,6 @@
+#ifndef _XTENSA_VARIANT_S6000_GPIO_H
+#define _XTENSA_VARIANT_S6000_GPIO_H
+
+extern int s6_gpio_init(void);
+
+#endif /* _XTENSA_VARIANT_S6000_GPIO_H */
Signature · 1 line
1.6.2.107.ge47ee