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