i2c-mux-gpio.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. GPIO-based I2C Bus Mux
  2. This binding describes an I2C bus multiplexer that uses GPIOs to
  3. route the I2C signals.
  4. +-----+ +-----+
  5. | dev | | dev |
  6. +------------+ +-----+ +-----+
  7. | SoC | | |
  8. | | /--------+--------+
  9. | +------+ | +------+ child bus A, on GPIO value set to 0
  10. | | I2C |-|--| Mux |
  11. | +------+ | +--+---+ child bus B, on GPIO value set to 1
  12. | | | \----------+--------+--------+
  13. | +------+ | | | | |
  14. | | GPIO |-|-----+ +-----+ +-----+ +-----+
  15. | +------+ | | dev | | dev | | dev |
  16. +------------+ +-----+ +-----+ +-----+
  17. Required properties:
  18. - compatible: i2c-mux-gpio
  19. - i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
  20. port is connected to.
  21. - mux-gpios: list of gpios used to control the muxer
  22. * Standard I2C mux properties. See mux.txt in this directory.
  23. * I2C child bus nodes. See mux.txt in this directory.
  24. Optional properties:
  25. - idle-state: value to set the muxer to when idle. When no value is
  26. given, it defaults to the last value used.
  27. For each i2c child node, an I2C child bus will be created. They will
  28. be numbered based on their order in the device tree.
  29. Whenever an access is made to a device on a child bus, the value set
  30. in the revelant node's reg property will be output using the list of
  31. GPIOs, the first in the list holding the least-significant value.
  32. If an idle state is defined, using the idle-state (optional) property,
  33. whenever an access is not being made to a device on a child bus, the
  34. GPIOs will be set according to the idle value.
  35. If an idle state is not defined, the most recently used value will be
  36. left programmed into hardware whenever no access is being made to a
  37. device on a child bus.
  38. Example:
  39. i2cmux {
  40. compatible = "i2c-mux-gpio";
  41. #address-cells = <1>;
  42. #size-cells = <0>;
  43. mux-gpios = <&gpio1 22 0 &gpio1 23 0>;
  44. i2c-parent = <&i2c1>;
  45. i2c@1 {
  46. reg = <1>;
  47. #address-cells = <1>;
  48. #size-cells = <0>;
  49. ssd1307: oled@3c {
  50. compatible = "solomon,ssd1307fb-i2c";
  51. reg = <0x3c>;
  52. pwms = <&pwm 4 3000>;
  53. reset-gpios = <&gpio2 7 1>;
  54. reset-active-low;
  55. };
  56. };
  57. i2c@3 {
  58. reg = <3>;
  59. #address-cells = <1>;
  60. #size-cells = <0>;
  61. pca9555: pca9555@20 {
  62. compatible = "nxp,pca9555";
  63. gpio-controller;
  64. #gpio-cells = <2>;
  65. reg = <0x20>;
  66. };
  67. };
  68. };