pinctrl-st.txt 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. *ST pin controller.
  2. Each multi-function pin is controlled, driven and routed through the
  3. PIO multiplexing block. Each pin supports GPIO functionality (ALT0)
  4. and multiple alternate functions(ALT1 - ALTx) that directly connect
  5. the pin to different hardware blocks.
  6. When a pin is in GPIO mode, Output Enable (OE), Open Drain(OD), and
  7. Pull Up (PU) are driven by the related PIO block.
  8. ST pinctrl driver controls PIO multiplexing block and also interacts with
  9. gpio driver to configure a pin.
  10. GPIO bank can have one of the two possible types of interrupt-wirings.
  11. First type is via irqmux, single interrupt is used by multiple gpio banks. This
  12. reduces number of overall interrupts numbers required. All these banks belong to
  13. a single pincontroller.
  14. _________
  15. | |----> [gpio-bank (n) ]
  16. | |----> [gpio-bank (n + 1)]
  17. [irqN]-- | irq-mux |----> [gpio-bank (n + 2)]
  18. | |----> [gpio-bank (... )]
  19. |_________|----> [gpio-bank (n + 7)]
  20. Second type has a dedicated interrupt per gpio bank.
  21. [irqN]----> [gpio-bank (n)]
  22. Pin controller node:
  23. Required properties:
  24. - compatible : should be "st,stih407-<pio-block>-pinctrl"
  25. - st,syscfg : Should be a phandle of the syscfg node.
  26. - st,retime-pin-mask : Should be mask to specify which pins can be retimed.
  27. If the property is not present, it is assumed that all the pins in the
  28. bank are capable of retiming. Retiming is mainly used to improve the
  29. IO timing margins of external synchronous interfaces.
  30. - ranges : defines mapping between pin controller node (parent) to gpio-bank
  31. node (children).
  32. Optional properties:
  33. - interrupts : Interrupt number of the irqmux. If the interrupt is shared
  34. with other gpio banks via irqmux.
  35. a irqline and gpio banks.
  36. - reg : irqmux memory resource. If irqmux is present.
  37. - reg-names : irqmux resource should be named as "irqmux".
  38. GPIO controller/bank node.
  39. Required properties:
  40. - gpio-controller : Indicates this device is a GPIO controller
  41. - #gpio-cells : Must be two.
  42. - First cell: specifies the pin number inside the controller
  43. - Second cell: specifies whether the pin is logically inverted.
  44. - 0 = active high
  45. - 1 = active low
  46. - st,bank-name : Should be a name string for this bank as specified in
  47. datasheet.
  48. Optional properties:
  49. - interrupts : Interrupt number for this gpio bank. If there is a dedicated
  50. interrupt wired up for this gpio bank.
  51. - interrupt-controller : Indicates this device is a interrupt controller. GPIO
  52. bank can be an interrupt controller iff one of the interrupt type either via
  53. irqmux or a dedicated interrupt per bank is specified.
  54. - #interrupt-cells: the value of this property should be 2.
  55. - First Cell: represents the external gpio interrupt number local to the
  56. gpio interrupt space of the controller.
  57. - Second Cell: flags to identify the type of the interrupt
  58. - 1 = rising edge triggered
  59. - 2 = falling edge triggered
  60. - 3 = rising and falling edge triggered
  61. - 4 = high level triggered
  62. - 8 = low level triggered
  63. for related macros look in:
  64. include/dt-bindings/interrupt-controller/irq.h
  65. Example:
  66. pin-controller-sbc {
  67. #address-cells = <1>;
  68. #size-cells = <1>;
  69. compatible = "st,stih407-sbc-pinctrl";
  70. st,syscfg = <&syscfg_sbc>;
  71. reg = <0x0961f080 0x4>;
  72. reg-names = "irqmux";
  73. interrupts = <GIC_SPI 188 IRQ_TYPE_NONE>;
  74. interrupt-names = "irqmux";
  75. ranges = <0 0x09610000 0x6000>;
  76. pio0: gpio@09610000 {
  77. gpio-controller;
  78. #gpio-cells = <2>;
  79. interrupt-controller;
  80. #interrupt-cells = <2>;
  81. reg = <0x0 0x100>;
  82. st,bank-name = "PIO0";
  83. };
  84. ...
  85. pin-functions nodes follow...
  86. };
  87. Contents of function subnode node:
  88. ----------------------
  89. Required properties for pin configuration node:
  90. - st,pins : Child node with list of pins with configuration.
  91. Below is the format of how each pin conf should look like.
  92. <bank offset mux mode rt_type rt_delay rt_clk>
  93. Every PIO is represented with 4-7 parameters depending on retime configuration.
  94. Each parameter is explained as below.
  95. -bank : Should be bank phandle to which this PIO belongs.
  96. -offset : Offset in the PIO bank.
  97. -mux : Should be alternate function number associated this pin.
  98. Use same numbers from datasheet.
  99. -mode :pin configuration is selected from one of the below values.
  100. IN
  101. IN_PU
  102. OUT
  103. BIDIR
  104. BIDIR_PU
  105. -rt_type Retiming Configuration for the pin.
  106. Possible retime configuration are:
  107. ------- -------------
  108. value args
  109. ------- -------------
  110. NICLK <delay> <clk>
  111. ICLK_IO <delay> <clk>
  112. BYPASS <delay>
  113. DE_IO <delay> <clk>
  114. SE_ICLK_IO <delay> <clk>
  115. SE_NICLK_IO <delay> <clk>
  116. - delay is retime delay in pico seconds as mentioned in data sheet.
  117. - rt_clk :clk to be use for retime.
  118. Possible values are:
  119. CLK_A
  120. CLK_B
  121. CLK_C
  122. CLK_D
  123. Example of mmcclk pin which is a bi-direction pull pu with retime config
  124. as non inverted clock retimed with CLK_B and delay of 0 pico seconds:
  125. pin-controller {
  126. ...
  127. mmc0 {
  128. pinctrl_mmc: mmc {
  129. st,pins {
  130. mmcclk = <&PIO13 4 ALT4 BIDIR_PU NICLK 0 CLK_B>;
  131. ...
  132. };
  133. };
  134. ...
  135. };
  136. };
  137. sdhci0:sdhci@fe810000{
  138. ...
  139. interrupt-parent = <&pio3>;
  140. #interrupt-cells = <2>;
  141. interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; /* Interrupt line via PIO3-3 */
  142. interrupt-names = "card-detect";
  143. pinctrl-names = "default";
  144. pinctrl-0 = <&pinctrl_mmc>;
  145. };