pinctrl-nexell.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0+
  2. *
  3. * Pinctrl driver for Nexell SoCs
  4. * (C) Copyright 2016 Nexell
  5. * Bongyu, KOO <freestyle@nexell.co.kr>
  6. *
  7. */
  8. #ifndef __PINCTRL_NEXELL_H_
  9. #define __PINCTRL_NEXELL_H_
  10. /**
  11. * struct nexell_pin_bank_data: represent a controller pin-bank data.
  12. * @offset: starting offset of the pin-bank registers.
  13. * @nr_pins: number of pins included in this bank.
  14. * @name: name to be prefixed for each pin in this pin bank.
  15. */
  16. struct nexell_pin_bank_data {
  17. u32 offset;
  18. u8 nr_pins;
  19. const char *name;
  20. u8 type;
  21. };
  22. #define NEXELL_PIN_BANK(pins, reg, id) \
  23. { \
  24. .offset = reg, \
  25. .nr_pins = pins, \
  26. .name = id \
  27. }
  28. /**
  29. * struct nexell_pin_ctrl: represent a pin controller.
  30. * @pin_banks: list of pin banks included in this controller.
  31. * @nr_banks: number of pin banks.
  32. */
  33. struct nexell_pin_ctrl {
  34. const struct nexell_pin_bank_data *pin_banks;
  35. u32 nr_banks;
  36. };
  37. /**
  38. * struct nexell_pinctrl_priv: nexell pin controller driver private data
  39. * @pin_ctrl: pin controller bank information.
  40. * @base: base address of the pin controller instance.
  41. */
  42. struct nexell_pinctrl_priv {
  43. const struct nexell_pin_ctrl *pin_ctrl;
  44. unsigned long base;
  45. };
  46. /**
  47. * struct nexell_pinctrl_config_data: configuration for a peripheral.
  48. * @offset: offset of the config registers in the controller.
  49. * @mask: value of the register to be masked with.
  50. * @value: new value to be programmed.
  51. */
  52. struct nexell_pinctrl_config_data {
  53. const unsigned int offset;
  54. const unsigned int mask;
  55. const unsigned int value;
  56. };
  57. unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name,
  58. u32 *pin);
  59. int nexell_pinctrl_probe(struct udevice *dev);
  60. #endif /* __PINCTRL_NEXELL_H_ */