samsung-pinctrl.txt 9.8 KB

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