i2c-demux-pinctrl.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. Pinctrl-based I2C Bus DeMux
  2. This binding describes an I2C bus demultiplexer that uses pin multiplexing to
  3. route the I2C signals, and represents the pin multiplexing configuration using
  4. the pinctrl device tree bindings. This may be used to select one I2C IP core at
  5. runtime which may have a better feature set for a given task than another I2C
  6. IP core on the SoC. The most simple example is to fall back to GPIO bitbanging
  7. if your current runtime configuration hits an errata of the internal IP core.
  8. +-------------------------------+
  9. | SoC |
  10. | | +-----+ +-----+
  11. | +------------+ | | dev | | dev |
  12. | |I2C IP Core1|--\ | +-----+ +-----+
  13. | +------------+ \-------+ | | |
  14. | |Pinctrl|--|------+--------+
  15. | +------------+ +-------+ |
  16. | |I2C IP Core2|--/ |
  17. | +------------+ |
  18. | |
  19. +-------------------------------+
  20. Required properties:
  21. - compatible: "i2c-demux-pinctrl"
  22. - i2c-parent: List of phandles of I2C masters available for selection. The first
  23. one will be used as default.
  24. - i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C
  25. parents.
  26. Furthermore, I2C mux properties and child nodes. See i2c-mux.txt in this
  27. directory.
  28. Example:
  29. Here is a snipplet for a bus to be demuxed. It contains various i2c clients for
  30. HDMI, so the bus is named "i2c-hdmi":
  31. i2chdmi: i2c@8 {
  32. compatible = "i2c-demux-pinctrl";
  33. i2c-parent = <&gpioi2c>, <&iic2>, <&i2c2>;
  34. i2c-bus-name = "i2c-hdmi";
  35. #address-cells = <1>;
  36. #size-cells = <0>;
  37. ak4643: sound-codec@12 {
  38. compatible = "asahi-kasei,ak4643";
  39. #sound-dai-cells = <0>;
  40. reg = <0x12>;
  41. };
  42. composite-in@20 {
  43. compatible = "adi,adv7180";
  44. reg = <0x20>;
  45. remote = <&vin1>;
  46. port {
  47. adv7180: endpoint {
  48. bus-width = <8>;
  49. remote-endpoint = <&vin1ep0>;
  50. };
  51. };
  52. };
  53. hdmi@39 {
  54. compatible = "adi,adv7511w";
  55. reg = <0x39>;
  56. interrupt-parent = <&gpio1>;
  57. interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
  58. adi,input-depth = <8>;
  59. adi,input-colorspace = "rgb";
  60. adi,input-clock = "1x";
  61. adi,input-style = <1>;
  62. adi,input-justification = "evenly";
  63. ports {
  64. #address-cells = <1>;
  65. #size-cells = <0>;
  66. port@0 {
  67. reg = <0>;
  68. adv7511_in: endpoint {
  69. remote-endpoint = <&du_out_lvds0>;
  70. };
  71. };
  72. port@1 {
  73. reg = <1>;
  74. adv7511_out: endpoint {
  75. remote-endpoint = <&hdmi_con>;
  76. };
  77. };
  78. };
  79. };
  80. };
  81. And for clarification, here are the snipplets for the i2c-parents:
  82. gpioi2c: i2c@9 {
  83. #address-cells = <1>;
  84. #size-cells = <0>;
  85. compatible = "i2c-gpio";
  86. status = "disabled";
  87. gpios = <&gpio5 6 GPIO_ACTIVE_HIGH /* sda */
  88. &gpio5 5 GPIO_ACTIVE_HIGH /* scl */
  89. >;
  90. i2c-gpio,delay-us = <5>;
  91. };
  92. ...
  93. &i2c2 {
  94. pinctrl-0 = <&i2c2_pins>;
  95. pinctrl-names = "i2c-hdmi";
  96. clock-frequency = <100000>;
  97. };
  98. ...
  99. &iic2 {
  100. pinctrl-0 = <&iic2_pins>;
  101. pinctrl-names = "i2c-hdmi";
  102. clock-frequency = <100000>;
  103. };
  104. Please note:
  105. - pinctrl properties for the parent I2C controllers need a pinctrl state
  106. with the same name as i2c-bus-name, not "default"!
  107. - the i2c masters must have their status "disabled". This driver will
  108. enable them at runtime when needed.