i2c-mux-gpio.yaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/i2c/i2c-mux-gpio.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: GPIO-based I2C Bus Mux
  7. maintainers:
  8. - Wolfram Sang <wsa@kernel.org>
  9. description: |
  10. This binding describes an I2C bus multiplexer that uses GPIOs to route the I2C signals.
  11. +-----+ +-----+
  12. | dev | | dev |
  13. +------------+ +-----+ +-----+
  14. | SoC | | |
  15. | | /--------+--------+
  16. | +------+ | +------+ child bus A, on GPIO value set to 0
  17. | | I2C |-|--| Mux |
  18. | +------+ | +--+---+ child bus B, on GPIO value set to 1
  19. | | | \----------+--------+--------+
  20. | +------+ | | | | |
  21. | | GPIO |-|-----+ +-----+ +-----+ +-----+
  22. | +------+ | | dev | | dev | | dev |
  23. +------------+ +-----+ +-----+ +-----+
  24. For each I2C child node, an I2C child bus will be created. They will be numbered based on their
  25. order in the device tree.
  26. Whenever an access is made to a device on a child bus, the value set in the relevant node's reg
  27. property will be output using the list of GPIOs, the first in the list holding the least-
  28. significant value.
  29. If an idle state is defined, using the idle-state (optional) property, whenever an access is not
  30. being made to a device on a child bus, the GPIOs will be set according to the idle value.
  31. If an idle state is not defined, the most recently used value will be left programmed into
  32. hardware whenever no access is being made to a device on a child bus.
  33. properties:
  34. compatible:
  35. const: i2c-mux-gpio
  36. i2c-parent:
  37. description: phandle of the I2C bus that this multiplexer's master-side port is connected to
  38. $ref: /schemas/types.yaml#/definitions/phandle
  39. mux-gpios:
  40. description: list of GPIOs used to control the muxer
  41. minItems: 1
  42. maxItems: 4 # Should be enough
  43. idle-state:
  44. description: Value to set the muxer to when idle. When no value is given, it defaults to the
  45. last value used.
  46. $ref: /schemas/types.yaml#/definitions/uint32
  47. settle-time-us:
  48. description: Delay to wait before doing any transfer when a new bus gets selected.
  49. allOf:
  50. - $ref: i2c-mux.yaml
  51. unevaluatedProperties: false
  52. required:
  53. - compatible
  54. - i2c-parent
  55. - mux-gpios
  56. examples:
  57. - |
  58. i2cmux {
  59. compatible = "i2c-mux-gpio";
  60. #address-cells = <1>;
  61. #size-cells = <0>;
  62. mux-gpios = <&gpio1 22 0>, <&gpio1 23 0>;
  63. i2c-parent = <&i2c1>;
  64. i2c@1 {
  65. reg = <1>;
  66. #address-cells = <1>;
  67. #size-cells = <0>;
  68. ssd1307: oled@3c {
  69. compatible = "solomon,ssd1307fb-i2c";
  70. reg = <0x3c>;
  71. pwms = <&pwm 4 3000>;
  72. reset-gpios = <&gpio2 7 1>;
  73. };
  74. };
  75. i2c@3 {
  76. reg = <3>;
  77. #address-cells = <1>;
  78. #size-cells = <0>;
  79. pca9555: pca9555@20 {
  80. compatible = "nxp,pca9555";
  81. gpio-controller;
  82. #gpio-cells = <2>;
  83. reg = <0x20>;
  84. };
  85. };
  86. };