GNU Linux-libre 6.9.2-gnu
[releases.git] / include / linux / gpio / legacy-of-mm-gpiochip.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * OF helpers for the old of_mm_gpio_chip, used on ppc32 and nios2,
4  * do not use in new code.
5  *
6  * Copyright (c) 2007-2008  MontaVista Software, Inc.
7  *
8  * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
9  */
10
11 #ifndef __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H
12 #define __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H
13
14 #include <linux/gpio/driver.h>
15 #include <linux/of.h>
16
17 /*
18  * OF GPIO chip for memory mapped banks
19  */
20 struct of_mm_gpio_chip {
21         struct gpio_chip gc;
22         void (*save_regs)(struct of_mm_gpio_chip *mm_gc);
23         void __iomem *regs;
24 };
25
26 static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
27 {
28         return container_of(gc, struct of_mm_gpio_chip, gc);
29 }
30
31 extern int of_mm_gpiochip_add_data(struct device_node *np,
32                                    struct of_mm_gpio_chip *mm_gc,
33                                    void *data);
34 extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);
35
36 #endif /* __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H */