pinctrl-tangier.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Intel Tangier pinctrl functions
  4. *
  5. * Copyright (C) 2016, 2023 Intel Corporation
  6. *
  7. * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  8. * Raag Jadav <raag.jadav@intel.com>
  9. */
  10. #ifndef PINCTRL_TANGIER_H
  11. #define PINCTRL_TANGIER_H
  12. #include <linux/spinlock_types.h>
  13. #include <linux/types.h>
  14. #include <linux/pinctrl/pinctrl.h>
  15. #include "pinctrl-intel.h"
  16. struct device;
  17. struct platform_device;
  18. #define TNG_FAMILY_NR 64
  19. #define TNG_FAMILY_LEN 0x400
  20. /**
  21. * struct tng_family - Tangier pin family description
  22. * @barno: MMIO BAR number where registers for this family reside
  23. * @pin_base: Starting pin of pins in this family
  24. * @npins: Number of pins in this family
  25. * @protected: True if family is protected by access
  26. * @regs: Family specific common registers
  27. */
  28. struct tng_family {
  29. unsigned int barno;
  30. unsigned int pin_base;
  31. size_t npins;
  32. bool protected;
  33. void __iomem *regs;
  34. };
  35. #define TNG_FAMILY(b, s, e) \
  36. { \
  37. .barno = (b), \
  38. .pin_base = (s), \
  39. .npins = (e) - (s) + 1, \
  40. }
  41. #define TNG_FAMILY_PROTECTED(b, s, e) \
  42. { \
  43. .barno = (b), \
  44. .pin_base = (s), \
  45. .npins = (e) - (s) + 1, \
  46. .protected = true, \
  47. }
  48. /**
  49. * struct tng_pinctrl - Tangier pinctrl private structure
  50. * @dev: Pointer to the device structure
  51. * @lock: Lock to serialize register access
  52. * @pctldesc: Pin controller description
  53. * @pctldev: Pointer to the pin controller device
  54. * @families: Array of families this pinctrl handles
  55. * @nfamilies: Number of families in the array
  56. * @functions: Array of functions
  57. * @nfunctions: Number of functions in the array
  58. * @groups: Array of pin groups
  59. * @ngroups: Number of groups in the array
  60. * @pins: Array of pins this pinctrl controls
  61. * @npins: Number of pins in the array
  62. */
  63. struct tng_pinctrl {
  64. struct device *dev;
  65. raw_spinlock_t lock;
  66. struct pinctrl_desc pctldesc;
  67. struct pinctrl_dev *pctldev;
  68. /* Pin controller configuration */
  69. const struct tng_family *families;
  70. size_t nfamilies;
  71. const struct intel_function *functions;
  72. size_t nfunctions;
  73. const struct intel_pingroup *groups;
  74. size_t ngroups;
  75. const struct pinctrl_pin_desc *pins;
  76. size_t npins;
  77. };
  78. int devm_tng_pinctrl_probe(struct platform_device *pdev);
  79. #endif /* PINCTRL_TANGIER_H */