16 #include <linux/errno.h>
17 #include <linux/module.h>
23 #include <linux/slab.h>
26 #define XGPIO_DATA_OFFSET (0x0)
27 #define XGPIO_TRI_OFFSET (0x4)
44 static int xgpio_get(
struct gpio_chip *
gc,
unsigned int gpio)
46 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
60 static void xgpio_set(
struct gpio_chip *
gc,
unsigned int gpio,
int val)
63 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
76 spin_unlock_irqrestore(&chip->
gpio_lock, flags);
88 static int xgpio_dir_in(
struct gpio_chip *gc,
unsigned int gpio)
91 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
101 spin_unlock_irqrestore(&chip->
gpio_lock, flags);
116 static int xgpio_dir_out(
struct gpio_chip *gc,
unsigned int gpio,
int val)
119 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
136 spin_unlock_irqrestore(&chip->
gpio_lock, flags);
145 static void xgpio_save_regs(
struct of_mm_gpio_chip *mm_gc)
166 const u32 *tree_info;
184 chip->
mmchip.gc.ngpio = 32;
188 "xlnx,gpio-width",
NULL);
194 chip->
mmchip.gc.direction_input = xgpio_dir_in;
195 chip->
mmchip.gc.direction_output = xgpio_dir_out;
196 chip->
mmchip.gc.get = xgpio_get;
197 chip->
mmchip.gc.set = xgpio_set;
199 chip->
mmchip.save_regs = xgpio_save_regs;
205 pr_err(
"%s: error in probe function with status %d\n",
213 { .compatible =
"xlnx,xps-gpio-1.00.a", },
217 static int __init xgpio_init(
void)
221 for_each_matching_node(np, xgpio_of_match)