Back to home page

OSCL-LXR

 
 

    


0001 Pinctrl-based I2C Bus DeMux
0002 
0003 This binding describes an I2C bus demultiplexer that uses pin multiplexing to
0004 route the I2C signals, and represents the pin multiplexing configuration using
0005 the pinctrl device tree bindings. This may be used to select one I2C IP core at
0006 runtime which may have a better feature set for a given task than another I2C
0007 IP core on the SoC. The most simple example is to fall back to GPIO bitbanging
0008 if your current runtime configuration hits an errata of the internal IP core.
0009 
0010     +-------------------------------+
0011     | SoC                           |
0012     |                               |   +-----+  +-----+
0013     |   +------------+              |   | dev |  | dev |
0014     |   |I2C IP Core1|--\           |   +-----+  +-----+
0015     |   +------------+   \-------+  |      |        |
0016     |                    |Pinctrl|--|------+--------+
0017     |   +------------+   +-------+  |
0018     |   |I2C IP Core2|--/           |
0019     |   +------------+              |
0020     |                               |
0021     +-------------------------------+
0022 
0023 Required properties:
0024 - compatible: "i2c-demux-pinctrl"
0025 - i2c-parent: List of phandles of I2C masters available for selection. The first
0026               one will be used as default.
0027 - i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C
0028                 parents.
0029 
0030 Furthermore, I2C mux properties and child nodes. See i2c-mux.yaml in this
0031 directory.
0032 
0033 Example:
0034 
0035 Here is a snipplet for a bus to be demuxed. It contains various i2c clients for
0036 HDMI, so the bus is named "i2c-hdmi":
0037 
0038         i2chdmi: i2c@8 {
0039 
0040                 compatible = "i2c-demux-pinctrl";
0041                 i2c-parent = <&gpioi2c>, <&iic2>, <&i2c2>;
0042                 i2c-bus-name = "i2c-hdmi";
0043                 #address-cells = <1>;
0044                 #size-cells = <0>;
0045 
0046                 ak4643: sound-codec@12 {
0047                         compatible = "asahi-kasei,ak4643";
0048 
0049                         #sound-dai-cells = <0>;
0050                         reg = <0x12>;
0051                 };
0052 
0053                 composite-in@20 {
0054                         compatible = "adi,adv7180";
0055                         reg = <0x20>;
0056                         remote = <&vin1>;
0057 
0058                         port {
0059                                 adv7180: endpoint {
0060                                         bus-width = <8>;
0061                                         remote-endpoint = <&vin1ep0>;
0062                                 };
0063                         };
0064                 };
0065 
0066                 hdmi@39 {
0067                         compatible = "adi,adv7511w";
0068                         reg = <0x39>;
0069                         interrupt-parent = <&gpio1>;
0070                         interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
0071 
0072                         adi,input-depth = <8>;
0073                         adi,input-colorspace = "rgb";
0074                         adi,input-clock = "1x";
0075                         adi,input-style = <1>;
0076                         adi,input-justification = "evenly";
0077 
0078                         ports {
0079                                 #address-cells = <1>;
0080                                 #size-cells = <0>;
0081 
0082                                 port@0 {
0083                                         reg = <0>;
0084                                         adv7511_in: endpoint {
0085                                                 remote-endpoint = <&du_out_lvds0>;
0086                                         };
0087                                 };
0088 
0089                                 port@1 {
0090                                         reg = <1>;
0091                                         adv7511_out: endpoint {
0092                                                 remote-endpoint = <&hdmi_con>;
0093                                         };
0094                                 };
0095                         };
0096                 };
0097         };
0098 
0099 And for clarification, here are the snipplets for the i2c-parents:
0100 
0101         gpioi2c: i2c@9 {
0102                 #address-cells = <1>;
0103                 #size-cells = <0>;
0104                 compatible = "i2c-gpio";
0105                 gpios = <&gpio5 6 GPIO_ACTIVE_HIGH /* sda */
0106                          &gpio5 5 GPIO_ACTIVE_HIGH /* scl */
0107                         >;
0108                 i2c-gpio,delay-us = <5>;
0109         };
0110 
0111 ...
0112 
0113 &i2c2   {
0114         pinctrl-0 = <&i2c2_pins>;
0115         pinctrl-names = "i2c-hdmi";
0116 
0117         clock-frequency = <100000>;
0118 };
0119 
0120 ...
0121 
0122 &iic2   {
0123         pinctrl-0 = <&iic2_pins>;
0124         pinctrl-names = "i2c-hdmi";
0125 
0126         clock-frequency = <100000>;
0127 };
0128 
0129 Please note:
0130 
0131 - pinctrl properties for the parent I2C controllers need a pinctrl state
0132   with the same name as i2c-bus-name, not "default"!
0133 
0134 - the i2c masters must have their status "disabled". This driver will
0135   enable them at runtime when needed.