pinctrl-exynos.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Exynos specific definitions for Samsung pinctrl and gpiolib driver.
  3. *
  4. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com
  6. * Copyright (c) 2012 Linaro Ltd
  7. * http://www.linaro.org
  8. *
  9. * This file contains the Exynos specific definitions for the Samsung
  10. * pinctrl/gpiolib interface drivers.
  11. *
  12. * Author: Thomas Abraham <thomas.ab@samsung.com>
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. */
  19. /* External GPIO and wakeup interrupt related definitions */
  20. #define EXYNOS_GPIO_ECON_OFFSET 0x700
  21. #define EXYNOS_GPIO_EMASK_OFFSET 0x900
  22. #define EXYNOS_GPIO_EPEND_OFFSET 0xA00
  23. #define EXYNOS_WKUP_ECON_OFFSET 0xE00
  24. #define EXYNOS_WKUP_EMASK_OFFSET 0xF00
  25. #define EXYNOS_WKUP_EPEND_OFFSET 0xF40
  26. #define EXYNOS_SVC_OFFSET 0xB08
  27. #define EXYNOS_EINT_FUNC 0xF
  28. /* helpers to access interrupt service register */
  29. #define EXYNOS_SVC_GROUP_SHIFT 3
  30. #define EXYNOS_SVC_GROUP_MASK 0x1f
  31. #define EXYNOS_SVC_NUM_MASK 7
  32. #define EXYNOS_SVC_GROUP(x) ((x >> EXYNOS_SVC_GROUP_SHIFT) & \
  33. EXYNOS_SVC_GROUP_MASK)
  34. /* Exynos specific external interrupt trigger types */
  35. #define EXYNOS_EINT_LEVEL_LOW 0
  36. #define EXYNOS_EINT_LEVEL_HIGH 1
  37. #define EXYNOS_EINT_EDGE_FALLING 2
  38. #define EXYNOS_EINT_EDGE_RISING 3
  39. #define EXYNOS_EINT_EDGE_BOTH 4
  40. #define EXYNOS_EINT_CON_MASK 0xF
  41. #define EXYNOS_EINT_CON_LEN 4
  42. #define EXYNOS_EINT_MAX_PER_BANK 8
  43. #define EXYNOS_EINT_NR_WKUP_EINT
  44. #define EXYNOS_PIN_BANK_EINTN(pins, reg, id) \
  45. { \
  46. .type = &bank_type_off, \
  47. .pctl_offset = reg, \
  48. .nr_pins = pins, \
  49. .eint_type = EINT_TYPE_NONE, \
  50. .name = id \
  51. }
  52. #define EXYNOS_PIN_BANK_EINTG(pins, reg, id, offs) \
  53. { \
  54. .type = &bank_type_off, \
  55. .pctl_offset = reg, \
  56. .nr_pins = pins, \
  57. .eint_type = EINT_TYPE_GPIO, \
  58. .eint_offset = offs, \
  59. .name = id \
  60. }
  61. #define EXYNOS_PIN_BANK_EINTW(pins, reg, id, offs) \
  62. { \
  63. .type = &bank_type_alive, \
  64. .pctl_offset = reg, \
  65. .nr_pins = pins, \
  66. .eint_type = EINT_TYPE_WKUP, \
  67. .eint_offset = offs, \
  68. .name = id \
  69. }
  70. /**
  71. * struct exynos_weint_data: irq specific data for all the wakeup interrupts
  72. * generated by the external wakeup interrupt controller.
  73. * @irq: interrupt number within the domain.
  74. * @bank: bank responsible for this interrupt
  75. */
  76. struct exynos_weint_data {
  77. unsigned int irq;
  78. struct samsung_pin_bank *bank;
  79. };
  80. /**
  81. * struct exynos_muxed_weint_data: irq specific data for muxed wakeup interrupts
  82. * generated by the external wakeup interrupt controller.
  83. * @nr_banks: count of banks being part of the mux
  84. * @banks: array of banks being part of the mux
  85. */
  86. struct exynos_muxed_weint_data {
  87. unsigned int nr_banks;
  88. struct samsung_pin_bank *banks[];
  89. };