diff options
author | Martyn Welch <martyn.welch@gefanuc.com> | 2009-01-19 06:33:34 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-01-29 00:05:58 -0500 |
commit | b1dd62f7f108a593abfc4bf425a3dd0885994680 (patch) | |
tree | 851e3bcaf984f11c2712df020ce5c64ded6bbe22 /arch/powerpc/platforms/86xx | |
parent | d2a82b12989d0531ce93cff0553cdd1c93155d24 (diff) |
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: Martyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/86xx')
-rw-r--r-- | arch/powerpc/platforms/86xx/gef_gpio.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/86xx/gef_gpio.c b/arch/powerpc/platforms/86xx/gef_gpio.c index 85b2800f4cb7..b2ea8875adba 100644 --- a/arch/powerpc/platforms/86xx/gef_gpio.c +++ b/arch/powerpc/platforms/86xx/gef_gpio.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #define GEF_GPIO_OVERRUN 0x1C | 37 | #define GEF_GPIO_OVERRUN 0x1C |
38 | #define GEF_GPIO_MODE 0x20 | 38 | #define GEF_GPIO_MODE 0x20 |
39 | 39 | ||
40 | #define NUM_GPIO 19 | ||
41 | |||
42 | static void _gef_gpio_set(void __iomem *reg, unsigned int offset, int value) | 40 | static void _gef_gpio_set(void __iomem *reg, unsigned int offset, int value) |
43 | { | 41 | { |
44 | unsigned int data; | 42 | unsigned int data; |
@@ -103,10 +101,10 @@ static void gef_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
103 | static int __init gef_gpio_init(void) | 101 | static int __init gef_gpio_init(void) |
104 | { | 102 | { |
105 | struct device_node *np; | 103 | struct device_node *np; |
104 | int retval; | ||
105 | struct of_mm_gpio_chip *gef_gpio_chip; | ||
106 | 106 | ||
107 | for_each_compatible_node(np, NULL, "gef,sbc610-gpio") { | 107 | for_each_compatible_node(np, NULL, "gef,sbc610-gpio") { |
108 | int retval; | ||
109 | struct of_mm_gpio_chip *gef_gpio_chip; | ||
110 | 108 | ||
111 | pr_debug("%s: Initialising GEF GPIO\n", np->full_name); | 109 | pr_debug("%s: Initialising GEF GPIO\n", np->full_name); |
112 | 110 | ||
@@ -120,7 +118,35 @@ static int __init gef_gpio_init(void) | |||
120 | 118 | ||
121 | /* Setup pointers to chip functions */ | 119 | /* Setup pointers to chip functions */ |
122 | gef_gpio_chip->of_gc.gpio_cells = 2; | 120 | gef_gpio_chip->of_gc.gpio_cells = 2; |
123 | gef_gpio_chip->of_gc.gc.ngpio = NUM_GPIO; | 121 | gef_gpio_chip->of_gc.gc.ngpio = 19; |
122 | gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in; | ||
123 | gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out; | ||
124 | gef_gpio_chip->of_gc.gc.get = gef_gpio_get; | ||
125 | gef_gpio_chip->of_gc.gc.set = gef_gpio_set; | ||
126 | |||
127 | /* This function adds a memory mapped GPIO chip */ | ||
128 | retval = of_mm_gpiochip_add(np, gef_gpio_chip); | ||
129 | if (retval) { | ||
130 | kfree(gef_gpio_chip); | ||
131 | pr_err("%s: Unable to add GPIO\n", np->full_name); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | for_each_compatible_node(np, NULL, "gef,sbc310-gpio") { | ||
136 | |||
137 | pr_debug("%s: Initialising GEF GPIO\n", np->full_name); | ||
138 | |||
139 | /* Allocate chip structure */ | ||
140 | gef_gpio_chip = kzalloc(sizeof(*gef_gpio_chip), GFP_KERNEL); | ||
141 | if (!gef_gpio_chip) { | ||
142 | pr_err("%s: Unable to allocate structure\n", | ||
143 | np->full_name); | ||
144 | continue; | ||
145 | } | ||
146 | |||
147 | /* Setup pointers to chip functions */ | ||
148 | gef_gpio_chip->of_gc.gpio_cells = 2; | ||
149 | gef_gpio_chip->of_gc.gc.ngpio = 6; | ||
124 | gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in; | 150 | gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in; |
125 | gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out; | 151 | gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out; |
126 | gef_gpio_chip->of_gc.gc.get = gef_gpio_get; | 152 | gef_gpio_chip->of_gc.gc.get = gef_gpio_get; |