Commit 1fb137c1 authored by Johannes Weiner's avatar Johannes Weiner Committed by Chris Zankel

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.
Signed-off-by: default avatarJohannes Weiner <jw@emlix.com>
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent 586411dc
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <asm/bootparam.h> #include <asm/bootparam.h>
#include <variant/hardware.h> #include <variant/hardware.h>
#include <variant/gpio.h>
#include <platform/gpio.h> #include <platform/gpio.h>
void platform_halt(void) void platform_halt(void)
...@@ -47,6 +49,7 @@ void __init platform_setup(char **cmdline) ...@@ -47,6 +49,7 @@ void __init platform_setup(char **cmdline)
void __init platform_init(bp_tag_t *first) void __init platform_init(bp_tag_t *first)
{ {
s6_gpio_init();
gpio_request(GPIO_LED1_NGREEN, "led1_green"); gpio_request(GPIO_LED1_NGREEN, "led1_green");
gpio_request(GPIO_LED1_RED, "led1_red"); gpio_request(GPIO_LED1_RED, "led1_red");
gpio_direction_output(GPIO_LED1_NGREEN, 1); gpio_direction_output(GPIO_LED1_NGREEN, 1);
......
...@@ -64,8 +64,7 @@ static struct gpio_chip gpiochip = { ...@@ -64,8 +64,7 @@ static struct gpio_chip gpiochip = {
.exported = 0, /* no exporting to userspace */ .exported = 0, /* no exporting to userspace */
}; };
static int gpio_init(void) int s6_gpio_init(void)
{ {
return gpiochip_add(&gpiochip); return gpiochip_add(&gpiochip);
} }
device_initcall(gpio_init);
#ifndef _XTENSA_VARIANT_S6000_GPIO_H
#define _XTENSA_VARIANT_S6000_GPIO_H
extern int s6_gpio_init(void);
#endif /* _XTENSA_VARIANT_S6000_GPIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment