xref: /freebsd/sys/contrib/device-tree/Bindings/i3c/i3c.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotGeneric device tree bindings for I3C busses
2*c66ec88fSEmmanuel Vadot===========================================
3*c66ec88fSEmmanuel Vadot
4*c66ec88fSEmmanuel VadotThis document describes generic bindings that should be used to describe I3C
5*c66ec88fSEmmanuel Vadotbusses in a device tree.
6*c66ec88fSEmmanuel Vadot
7*c66ec88fSEmmanuel VadotRequired properties
8*c66ec88fSEmmanuel Vadot-------------------
9*c66ec88fSEmmanuel Vadot
10*c66ec88fSEmmanuel Vadot- #address-cells  - should be <3>. Read more about addresses below.
11*c66ec88fSEmmanuel Vadot- #size-cells     - should be <0>.
12*c66ec88fSEmmanuel Vadot- compatible      - name of the I3C master controller driving the I3C bus
13*c66ec88fSEmmanuel Vadot
14*c66ec88fSEmmanuel VadotFor other required properties e.g. to describe register sets,
15*c66ec88fSEmmanuel Vadotclocks, etc. check the binding documentation of the specific driver.
16*c66ec88fSEmmanuel VadotThe node describing an I3C bus should be named i3c-master.
17*c66ec88fSEmmanuel Vadot
18*c66ec88fSEmmanuel VadotOptional properties
19*c66ec88fSEmmanuel Vadot-------------------
20*c66ec88fSEmmanuel Vadot
21*c66ec88fSEmmanuel VadotThese properties may not be supported by all I3C master drivers. Each I3C
22*c66ec88fSEmmanuel Vadotmaster bindings should specify which of them are supported.
23*c66ec88fSEmmanuel Vadot
24*c66ec88fSEmmanuel Vadot- i3c-scl-hz: frequency of the SCL signal used for I3C transfers.
25*c66ec88fSEmmanuel Vadot	      When undefined the core sets it to 12.5MHz.
26*c66ec88fSEmmanuel Vadot
27*c66ec88fSEmmanuel Vadot- i2c-scl-hz: frequency of the SCL signal used for I2C transfers.
28*c66ec88fSEmmanuel Vadot	      When undefined, the core looks at LVR (Legacy Virtual Register)
29*c66ec88fSEmmanuel Vadot	      values of I2C devices described in the device tree to determine
30*c66ec88fSEmmanuel Vadot	      the maximum I2C frequency.
31*c66ec88fSEmmanuel Vadot
32*c66ec88fSEmmanuel VadotI2C devices
33*c66ec88fSEmmanuel Vadot===========
34*c66ec88fSEmmanuel Vadot
35*c66ec88fSEmmanuel VadotEach I2C device connected to the bus should be described in a subnode. All
36*c66ec88fSEmmanuel Vadotproperties described in Documentation/devicetree/bindings/i2c/i2c.txt are
37*c66ec88fSEmmanuel Vadotvalid here, but several new properties have been added.
38*c66ec88fSEmmanuel Vadot
39*c66ec88fSEmmanuel VadotNew constraint on existing properties:
40*c66ec88fSEmmanuel Vadot--------------------------------------
41*c66ec88fSEmmanuel Vadot- reg: contains 3 cells
42*c66ec88fSEmmanuel Vadot  + first cell : still encoding the I2C address. 10 bit addressing is not
43*c66ec88fSEmmanuel Vadot    supported. Devices with 10 bit address can't be properly passed through
44*c66ec88fSEmmanuel Vadot    DEFSLVS command.
45*c66ec88fSEmmanuel Vadot
46*c66ec88fSEmmanuel Vadot  + second cell: shall be 0
47*c66ec88fSEmmanuel Vadot
48*c66ec88fSEmmanuel Vadot  + third cell: shall encode the I3C LVR (Legacy Virtual Register)
49*c66ec88fSEmmanuel Vadot	bit[31:8]: unused/ignored
50*c66ec88fSEmmanuel Vadot	bit[7:5]: I2C device index. Possible values
51*c66ec88fSEmmanuel Vadot	* 0: I2C device has a 50 ns spike filter
52*c66ec88fSEmmanuel Vadot	* 1: I2C device does not have a 50 ns spike filter but supports high
53*c66ec88fSEmmanuel Vadot	     frequency on SCL
54*c66ec88fSEmmanuel Vadot	* 2: I2C device does not have a 50 ns spike filter and is not tolerant
55*c66ec88fSEmmanuel Vadot	     to high frequencies
56*c66ec88fSEmmanuel Vadot	* 3-7: reserved
57*c66ec88fSEmmanuel Vadot
58*c66ec88fSEmmanuel Vadot	bit[4]: tell whether the device operates in FM (Fast Mode) or FM+ mode
59*c66ec88fSEmmanuel Vadot	* 0: FM+ mode
60*c66ec88fSEmmanuel Vadot	* 1: FM mode
61*c66ec88fSEmmanuel Vadot
62*c66ec88fSEmmanuel Vadot	bit[3:0]: device type
63*c66ec88fSEmmanuel Vadot	* 0-15: reserved
64*c66ec88fSEmmanuel Vadot
65*c66ec88fSEmmanuel VadotThe I2C node unit-address should always match the first cell of the reg
66*c66ec88fSEmmanuel Vadotproperty: <device-type>@<i2c-address>.
67*c66ec88fSEmmanuel Vadot
68*c66ec88fSEmmanuel VadotI3C devices
69*c66ec88fSEmmanuel Vadot===========
70*c66ec88fSEmmanuel Vadot
71*c66ec88fSEmmanuel VadotAll I3C devices are supposed to support DAA (Dynamic Address Assignment), and
72*c66ec88fSEmmanuel Vadotare thus discoverable. So, by default, I3C devices do not have to be described
73*c66ec88fSEmmanuel Vadotin the device tree.
74*c66ec88fSEmmanuel VadotThis being said, one might want to attach extra resources to these devices,
75*c66ec88fSEmmanuel Vadotand those resources may have to be described in the device tree, which in turn
76*c66ec88fSEmmanuel Vadotmeans we have to describe I3C devices.
77*c66ec88fSEmmanuel Vadot
78*c66ec88fSEmmanuel VadotAnother use case for describing an I3C device in the device tree is when this
79*c66ec88fSEmmanuel VadotI3C device has a static I2C address and we want to assign it a specific I3C
80*c66ec88fSEmmanuel Vadotdynamic address before the DAA takes place (so that other devices on the bus
81*c66ec88fSEmmanuel Vadotcan't take this dynamic address).
82*c66ec88fSEmmanuel Vadot
83*c66ec88fSEmmanuel VadotThe I3C device should be names <device-type>@<static-i2c-address>,<i3c-pid>,
84*c66ec88fSEmmanuel Vadotwhere device-type is describing the type of device connected on the bus
85*c66ec88fSEmmanuel Vadot(gpio-controller, sensor, ...).
86*c66ec88fSEmmanuel Vadot
87*c66ec88fSEmmanuel VadotRequired properties
88*c66ec88fSEmmanuel Vadot-------------------
89*c66ec88fSEmmanuel Vadot- reg: contains 3 cells
90*c66ec88fSEmmanuel Vadot  + first cell : encodes the static I2C address. Should be 0 if the device does
91*c66ec88fSEmmanuel Vadot		 not have one (0 is not a valid I2C address).
92*c66ec88fSEmmanuel Vadot
93*c66ec88fSEmmanuel Vadot  + second and third cells: should encode the ProvisionalID. The second cell
94*c66ec88fSEmmanuel Vadot			    contains the manufacturer ID left-shifted by 1.
95*c66ec88fSEmmanuel Vadot			    The third cell contains ORing of the part ID
96*c66ec88fSEmmanuel Vadot			    left-shifted by 16, the instance ID left-shifted
97*c66ec88fSEmmanuel Vadot			    by 12 and the extra information. This encoding is
98*c66ec88fSEmmanuel Vadot			    following the PID definition provided by the I3C
99*c66ec88fSEmmanuel Vadot			    specification.
100*c66ec88fSEmmanuel Vadot
101*c66ec88fSEmmanuel VadotOptional properties
102*c66ec88fSEmmanuel Vadot-------------------
103*c66ec88fSEmmanuel Vadot- assigned-address: dynamic address to be assigned to this device. This
104*c66ec88fSEmmanuel Vadot		    property is only valid if the I3C device has a static
105*c66ec88fSEmmanuel Vadot		    address (first cell of the reg property != 0).
106*c66ec88fSEmmanuel Vadot
107*c66ec88fSEmmanuel Vadot
108*c66ec88fSEmmanuel VadotExample:
109*c66ec88fSEmmanuel Vadot
110*c66ec88fSEmmanuel Vadot	i3c-master@d040000 {
111*c66ec88fSEmmanuel Vadot		compatible = "cdns,i3c-master";
112*c66ec88fSEmmanuel Vadot		clocks = <&coreclock>, <&i3csysclock>;
113*c66ec88fSEmmanuel Vadot		clock-names = "pclk", "sysclk";
114*c66ec88fSEmmanuel Vadot		interrupts = <3 0>;
115*c66ec88fSEmmanuel Vadot		reg = <0x0d040000 0x1000>;
116*c66ec88fSEmmanuel Vadot		#address-cells = <3>;
117*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
118*c66ec88fSEmmanuel Vadot		i2c-scl-hz = <100000>;
119*c66ec88fSEmmanuel Vadot
120*c66ec88fSEmmanuel Vadot		/* I2C device. */
121*c66ec88fSEmmanuel Vadot		nunchuk: nunchuk@52 {
122*c66ec88fSEmmanuel Vadot			compatible = "nintendo,nunchuk";
123*c66ec88fSEmmanuel Vadot			reg = <0x52 0x0 0x10>;
124*c66ec88fSEmmanuel Vadot		};
125*c66ec88fSEmmanuel Vadot
126*c66ec88fSEmmanuel Vadot		/* I3C device with a static I2C address. */
127*c66ec88fSEmmanuel Vadot		thermal_sensor: sensor@68,39200144004 {
128*c66ec88fSEmmanuel Vadot			reg = <0x68 0x392 0x144004>;
129*c66ec88fSEmmanuel Vadot			assigned-address = <0xa>;
130*c66ec88fSEmmanuel Vadot		};
131*c66ec88fSEmmanuel Vadot
132*c66ec88fSEmmanuel Vadot		/*
133*c66ec88fSEmmanuel Vadot		 * I3C device without a static I2C address but requiring
134*c66ec88fSEmmanuel Vadot		 * resources described in the DT.
135*c66ec88fSEmmanuel Vadot		 */
136*c66ec88fSEmmanuel Vadot		sensor@0,39200154004 {
137*c66ec88fSEmmanuel Vadot			reg = <0x0 0x392 0x154004>;
138*c66ec88fSEmmanuel Vadot			clocks = <&clock_provider 0>;
139*c66ec88fSEmmanuel Vadot		};
140*c66ec88fSEmmanuel Vadot	};
141