Commit b1dd62f7 authored by Martyn Welch's avatar Martyn Welch Committed by Kumar Gala

powerpc/86xx: Extend GE Fanuc GPIO driver for the SBC310

This patch adds basic support for the 6 GPIO lines found on GE Fanucs SBC310 to the GE Fanuc GPIO driver.
Signed-off-by: default avatarMartyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent d2a82b12
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# Linux kernel version: 2.6.29-rc3 # Linux kernel version: 2.6.29-rc3
# Wed Jan 28 23:04:04 2009 # Wed Jan 28 23:05:34 2009
# #
# CONFIG_PPC64 is not set # CONFIG_PPC64 is not set
...@@ -905,7 +905,7 @@ CONFIG_DS1682=y ...@@ -905,7 +905,7 @@ CONFIG_DS1682=y
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_REQUIRE_GPIOLIB=y
CONFIG_GPIOLIB=y CONFIG_GPIOLIB=y
# CONFIG_GPIO_SYSFS is not set CONFIG_GPIO_SYSFS=y
# #
# Memory mapped GPIO expanders: # Memory mapped GPIO expanders:
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
#define GEF_GPIO_OVERRUN 0x1C #define GEF_GPIO_OVERRUN 0x1C
#define GEF_GPIO_MODE 0x20 #define GEF_GPIO_MODE 0x20
#define NUM_GPIO 19
static void _gef_gpio_set(void __iomem *reg, unsigned int offset, int value) static void _gef_gpio_set(void __iomem *reg, unsigned int offset, int value)
{ {
unsigned int data; unsigned int data;
...@@ -103,10 +101,10 @@ static void gef_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ...@@ -103,10 +101,10 @@ static void gef_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int __init gef_gpio_init(void) static int __init gef_gpio_init(void)
{ {
struct device_node *np; struct device_node *np;
int retval;
struct of_mm_gpio_chip *gef_gpio_chip;
for_each_compatible_node(np, NULL, "gef,sbc610-gpio") { for_each_compatible_node(np, NULL, "gef,sbc610-gpio") {
int retval;
struct of_mm_gpio_chip *gef_gpio_chip;
pr_debug("%s: Initialising GEF GPIO\n", np->full_name); pr_debug("%s: Initialising GEF GPIO\n", np->full_name);
...@@ -120,7 +118,35 @@ static int __init gef_gpio_init(void) ...@@ -120,7 +118,35 @@ static int __init gef_gpio_init(void)
/* Setup pointers to chip functions */ /* Setup pointers to chip functions */
gef_gpio_chip->of_gc.gpio_cells = 2; gef_gpio_chip->of_gc.gpio_cells = 2;
gef_gpio_chip->of_gc.gc.ngpio = NUM_GPIO; gef_gpio_chip->of_gc.gc.ngpio = 19;
gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in;
gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out;
gef_gpio_chip->of_gc.gc.get = gef_gpio_get;
gef_gpio_chip->of_gc.gc.set = gef_gpio_set;
/* This function adds a memory mapped GPIO chip */
retval = of_mm_gpiochip_add(np, gef_gpio_chip);
if (retval) {
kfree(gef_gpio_chip);
pr_err("%s: Unable to add GPIO\n", np->full_name);
}
}
for_each_compatible_node(np, NULL, "gef,sbc310-gpio") {
pr_debug("%s: Initialising GEF GPIO\n", np->full_name);
/* Allocate chip structure */
gef_gpio_chip = kzalloc(sizeof(*gef_gpio_chip), GFP_KERNEL);
if (!gef_gpio_chip) {
pr_err("%s: Unable to allocate structure\n",
np->full_name);
continue;
}
/* Setup pointers to chip functions */
gef_gpio_chip->of_gc.gpio_cells = 2;
gef_gpio_chip->of_gc.gc.ngpio = 6;
gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in; gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in;
gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out; gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out;
gef_gpio_chip->of_gc.gc.get = gef_gpio_get; gef_gpio_chip->of_gc.gc.get = gef_gpio_get;
......
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