xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/i2c/i2c.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunGeneric device tree bindings for I2C busses
2*4882a593Smuzhiyun===========================================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunThis document describes generic bindings which can be used to describe I2C
5*4882a593Smuzhiyunbusses and their child devices in a device tree.
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunRequired properties (per bus)
8*4882a593Smuzhiyun-----------------------------
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun- #address-cells  - should be <1>. Read more about addresses below.
11*4882a593Smuzhiyun- #size-cells     - should be <0>.
12*4882a593Smuzhiyun- compatible      - name of I2C bus controller
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunFor other required properties e.g. to describe register sets,
15*4882a593Smuzhiyunclocks, etc. check the binding documentation of the specific driver.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunThe cells properties above define that an address of children of an I2C bus
18*4882a593Smuzhiyunare described by a single value.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunOptional properties (per bus)
21*4882a593Smuzhiyun-----------------------------
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunThese properties may not be supported by all drivers. However, if a driver
24*4882a593Smuzhiyunwants to support one of the below features, it should adapt these bindings.
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun- clock-frequency
27*4882a593Smuzhiyun	frequency of bus clock in Hz.
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun- i2c-bus
30*4882a593Smuzhiyun	For I2C adapters that have child nodes that are a mixture of both I2C
31*4882a593Smuzhiyun	devices and non-I2C devices, the 'i2c-bus' subnode can be used for
32*4882a593Smuzhiyun	populating I2C devices. If the 'i2c-bus' subnode is present, only
33*4882a593Smuzhiyun	subnodes of this will be considered as I2C slaves. The properties,
34*4882a593Smuzhiyun	'#address-cells' and '#size-cells' must be defined under this subnode
35*4882a593Smuzhiyun	if present.
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun- i2c-scl-falling-time-ns
38*4882a593Smuzhiyun	Number of nanoseconds the SCL signal takes to fall; t(f) in the I2C
39*4882a593Smuzhiyun	specification.
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun- i2c-scl-internal-delay-ns
42*4882a593Smuzhiyun	Number of nanoseconds the IP core additionally needs to setup SCL.
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun- i2c-scl-rising-time-ns
45*4882a593Smuzhiyun	Number of nanoseconds the SCL signal takes to rise; t(r) in the I2C
46*4882a593Smuzhiyun	specification.
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun- i2c-sda-falling-time-ns
49*4882a593Smuzhiyun	Number of nanoseconds the SDA signal takes to fall; t(f) in the I2C
50*4882a593Smuzhiyun	specification.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun- i2c-analog-filter
53*4882a593Smuzhiyun	Enable analog filter for i2c lines.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun- i2c-digital-filter
56*4882a593Smuzhiyun	Enable digital filter for i2c lines.
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun- i2c-digital-filter-width-ns
59*4882a593Smuzhiyun	Width of spikes which can be filtered by digital filter
60*4882a593Smuzhiyun	(i2c-digital-filter). This width is specified in nanoseconds.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun- i2c-analog-filter-cutoff-frequency
63*4882a593Smuzhiyun	Frequency that the analog filter (i2c-analog-filter) uses to distinguish
64*4882a593Smuzhiyun	which signal to filter. Signal with higher frequency than specified will
65*4882a593Smuzhiyun	be filtered out. Only lower frequency will pass (this is applicable to
66*4882a593Smuzhiyun	a low-pass analog filter). Typical value should be above the normal
67*4882a593Smuzhiyun	i2c bus clock frequency (clock-frequency).
68*4882a593Smuzhiyun	Specified in Hz.
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun- multi-master
71*4882a593Smuzhiyun	states that there is another master active on this bus. The OS can use
72*4882a593Smuzhiyun	this information to adapt power management to keep the arbitration awake
73*4882a593Smuzhiyun	all the time, for example. Can not be combined with 'single-master'.
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun- pinctrl
76*4882a593Smuzhiyun	add extra pinctrl to configure SCL/SDA pins to GPIO function for bus
77*4882a593Smuzhiyun	recovery, call it "gpio" or "recovery" (deprecated) state
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun- scl-gpios
80*4882a593Smuzhiyun	specify the gpio related to SCL pin. Used for GPIO bus recovery.
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun- sda-gpios
83*4882a593Smuzhiyun	specify the gpio related to SDA pin. Optional for GPIO bus recovery.
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun- single-master
86*4882a593Smuzhiyun	states that there is no other master active on this bus. The OS can use
87*4882a593Smuzhiyun	this information to detect a stalled bus more reliably, for example.
88*4882a593Smuzhiyun	Can not be combined with 'multi-master'.
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun- smbus
91*4882a593Smuzhiyun	states that additional SMBus restrictions and features apply to this bus.
92*4882a593Smuzhiyun	Examples of features are SMBusHostNotify and SMBusAlert. Examples of
93*4882a593Smuzhiyun	restrictions are more reserved addresses and timeout definitions.
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunRequired properties (per child device)
96*4882a593Smuzhiyun--------------------------------------
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun- compatible
99*4882a593Smuzhiyun	name of I2C slave device
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun- reg
102*4882a593Smuzhiyun	One or many I2C slave addresses. These are usually a 7 bit addresses.
103*4882a593Smuzhiyun	However, flags can be attached to an address. I2C_TEN_BIT_ADDRESS is
104*4882a593Smuzhiyun	used to mark a 10 bit address. It is needed to avoid the ambiguity
105*4882a593Smuzhiyun	between e.g. a 7 bit address of 0x50 and a 10 bit address of 0x050
106*4882a593Smuzhiyun	which, in theory, can be on the same bus.
107*4882a593Smuzhiyun	Another flag is I2C_OWN_SLAVE_ADDRESS to mark addresses on which we
108*4882a593Smuzhiyun	listen to be devices ourselves.
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunOptional properties (per child device)
111*4882a593Smuzhiyun--------------------------------------
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunThese properties may not be supported by all drivers. However, if a driver
114*4882a593Smuzhiyunwants to support one of the below features, it should adapt these bindings.
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun- host-notify
117*4882a593Smuzhiyun	device uses SMBus host notify protocol instead of interrupt line.
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun- interrupts
120*4882a593Smuzhiyun	interrupts used by the device.
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun- interrupt-names
123*4882a593Smuzhiyun	"irq", "wakeup" and "smbus_alert" names are recognized by I2C core,
124*4882a593Smuzhiyun	other names are	left to individual drivers.
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun- reg-names
127*4882a593Smuzhiyun	Names of map programmable addresses.
128*4882a593Smuzhiyun	It can contain any map needing another address than default one.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun- wakeup-source
131*4882a593Smuzhiyun	device can be used as a wakeup source.
132*4882a593Smuzhiyun
133*4882a593SmuzhiyunBinding may contain optional "interrupts" property, describing interrupts
134*4882a593Smuzhiyunused by the device. I2C core will assign "irq" interrupt (or the very first
135*4882a593Smuzhiyuninterrupt if not using interrupt names) as primary interrupt for the slave.
136*4882a593Smuzhiyun
137*4882a593SmuzhiyunAlternatively, devices supporting SMBus Host Notify, and connected to
138*4882a593Smuzhiyunadapters that support this feature, may use "host-notify" property. I2C
139*4882a593Smuzhiyuncore will create a virtual interrupt for Host Notify and assign it as
140*4882a593Smuzhiyunprimary interrupt for the slave.
141*4882a593Smuzhiyun
142*4882a593SmuzhiyunAlso, if device is marked as a wakeup source, I2C core will set up "wakeup"
143*4882a593Smuzhiyuninterrupt for the device. If "wakeup" interrupt name is not present in the
144*4882a593Smuzhiyunbinding, then primary interrupt will be used as wakeup interrupt.
145