21 #include <linux/kernel.h>
22 #include <linux/slab.h>
26 #include <linux/module.h>
57 static int mpc52xx_wkup_gpio_get(
struct gpio_chip *
gc,
unsigned int gpio)
59 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
65 pr_debug(
"%s: gpio: %d ret: %d\n", __func__, gpio, ret);
71 __mpc52xx_wkup_gpio_set(
struct gpio_chip *
gc,
unsigned int gpio,
int val)
73 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
87 mpc52xx_wkup_gpio_set(
struct gpio_chip *gc,
unsigned int gpio,
int val)
93 __mpc52xx_wkup_gpio_set(gc, gpio, val);
95 spin_unlock_irqrestore(&gpio_lock, flags);
97 pr_debug(
"%s: gpio: %d val: %d\n", __func__, gpio, val);
100 static int mpc52xx_wkup_gpio_dir_in(
struct gpio_chip *gc,
unsigned int gpio)
102 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
118 spin_unlock_irqrestore(&gpio_lock, flags);
124 mpc52xx_wkup_gpio_dir_out(
struct gpio_chip *gc,
unsigned int gpio,
int val)
126 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
134 __mpc52xx_wkup_gpio_set(gc, gpio, val);
144 spin_unlock_irqrestore(&gpio_lock, flags);
146 pr_debug(
"%s: gpio: %d val: %d\n", __func__, gpio, val);
155 struct gpio_chip *gc;
165 gc->direction_input = mpc52xx_wkup_gpio_dir_in;
166 gc->direction_output = mpc52xx_wkup_gpio_dir_out;
167 gc->get = mpc52xx_wkup_gpio_get;
168 gc->set = mpc52xx_wkup_gpio_set;
187 static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
188 { .compatible =
"fsl,mpc5200-gpio-wkup", },
194 .name =
"mpc5200-gpio-wkup",
196 .of_match_table = mpc52xx_wkup_gpiochip_match,
198 .probe = mpc52xx_wkup_gpiochip_probe,
199 .remove = mpc52xx_gpiochip_remove,
219 static int mpc52xx_simple_gpio_get(
struct gpio_chip *gc,
unsigned int gpio)
221 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
231 __mpc52xx_simple_gpio_set(
struct gpio_chip *gc,
unsigned int gpio,
int val)
233 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
246 mpc52xx_simple_gpio_set(
struct gpio_chip *gc,
unsigned int gpio,
int val)
252 __mpc52xx_simple_gpio_set(gc, gpio, val);
254 spin_unlock_irqrestore(&gpio_lock, flags);
256 pr_debug(
"%s: gpio: %d val: %d\n", __func__, gpio, val);
259 static int mpc52xx_simple_gpio_dir_in(
struct gpio_chip *gc,
unsigned int gpio)
261 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
277 spin_unlock_irqrestore(&gpio_lock, flags);
283 mpc52xx_simple_gpio_dir_out(
struct gpio_chip *gc,
unsigned int gpio,
int val)
285 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
294 __mpc52xx_simple_gpio_set(gc, gpio, val);
304 spin_unlock_irqrestore(&gpio_lock, flags);
306 pr_debug(
"%s: gpio: %d val: %d\n", __func__, gpio, val);
314 struct gpio_chip *gc;
325 gc->direction_input = mpc52xx_simple_gpio_dir_in;
326 gc->direction_output = mpc52xx_simple_gpio_dir_out;
327 gc->get = mpc52xx_simple_gpio_get;
328 gc->set = mpc52xx_simple_gpio_set;
342 static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
343 { .compatible =
"fsl,mpc5200-gpio", },
349 .name =
"mpc5200-gpio",
351 .of_match_table = mpc52xx_simple_gpiochip_match,
353 .probe = mpc52xx_simple_gpiochip_probe,
354 .remove = mpc52xx_gpiochip_remove,
357 static int __init mpc52xx_gpio_init(
void)