pinctrl-exynos.h 2.1 KB

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