pinctrl-bcm63xx.h 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2021 Álvaro Fernández Rojas <[email protected]>
  4. * Copyright (C) 2016 Jonas Gorski <[email protected]>
  5. */
  6. #ifndef __PINCTRL_BCM63XX_H__
  7. #define __PINCTRL_BCM63XX_H__
  8. #include <linux/pinctrl/pinctrl.h>
  9. #define BCM63XX_BANK_GPIOS 32
  10. struct bcm63xx_pinctrl_soc {
  11. const struct pinctrl_ops *pctl_ops;
  12. const struct pinmux_ops *pmx_ops;
  13. const struct pinctrl_pin_desc *pins;
  14. unsigned npins;
  15. unsigned int ngpios;
  16. };
  17. #define BCM_PIN_GROUP(n) PINCTRL_PINGROUP(#n, n##_pins, ARRAY_SIZE(n##_pins))
  18. struct bcm63xx_pinctrl {
  19. struct device *dev;
  20. struct regmap *regs;
  21. struct pinctrl_desc pctl_desc;
  22. struct pinctrl_dev *pctl_dev;
  23. void *driver_data;
  24. };
  25. static inline unsigned int bcm63xx_bank_pin(unsigned int pin)
  26. {
  27. return pin % BCM63XX_BANK_GPIOS;
  28. }
  29. int bcm63xx_pinctrl_probe(struct platform_device *pdev,
  30. const struct bcm63xx_pinctrl_soc *soc,
  31. void *driver_data);
  32. #endif /* __PINCTRL_BCM63XX_H__ */