berlin.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Marvell Berlin SoC pinctrl driver.
  3. *
  4. * Copyright (C) 2014 Marvell Technology Group Ltd.
  5. *
  6. * Antoine Ténart <antoine.tenart@free-electrons.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #ifndef __PINCTRL_BERLIN_H
  13. #define __PINCTRL_BERLIN_H
  14. struct berlin_desc_function {
  15. const char *name;
  16. u8 muxval;
  17. };
  18. struct berlin_desc_group {
  19. const char *name;
  20. u8 offset;
  21. u8 bit_width;
  22. u8 lsb;
  23. struct berlin_desc_function *functions;
  24. };
  25. struct berlin_pinctrl_desc {
  26. const struct berlin_desc_group *groups;
  27. unsigned ngroups;
  28. };
  29. struct berlin_pinctrl_function {
  30. const char *name;
  31. const char **groups;
  32. unsigned ngroups;
  33. };
  34. #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...) \
  35. { \
  36. .name = _name, \
  37. .offset = _offset, \
  38. .bit_width = _width, \
  39. .lsb = _lsb, \
  40. .functions = (struct berlin_desc_function[]){ \
  41. __VA_ARGS__, { } }, \
  42. }
  43. #define BERLIN_PINCTRL_FUNCTION(_muxval, _name) \
  44. { \
  45. .name = _name, \
  46. .muxval = _muxval, \
  47. }
  48. #define BERLIN_PINCTRL_FUNCTION_UNKNOWN {}
  49. int berlin_pinctrl_probe(struct platform_device *pdev,
  50. const struct berlin_pinctrl_desc *desc);
  51. int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
  52. const struct berlin_pinctrl_desc *desc,
  53. struct regmap *regmap);
  54. #endif /* __PINCTRL_BERLIN_H */