tegra186_gpio_priv.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2016, NVIDIA CORPORATION.
  4. */
  5. #ifndef _TEGRA186_GPIO_PRIV_H_
  6. #define _TEGRA186_GPIO_PRIV_H_
  7. /*
  8. * For each GPIO, there are a set of registers than affect it, all packed
  9. * back-to-back.
  10. */
  11. #define TEGRA186_GPIO_ENABLE_CONFIG 0x00
  12. #define TEGRA186_GPIO_ENABLE_CONFIG_ENABLE BIT(0)
  13. #define TEGRA186_GPIO_ENABLE_CONFIG_OUT BIT(1)
  14. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SHIFT 2
  15. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_MASK 3
  16. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_NONE 0
  17. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_LEVEL 1
  18. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE 2
  19. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_DOUBLE_EDGE 3
  20. #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL_HIGH_RISING BIT(4)
  21. #define TEGRA186_GPIO_ENABLE_CONFIG_DEBOUNCE_ENABLE BIT(5)
  22. #define TEGRA186_GPIO_ENABLE_CONFIG_INTERRUPT_ENABLE BIT(6)
  23. #define TEGRA186_GPIO_ENABLE_CONFIG_TIMESTAMPING_ENABLE BIT(7)
  24. #define TEGRA186_GPIO_DEBOUNCE_THRESHOLD 0x04
  25. #define TEGRA186_GPIO_INPUT 0x08
  26. #define TEGRA186_GPIO_OUTPUT_CONTROL 0x0c
  27. #define TEGRA186_GPIO_OUTPUT_CONTROL_FLOATED BIT(0)
  28. #define TEGRA186_GPIO_OUTPUT_VALUE 0x10
  29. #define TEGRA186_GPIO_OUTPUT_VALUE_HIGH 1
  30. #define TEGRA186_GPIO_INTERRUPT_CLEAR 0x14
  31. /*
  32. * 8 GPIOs are packed into a port. Their registers appear back-to-back in the
  33. * port's address space.
  34. */
  35. #define TEGRA186_GPIO_PER_GPIO_STRIDE 0x20
  36. #define TEGRA186_GPIO_PER_GPIO_COUNT 8
  37. /*
  38. * Per-port registers are packed immediately following all of a port's
  39. * per-GPIO registers.
  40. */
  41. #define TEGRA186_GPIO_INTERRUPT_STATUS_G 0x100
  42. #define TEGRA186_GPIO_INTERRUPT_STATUS_G_STRIDE 4
  43. #define TEGRA186_GPIO_INTERRUPT_STATUS_G_COUNT 8
  44. /*
  45. * The registers for multiple ports are packed together back-to-back to form
  46. * the overall controller.
  47. */
  48. #define TEGRA186_GPIO_PER_PORT_STRIDE 0x200
  49. #endif