st,stm32-pinctrl.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. * STM32 GPIO and Pin Mux/Config controller
  2. STMicroelectronics's STM32 MCUs intregrate a GPIO and Pin mux/config hardware
  3. controller. It controls the input/output settings on the available pins and
  4. also provides ability to multiplex and configure the output of various on-chip
  5. controllers onto these pads.
  6. Pin controller node:
  7. Required properies:
  8. - compatible: value should be one of the following:
  9. (a) "st,stm32f429-pinctrl"
  10. (b) "st,stm32f746-pinctrl"
  11. - #address-cells: The value of this property must be 1
  12. - #size-cells : The value of this property must be 1
  13. - ranges : defines mapping between pin controller node (parent) to
  14. gpio-bank node (children).
  15. - pins-are-numbered: Specify the subnodes are using numbered pinmux to
  16. specify pins.
  17. GPIO controller/bank node:
  18. Required properties:
  19. - gpio-controller : Indicates this device is a GPIO controller
  20. - #gpio-cells : Should be two.
  21. The first cell is the pin number
  22. The second one is the polarity:
  23. - 0 for active high
  24. - 1 for active low
  25. - reg : The gpio address range, relative to the pinctrl range
  26. - clocks : clock that drives this bank
  27. - st,bank-name : Should be a name string for this bank as specified in
  28. the datasheet
  29. Optional properties:
  30. - reset: : Reference to the reset controller
  31. - interrupt-parent: phandle of the interrupt parent to which the external
  32. GPIO interrupts are forwarded to.
  33. - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node
  34. which includes IRQ mux selection register, and the offset of the IRQ mux
  35. selection register.
  36. Example:
  37. #include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
  38. ...
  39. pin-controller {
  40. #address-cells = <1>;
  41. #size-cells = <1>;
  42. compatible = "st,stm32f429-pinctrl";
  43. ranges = <0 0x40020000 0x3000>;
  44. pins-are-numbered;
  45. gpioa: gpio@40020000 {
  46. gpio-controller;
  47. #gpio-cells = <2>;
  48. reg = <0x0 0x400>;
  49. resets = <&reset_ahb1 0>;
  50. st,bank-name = "GPIOA";
  51. };
  52. ...
  53. pin-functions nodes follow...
  54. };
  55. Contents of function subnode node:
  56. ----------------------------------
  57. Subnode format
  58. A pinctrl node should contain at least one subnode representing the
  59. pinctrl group available on the machine. Each subnode will list the
  60. pins it needs, and how they should be configured, with regard to muxer
  61. configuration, pullups, drive, output high/low and output speed.
  62. node {
  63. pinmux = <PIN_NUMBER_PINMUX>;
  64. GENERIC_PINCONFIG;
  65. };
  66. Required properties:
  67. - pinmux: integer array, represents gpio pin number and mux setting.
  68. Supported pin number and mux varies for different SoCs, and are defined in
  69. dt-bindings/pinctrl/<soc>-pinfunc.h directly.
  70. These defines are calculated as:
  71. ((port * 16 + line) << 8) | function
  72. With:
  73. - port: The gpio port index (PA = 0, PB = 1, ..., PK = 11)
  74. - line: The line offset within the port (PA0 = 0, PA1 = 1, ..., PA15 = 15)
  75. - function: The function number, can be:
  76. * 0 : GPIO
  77. * 1 : Alternate Function 0
  78. * 2 : Alternate Function 1
  79. * 3 : Alternate Function 2
  80. * ...
  81. * 16 : Alternate Function 15
  82. * 17 : Analog
  83. Optional properties:
  84. - GENERIC_PINCONFIG: is the generic pinconfig options to use.
  85. Available options are:
  86. - bias-disable,
  87. - bias-pull-down,
  88. - bias-pull-up,
  89. - drive-push-pull,
  90. - drive-open-drain,
  91. - output-low
  92. - output-high
  93. - slew-rate = <x>, with x being:
  94. < 0 > : Low speed
  95. < 1 > : Medium speed
  96. < 2 > : Fast speed
  97. < 3 > : High speed
  98. Example:
  99. pin-controller {
  100. ...
  101. usart1_pins_a: usart1@0 {
  102. pins1 {
  103. pinmux = <STM32F429_PA9_FUNC_USART1_TX>;
  104. bias-disable;
  105. drive-push-pull;
  106. slew-rate = <0>;
  107. };
  108. pins2 {
  109. pinmux = <STM32F429_PA10_FUNC_USART1_RX>;
  110. bias-disable;
  111. };
  112. };
  113. };
  114. &usart1 {
  115. pinctrl-0 = <&usart1_pins_a>;
  116. pinctrl-names = "default";
  117. status = "okay";
  118. };