pinctrl-sky1.h 1.1 KB

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