gpio.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Specifying GPIO information for devices
  2. ============================================
  3. 1) gpios property
  4. -----------------
  5. Nodes that makes use of GPIOs should define them using `gpios' property,
  6. format of which is: <&gpio-controller1-phandle gpio1-specifier
  7. &gpio-controller2-phandle gpio2-specifier
  8. 0 /* holes are permitted, means no GPIO 3 */
  9. &gpio-controller4-phandle gpio4-specifier
  10. ...>;
  11. Note that gpio-specifier length is controller dependent.
  12. gpio-specifier may encode: bank, pin position inside the bank,
  13. whether pin is open-drain and whether pin is logically inverted.
  14. Example of the node using GPIOs:
  15. node {
  16. gpios = <&qe_pio_e 18 0>;
  17. };
  18. In this example gpio-specifier is "18 0" and encodes GPIO pin number,
  19. and empty GPIO flags as accepted by the "qe_pio_e" gpio-controller.
  20. 2) gpio-controller nodes
  21. ------------------------
  22. Every GPIO controller node must have #gpio-cells property defined,
  23. this information will be used to translate gpio-specifiers.
  24. Example of two SOC GPIO banks defined as gpio-controller nodes:
  25. qe_pio_a: gpio-controller@1400 {
  26. #gpio-cells = <2>;
  27. compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
  28. reg = <0x1400 0x18>;
  29. gpio-controller;
  30. };
  31. qe_pio_e: gpio-controller@1460 {
  32. #gpio-cells = <2>;
  33. compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
  34. reg = <0x1460 0x18>;
  35. gpio-controller;
  36. };