pinctrl-exynos.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Exynos pinctrl driver header.
  4. * Copyright (C) 2016 Samsung Electronics
  5. * Thomas Abraham <thomas.ab@samsung.com>
  6. */
  7. #ifndef __PINCTRL_EXYNOS_H_
  8. #define __PINCTRL_EXYNOS__H_
  9. #define PIN_CON 0x00 /* Offset of pin function register */
  10. #define PIN_DAT 0x04 /* Offset of pin data register */
  11. #define PIN_PUD 0x08 /* Offset of pin pull up/down config register */
  12. #define PIN_DRV 0x0C /* Offset of pin drive strength register */
  13. /**
  14. * struct samsung_pin_bank_data: represent a controller pin-bank data.
  15. * @offset: starting offset of the pin-bank registers.
  16. * @nr_pins: number of pins included in this bank.
  17. * @name: name to be prefixed for each pin in this pin bank.
  18. */
  19. struct samsung_pin_bank_data {
  20. u32 offset;
  21. u8 nr_pins;
  22. const char *name;
  23. };
  24. #define EXYNOS_PIN_BANK(pins, reg, id) \
  25. { \
  26. .offset = reg, \
  27. .nr_pins = pins, \
  28. .name = id \
  29. }
  30. /**
  31. * struct samsung_pin_ctrl: represent a pin controller.
  32. * @pin_banks: list of pin banks included in this controller.
  33. * @nr_banks: number of pin banks.
  34. */
  35. struct samsung_pin_ctrl {
  36. const struct samsung_pin_bank_data *pin_banks;
  37. u32 nr_banks;
  38. };
  39. /**
  40. * struct exynos_pinctrl_priv: exynos pin controller driver private data
  41. * @pin_ctrl: pin controller bank information.
  42. * @base: base address of the pin controller instance.
  43. * @num_banks: number of pin banks included in the pin controller.
  44. */
  45. struct exynos_pinctrl_priv {
  46. const struct samsung_pin_ctrl *pin_ctrl;
  47. unsigned long base;
  48. int num_banks;
  49. };
  50. /**
  51. * struct exynos_pinctrl_config_data: configuration for a peripheral.
  52. * @offset: offset of the config registers in the controller.
  53. * @mask: value of the register to be masked with.
  54. * @value: new value to be programmed.
  55. */
  56. struct exynos_pinctrl_config_data {
  57. const unsigned int offset;
  58. const unsigned int mask;
  59. const unsigned int value;
  60. };
  61. void exynos_pinctrl_setup_peri(struct exynos_pinctrl_config_data *conf,
  62. unsigned int num_conf, unsigned long base);
  63. int exynos_pinctrl_set_state(struct udevice *dev,
  64. struct udevice *config);
  65. int exynos_pinctrl_probe(struct udevice *dev);
  66. #endif /* __PINCTRL_EXYNOS_H_ */