pinctrl-meson8-pmx.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * First generation of pinmux driver for Amlogic Meson SoCs
  3. *
  4. * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
  5. * Copyright (C) 2017 Jerome Brunet <jbrunet@baylibre.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. struct meson8_pmx_data {
  15. bool is_gpio;
  16. unsigned int reg;
  17. unsigned int bit;
  18. };
  19. #define PMX_DATA(r, b, g) \
  20. { \
  21. .reg = r, \
  22. .bit = b, \
  23. .is_gpio = g, \
  24. }
  25. #define GROUP(grp, r, b) \
  26. { \
  27. .name = #grp, \
  28. .pins = grp ## _pins, \
  29. .num_pins = ARRAY_SIZE(grp ## _pins), \
  30. .data = (const struct meson8_pmx_data[]){ \
  31. PMX_DATA(r, b, false), \
  32. }, \
  33. }
  34. #define GPIO_GROUP(gpio) \
  35. { \
  36. .name = #gpio, \
  37. .pins = (const unsigned int[]){ gpio }, \
  38. .num_pins = 1, \
  39. .data = (const struct meson8_pmx_data[]){ \
  40. PMX_DATA(0, 0, true), \
  41. }, \
  42. }
  43. extern const struct pinmux_ops meson8_pmx_ops;