i2c-demux-pinctrl.yaml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/i2c/i2c-demux-pinctrl.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: Pinctrl-based I2C Bus Demultiplexer
  7. maintainers:
  8. - Wolfram Sang <wsa+renesas@sang-engineering.com>
  9. description: |
  10. This binding describes an I2C bus demultiplexer that uses pin multiplexing to
  11. route the I2C signals, and represents the pin multiplexing configuration
  12. using the pinctrl device tree bindings. This may be used to select one I2C
  13. IP core at runtime which may have a better feature set for a given task than
  14. another I2C IP core on the SoC. The most simple example is to fall back to
  15. GPIO bitbanging if your current runtime configuration hits an errata of the
  16. internal IP core.
  17. +-------------------------------+
  18. | SoC |
  19. | | +-----+ +-----+
  20. | +------------+ | | dev | | dev |
  21. | |I2C IP Core1|--\ | +-----+ +-----+
  22. | +------------+ \-------+ | | |
  23. | |Pinctrl|--|------+--------+
  24. | +------------+ +-------+ |
  25. | |I2C IP Core2|--/ |
  26. | +------------+ |
  27. | |
  28. +-------------------------------+
  29. allOf:
  30. - $ref: /schemas/i2c/i2c-controller.yaml#
  31. properties:
  32. compatible:
  33. const: i2c-demux-pinctrl
  34. i2c-parent:
  35. $ref: /schemas/types.yaml#/definitions/phandle-array
  36. items:
  37. maxItems: 1
  38. description:
  39. List of phandles of I2C masters available for selection. The first one
  40. will be used as default.
  41. i2c-bus-name:
  42. $ref: /schemas/types.yaml#/definitions/string
  43. description:
  44. The name of this bus. Also needed as pinctrl-name for the I2C parents.
  45. required:
  46. - compatible
  47. - i2c-parent
  48. - i2c-bus-name
  49. unevaluatedProperties: false
  50. examples:
  51. - |
  52. #include <dt-bindings/gpio/gpio.h>
  53. #include <dt-bindings/interrupt-controller/irq.h>
  54. gpioi2c2: i2c-9 {
  55. #address-cells = <1>;
  56. #size-cells = <0>;
  57. compatible = "i2c-gpio";
  58. scl-gpios = <&gpio5 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  59. sda-gpios = <&gpio5 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  60. i2c-gpio,delay-us = <5>;
  61. // The I2C controller must have its status "disabled". The I2C bus
  62. // demultiplexer will enable it at runtime when needed.
  63. status = "disabled";
  64. };
  65. iic2: i2c@e6520000 {
  66. reg = <0xe6520000 0x425>;
  67. pinctrl-0 = <&iic2_pins>;
  68. // The pinctrl property for the parent I2C controller needs a pinctrl
  69. // state with the same name as i2c-bus-name in the I2C bus demultiplexer
  70. // node, not "default"!
  71. pinctrl-names = "i2c-hdmi";
  72. clock-frequency = <100000>;
  73. // The I2C controller must have its status "disabled". The I2C bus
  74. // demultiplexer will enable it at runtime when needed.
  75. status = "disabled";
  76. };
  77. i2c2: i2c@e6530000 {
  78. reg = <0 0xe6530000 0 0x40>;
  79. pinctrl-0 = <&i2c2_pins>;
  80. // The pinctrl property for the parent I2C controller needs a pinctrl
  81. // state with the same name as i2c-bus-name in the I2C bus demultiplexer
  82. // node, not "default"!
  83. pinctrl-names = "i2c-hdmi";
  84. clock-frequency = <100000>;
  85. // The I2C controller must have its status "disabled". The I2C bus
  86. // demultiplexer will enable it at runtime when needed.
  87. status = "disabled";
  88. };
  89. // Example for a bus to be demuxed. It contains various I2C clients for
  90. // HDMI, so the bus is named "i2c-hdmi":
  91. i2chdmi: i2c-mux3 {
  92. compatible = "i2c-demux-pinctrl";
  93. i2c-parent = <&iic2>, <&i2c2>, <&gpioi2c2>;
  94. i2c-bus-name = "i2c-hdmi";
  95. #address-cells = <1>;
  96. #size-cells = <0>;
  97. ak4643: codec@12 {
  98. compatible = "asahi-kasei,ak4643";
  99. #sound-dai-cells = <0>;
  100. reg = <0x12>;
  101. };
  102. composite-in@20 {
  103. compatible = "adi,adv7180";
  104. reg = <0x20>;
  105. port {
  106. adv7180: endpoint {
  107. bus-width = <8>;
  108. remote-endpoint = <&vin1ep0>;
  109. };
  110. };
  111. };
  112. hdmi@39 {
  113. compatible = "adi,adv7511w";
  114. reg = <0x39>;
  115. interrupt-parent = <&gpio1>;
  116. interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
  117. clocks = <&cec_clock>;
  118. clock-names = "cec";
  119. avdd-supply = <&fixedregulator1v8>;
  120. dvdd-supply = <&fixedregulator1v8>;
  121. pvdd-supply = <&fixedregulator1v8>;
  122. dvdd-3v-supply = <&fixedregulator3v3>;
  123. bgvdd-supply = <&fixedregulator1v8>;
  124. adi,input-depth = <8>;
  125. adi,input-colorspace = "rgb";
  126. adi,input-clock = "1x";
  127. ports {
  128. #address-cells = <1>;
  129. #size-cells = <0>;
  130. port@0 {
  131. reg = <0>;
  132. adv7511_in: endpoint {
  133. remote-endpoint = <&lvds0_out>;
  134. };
  135. };
  136. port@1 {
  137. reg = <1>;
  138. adv7511_out: endpoint {
  139. remote-endpoint = <&hdmi_con_out>;
  140. };
  141. };
  142. };
  143. };
  144. };