1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com>
4  * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com>
5  */
6 
7 #ifndef __PINCTRL_BCM63XX_H__
8 #define __PINCTRL_BCM63XX_H__
9 
10 #include <linux/pinctrl/pinctrl.h>
11 
12 #define BCM63XX_BANK_GPIOS 32
13 
14 struct bcm63xx_pinctrl_soc {
15 	const struct pinctrl_ops *pctl_ops;
16 	const struct pinmux_ops *pmx_ops;
17 
18 	const struct pinctrl_pin_desc *pins;
19 	unsigned npins;
20 
21 	unsigned int ngpios;
22 };
23 
24 struct bcm63xx_pinctrl {
25 	struct device *dev;
26 	struct regmap *regs;
27 
28 	struct pinctrl_desc pctl_desc;
29 	struct pinctrl_dev *pctl_dev;
30 
31 	void *driver_data;
32 };
33 
bcm63xx_bank_pin(unsigned int pin)34 static inline unsigned int bcm63xx_bank_pin(unsigned int pin)
35 {
36 	return pin % BCM63XX_BANK_GPIOS;
37 }
38 
39 int bcm63xx_pinctrl_probe(struct platform_device *pdev,
40 			  const struct bcm63xx_pinctrl_soc *soc,
41 			  void *driver_data);
42 
43 #endif /* __PINCTRL_BCM63XX_H__ */
44