1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Author: Jerry Zhu <Jerry.Zhu@cixtech.com> 4 */ 5 6 #ifndef __DRIVERS_PINCTRL_SKY1_H 7 #define __DRIVERS_PINCTRL_SKY1_H 8 9 struct sky1_pinctrl_group { 10 const char *name; 11 unsigned long config; 12 unsigned int pin; 13 }; 14 15 struct sky1_pin_desc { 16 const struct pinctrl_pin_desc pin; 17 const char * const *func_group; 18 unsigned int nfunc; 19 }; 20 21 struct sky1_pinctrl_soc_info { 22 const struct sky1_pin_desc *pins; 23 unsigned int npins; 24 }; 25 26 #define SKY_PINFUNCTION(_pin, _func) \ 27 ((struct sky1_pin_desc) { \ 28 .pin = _pin, \ 29 .func_group = _func##_group, \ 30 .nfunc = ARRAY_SIZE(_func##_group), \ 31 }) 32 /** 33 * @dev: a pointer back to containing device 34 * @base: the offset to the controller in virtual memory 35 */ 36 struct sky1_pinctrl { 37 struct device *dev; 38 struct pinctrl_dev *pctl; 39 void __iomem *base; 40 const struct sky1_pinctrl_soc_info *info; 41 struct sky1_pinctrl_group *groups; 42 const char **grp_names; 43 }; 44 45 int sky1_base_pinctrl_probe(struct platform_device *pdev, 46 const struct sky1_pinctrl_soc_info *info); 47 48 #endif /* __DRIVERS_PINCTRL_SKY1_H */ 49