18c2ecf20Sopenharmony_ciGeneric device tree bindings for I3C busses 28c2ecf20Sopenharmony_ci=========================================== 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciThis document describes generic bindings that should be used to describe I3C 58c2ecf20Sopenharmony_cibusses in a device tree. 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciRequired properties 88c2ecf20Sopenharmony_ci------------------- 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci- #address-cells - should be <3>. Read more about addresses below. 118c2ecf20Sopenharmony_ci- #size-cells - should be <0>. 128c2ecf20Sopenharmony_ci- compatible - name of the I3C master controller driving the I3C bus 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciFor other required properties e.g. to describe register sets, 158c2ecf20Sopenharmony_ciclocks, etc. check the binding documentation of the specific driver. 168c2ecf20Sopenharmony_ciThe node describing an I3C bus should be named i3c-master. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciOptional properties 198c2ecf20Sopenharmony_ci------------------- 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciThese properties may not be supported by all I3C master drivers. Each I3C 228c2ecf20Sopenharmony_cimaster bindings should specify which of them are supported. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci- i3c-scl-hz: frequency of the SCL signal used for I3C transfers. 258c2ecf20Sopenharmony_ci When undefined the core sets it to 12.5MHz. 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci- i2c-scl-hz: frequency of the SCL signal used for I2C transfers. 288c2ecf20Sopenharmony_ci When undefined, the core looks at LVR (Legacy Virtual Register) 298c2ecf20Sopenharmony_ci values of I2C devices described in the device tree to determine 308c2ecf20Sopenharmony_ci the maximum I2C frequency. 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciI2C devices 338c2ecf20Sopenharmony_ci=========== 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciEach I2C device connected to the bus should be described in a subnode. All 368c2ecf20Sopenharmony_ciproperties described in Documentation/devicetree/bindings/i2c/i2c.txt are 378c2ecf20Sopenharmony_civalid here, but several new properties have been added. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciNew constraint on existing properties: 408c2ecf20Sopenharmony_ci-------------------------------------- 418c2ecf20Sopenharmony_ci- reg: contains 3 cells 428c2ecf20Sopenharmony_ci + first cell : still encoding the I2C address. 10 bit addressing is not 438c2ecf20Sopenharmony_ci supported. Devices with 10 bit address can't be properly passed through 448c2ecf20Sopenharmony_ci DEFSLVS command. 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci + second cell: shall be 0 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci + third cell: shall encode the I3C LVR (Legacy Virtual Register) 498c2ecf20Sopenharmony_ci bit[31:8]: unused/ignored 508c2ecf20Sopenharmony_ci bit[7:5]: I2C device index. Possible values 518c2ecf20Sopenharmony_ci * 0: I2C device has a 50 ns spike filter 528c2ecf20Sopenharmony_ci * 1: I2C device does not have a 50 ns spike filter but supports high 538c2ecf20Sopenharmony_ci frequency on SCL 548c2ecf20Sopenharmony_ci * 2: I2C device does not have a 50 ns spike filter and is not tolerant 558c2ecf20Sopenharmony_ci to high frequencies 568c2ecf20Sopenharmony_ci * 3-7: reserved 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci bit[4]: tell whether the device operates in FM (Fast Mode) or FM+ mode 598c2ecf20Sopenharmony_ci * 0: FM+ mode 608c2ecf20Sopenharmony_ci * 1: FM mode 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci bit[3:0]: device type 638c2ecf20Sopenharmony_ci * 0-15: reserved 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ciThe I2C node unit-address should always match the first cell of the reg 668c2ecf20Sopenharmony_ciproperty: <device-type>@<i2c-address>. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciI3C devices 698c2ecf20Sopenharmony_ci=========== 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ciAll I3C devices are supposed to support DAA (Dynamic Address Assignment), and 728c2ecf20Sopenharmony_ciare thus discoverable. So, by default, I3C devices do not have to be described 738c2ecf20Sopenharmony_ciin the device tree. 748c2ecf20Sopenharmony_ciThis being said, one might want to attach extra resources to these devices, 758c2ecf20Sopenharmony_ciand those resources may have to be described in the device tree, which in turn 768c2ecf20Sopenharmony_cimeans we have to describe I3C devices. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciAnother use case for describing an I3C device in the device tree is when this 798c2ecf20Sopenharmony_ciI3C device has a static I2C address and we want to assign it a specific I3C 808c2ecf20Sopenharmony_cidynamic address before the DAA takes place (so that other devices on the bus 818c2ecf20Sopenharmony_cican't take this dynamic address). 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ciThe I3C device should be names <device-type>@<static-i2c-address>,<i3c-pid>, 848c2ecf20Sopenharmony_ciwhere device-type is describing the type of device connected on the bus 858c2ecf20Sopenharmony_ci(gpio-controller, sensor, ...). 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ciRequired properties 888c2ecf20Sopenharmony_ci------------------- 898c2ecf20Sopenharmony_ci- reg: contains 3 cells 908c2ecf20Sopenharmony_ci + first cell : encodes the static I2C address. Should be 0 if the device does 918c2ecf20Sopenharmony_ci not have one (0 is not a valid I2C address). 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci + second and third cells: should encode the ProvisionalID. The second cell 948c2ecf20Sopenharmony_ci contains the manufacturer ID left-shifted by 1. 958c2ecf20Sopenharmony_ci The third cell contains ORing of the part ID 968c2ecf20Sopenharmony_ci left-shifted by 16, the instance ID left-shifted 978c2ecf20Sopenharmony_ci by 12 and the extra information. This encoding is 988c2ecf20Sopenharmony_ci following the PID definition provided by the I3C 998c2ecf20Sopenharmony_ci specification. 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ciOptional properties 1028c2ecf20Sopenharmony_ci------------------- 1038c2ecf20Sopenharmony_ci- assigned-address: dynamic address to be assigned to this device. This 1048c2ecf20Sopenharmony_ci property is only valid if the I3C device has a static 1058c2ecf20Sopenharmony_ci address (first cell of the reg property != 0). 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciExample: 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci i3c-master@d040000 { 1118c2ecf20Sopenharmony_ci compatible = "cdns,i3c-master"; 1128c2ecf20Sopenharmony_ci clocks = <&coreclock>, <&i3csysclock>; 1138c2ecf20Sopenharmony_ci clock-names = "pclk", "sysclk"; 1148c2ecf20Sopenharmony_ci interrupts = <3 0>; 1158c2ecf20Sopenharmony_ci reg = <0x0d040000 0x1000>; 1168c2ecf20Sopenharmony_ci #address-cells = <3>; 1178c2ecf20Sopenharmony_ci #size-cells = <0>; 1188c2ecf20Sopenharmony_ci i2c-scl-hz = <100000>; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci /* I2C device. */ 1218c2ecf20Sopenharmony_ci nunchuk: nunchuk@52 { 1228c2ecf20Sopenharmony_ci compatible = "nintendo,nunchuk"; 1238c2ecf20Sopenharmony_ci reg = <0x52 0x0 0x10>; 1248c2ecf20Sopenharmony_ci }; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci /* I3C device with a static I2C address. */ 1278c2ecf20Sopenharmony_ci thermal_sensor: sensor@68,39200144004 { 1288c2ecf20Sopenharmony_ci reg = <0x68 0x392 0x144004>; 1298c2ecf20Sopenharmony_ci assigned-address = <0xa>; 1308c2ecf20Sopenharmony_ci }; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci /* 1338c2ecf20Sopenharmony_ci * I3C device without a static I2C address but requiring 1348c2ecf20Sopenharmony_ci * resources described in the DT. 1358c2ecf20Sopenharmony_ci */ 1368c2ecf20Sopenharmony_ci sensor@0,39200154004 { 1378c2ecf20Sopenharmony_ci reg = <0x0 0x392 0x154004>; 1388c2ecf20Sopenharmony_ci clocks = <&clock_provider 0>; 1398c2ecf20Sopenharmony_ci }; 1408c2ecf20Sopenharmony_ci }; 141