samsung-pinctrl.txt 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. Samsung GPIO and Pin Mux/Config controller
  2. Samsung's ARM based SoC's integrates a GPIO and Pin mux/config hardware
  3. controller. It controls the input/output settings on the available pads/pins
  4. and also provides ability to multiplex and configure the output of various
  5. on-chip controllers onto these pads.
  6. Required Properties:
  7. - compatible: should be one of the following.
  8. - "samsung,pinctrl-exynos4210": for Exynos4210 compatible pin-controller.
  9. - "samsung,pinctrl-exynos4x12": for Exynos4x12 compatible pin-controller.
  10. - "samsung,pinctrl-exynos5250": for Exynos5250 compatible pin-controller.
  11. - reg: Base address of the pin controller hardware module and length of
  12. the address space it occupies.
  13. - Pin banks as child nodes: Pin banks of the controller are represented by child
  14. nodes of the controller node. Bank name is taken from name of the node. Each
  15. bank node must contain following properties:
  16. - gpio-controller: identifies the node as a gpio controller and pin bank.
  17. - #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
  18. binding is used, the amount of cells must be specified as 2. See generic
  19. GPIO binding documentation for description of particular cells.
  20. - Pin mux/config groups as child nodes: The pin mux (selecting pin function
  21. mode) and pin config (pull up/down, driver strength) settings are represented
  22. as child nodes of the pin-controller node. There should be atleast one
  23. child node and there is no limit on the count of these child nodes.
  24. The child node should contain a list of pin(s) on which a particular pin
  25. function selection or pin configuration (or both) have to applied. This
  26. list of pins is specified using the property name "samsung,pins". There
  27. should be atleast one pin specfied for this property and there is no upper
  28. limit on the count of pins that can be specified. The pins are specified
  29. using pin names which are derived from the hardware manual of the SoC. As
  30. an example, the pins in GPA0 bank of the pin controller can be represented
  31. as "gpa0-0", "gpa0-1", "gpa0-2" and so on. The names should be in lower case.
  32. The format of the pin names should be (as per the hardware manual)
  33. "[pin bank name]-[pin number within the bank]".
  34. The pin function selection that should be applied on the pins listed in the
  35. child node is specified using the "samsung,pin-function" property. The value
  36. of this property that should be applied to each of the pins listed in the
  37. "samsung,pins" property should be picked from the hardware manual of the SoC
  38. for the specified pin group. This property is optional in the child node if
  39. no specific function selection is desired for the pins listed in the child
  40. node. The value of this property is used as-is to program the pin-controller
  41. function selector register of the pin-bank.
  42. The child node can also optionally specify one or more of the pin
  43. configuration that should be applied on all the pins listed in the
  44. "samsung,pins" property of the child node. The following pin configuration
  45. properties are supported.
  46. - samsung,pin-pud: Pull up/down configuration.
  47. - samsung,pin-drv: Drive strength configuration.
  48. - samsung,pin-pud-pdn: Pull up/down configuration in power down mode.
  49. - samsung,pin-drv-pdn: Drive strength configuration in power down mode.
  50. The values specified by these config properties should be derived from the
  51. hardware manual and these values are programmed as-is into the pin
  52. pull up/down and driver strength register of the pin-controller.
  53. Note: A child should include atleast a pin function selection property or
  54. pin configuration property (one or more) or both.
  55. The client nodes that require a particular pin function selection and/or
  56. pin configuration should use the bindings listed in the "pinctrl-bindings.txt"
  57. file.
  58. External GPIO and Wakeup Interrupts:
  59. The controller supports two types of external interrupts over gpio. The first
  60. is the external gpio interrupt and second is the external wakeup interrupts.
  61. The difference between the two is that the external wakeup interrupts can be
  62. used as system wakeup events.
  63. A. External GPIO Interrupts: For supporting external gpio interrupts, the
  64. following properties should be specified in the pin-controller device node.
  65. - interrupt-parent: phandle of the interrupt parent to which the external
  66. GPIO interrupts are forwarded to.
  67. - interrupts: interrupt specifier for the controller. The format and value of
  68. the interrupt specifier depends on the interrupt parent for the controller.
  69. In addition, following properties must be present in node of every bank
  70. of pins supporting GPIO interrupts:
  71. - interrupt-controller: identifies the controller node as interrupt-parent.
  72. - #interrupt-cells: the value of this property should be 2.
  73. - First Cell: represents the external gpio interrupt number local to the
  74. external gpio interrupt space of the controller.
  75. - Second Cell: flags to identify the type of the interrupt
  76. - 1 = rising edge triggered
  77. - 2 = falling edge triggered
  78. - 3 = rising and falling edge triggered
  79. - 4 = high level triggered
  80. - 8 = low level triggered
  81. B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
  82. child node representing the external wakeup interrupt controller should be
  83. included in the pin-controller device node. This child node should include
  84. the following properties.
  85. - compatible: identifies the type of the external wakeup interrupt controller
  86. The possible values are:
  87. - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
  88. found on Samsung Exynos4210 SoC.
  89. - interrupt-parent: phandle of the interrupt parent to which the external
  90. wakeup interrupts are forwarded to.
  91. - interrupts: interrupt used by multiplexed wakeup interrupts.
  92. In addition, following properties must be present in node of every bank
  93. of pins supporting wake-up interrupts:
  94. - interrupt-controller: identifies the node as interrupt-parent.
  95. - #interrupt-cells: the value of this property should be 2
  96. - First Cell: represents the external wakeup interrupt number local to
  97. the external wakeup interrupt space of the controller.
  98. - Second Cell: flags to identify the type of the interrupt
  99. - 1 = rising edge triggered
  100. - 2 = falling edge triggered
  101. - 3 = rising and falling edge triggered
  102. - 4 = high level triggered
  103. - 8 = low level triggered
  104. Node of every bank of pins supporting direct wake-up interrupts (without
  105. multiplexing) must contain following properties:
  106. - interrupt-parent: phandle of the interrupt parent to which the external
  107. wakeup interrupts are forwarded to.
  108. - interrupts: interrupts of the interrupt parent which are used for external
  109. wakeup interrupts from pins of the bank, must contain interrupts for all
  110. pins of the bank.
  111. Aliases:
  112. All the pin controller nodes should be represented in the aliases node using
  113. the following format 'pinctrl{n}' where n is a unique number for the alias.
  114. Example: A pin-controller node with pin banks:
  115. pinctrl_0: pinctrl@11400000 {
  116. compatible = "samsung,pinctrl-exynos4210";
  117. reg = <0x11400000 0x1000>;
  118. interrupts = <0 47 0>;
  119. /* ... */
  120. /* Pin bank without external interrupts */
  121. gpy0: gpy0 {
  122. gpio-controller;
  123. #gpio-cells = <2>;
  124. };
  125. /* ... */
  126. /* Pin bank with external GPIO or muxed wake-up interrupts */
  127. gpj0: gpj0 {
  128. gpio-controller;
  129. #gpio-cells = <2>;
  130. interrupt-controller;
  131. #interrupt-cells = <2>;
  132. };
  133. /* ... */
  134. /* Pin bank with external direct wake-up interrupts */
  135. gpx0: gpx0 {
  136. gpio-controller;
  137. #gpio-cells = <2>;
  138. interrupt-controller;
  139. interrupt-parent = <&gic>;
  140. interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
  141. <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>;
  142. #interrupt-cells = <2>;
  143. };
  144. /* ... */
  145. };
  146. Example 1: A pin-controller node with pin groups.
  147. pinctrl_0: pinctrl@11400000 {
  148. compatible = "samsung,pinctrl-exynos4210";
  149. reg = <0x11400000 0x1000>;
  150. interrupts = <0 47 0>;
  151. /* ... */
  152. uart0_data: uart0-data {
  153. samsung,pins = "gpa0-0", "gpa0-1";
  154. samsung,pin-function = <2>;
  155. samsung,pin-pud = <0>;
  156. samsung,pin-drv = <0>;
  157. };
  158. uart0_fctl: uart0-fctl {
  159. samsung,pins = "gpa0-2", "gpa0-3";
  160. samsung,pin-function = <2>;
  161. samsung,pin-pud = <0>;
  162. samsung,pin-drv = <0>;
  163. };
  164. uart1_data: uart1-data {
  165. samsung,pins = "gpa0-4", "gpa0-5";
  166. samsung,pin-function = <2>;
  167. samsung,pin-pud = <0>;
  168. samsung,pin-drv = <0>;
  169. };
  170. uart1_fctl: uart1-fctl {
  171. samsung,pins = "gpa0-6", "gpa0-7";
  172. samsung,pin-function = <2>;
  173. samsung,pin-pud = <0>;
  174. samsung,pin-drv = <0>;
  175. };
  176. i2c2_bus: i2c2-bus {
  177. samsung,pins = "gpa0-6", "gpa0-7";
  178. samsung,pin-function = <3>;
  179. samsung,pin-pud = <3>;
  180. samsung,pin-drv = <0>;
  181. };
  182. };
  183. Example 2: A pin-controller node with external wakeup interrupt controller node.
  184. pinctrl_1: pinctrl@11000000 {
  185. compatible = "samsung,pinctrl-exynos4210";
  186. reg = <0x11000000 0x1000>;
  187. interrupts = <0 46 0>
  188. /* ... */
  189. wakeup-interrupt-controller {
  190. compatible = "samsung,exynos4210-wakeup-eint";
  191. interrupt-parent = <&gic>;
  192. interrupts = <0 32 0>;
  193. };
  194. };
  195. Example 3: A uart client node that supports 'default' and 'flow-control' states.
  196. uart@13800000 {
  197. compatible = "samsung,exynos4210-uart";
  198. reg = <0x13800000 0x100>;
  199. interrupts = <0 52 0>;
  200. pinctrl-names = "default", "flow-control;
  201. pinctrl-0 = <&uart0_data>;
  202. pinctrl-1 = <&uart0_data &uart0_fctl>;
  203. };
  204. Example 4: Set up the default pin state for uart controller.
  205. static int s3c24xx_serial_probe(struct platform_device *pdev) {
  206. struct pinctrl *pinctrl;
  207. /* ... */
  208. pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
  209. }