aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/i2c/smbus-protocol
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/i2c/smbus-protocol')
-rw-r--r--Documentation/i2c/smbus-protocol81
1 files changed, 46 insertions, 35 deletions
diff --git a/Documentation/i2c/smbus-protocol b/Documentation/i2c/smbus-protocol
index 8a653c60d25a..24bfb65da17d 100644
--- a/Documentation/i2c/smbus-protocol
+++ b/Documentation/i2c/smbus-protocol
@@ -1,5 +1,6 @@
1SMBus Protocol Summary 1SMBus Protocol Summary
2====================== 2======================
3
3The following is a summary of the SMBus protocol. It applies to 4The following is a summary of the SMBus protocol. It applies to
4all revisions of the protocol (1.0, 1.1, and 2.0). 5all revisions of the protocol (1.0, 1.1, and 2.0).
5Certain protocol features which are not supported by 6Certain protocol features which are not supported by
@@ -8,6 +9,7 @@ this package are briefly described at the end of this document.
8Some adapters understand only the SMBus (System Management Bus) protocol, 9Some adapters understand only the SMBus (System Management Bus) protocol,
9which is a subset from the I2C protocol. Fortunately, many devices use 10which is a subset from the I2C protocol. Fortunately, many devices use
10only the same subset, which makes it possible to put them on an SMBus. 11only the same subset, which makes it possible to put them on an SMBus.
12
11If you write a driver for some I2C device, please try to use the SMBus 13If you write a driver for some I2C device, please try to use the SMBus
12commands if at all possible (if the device uses only that subset of the 14commands if at all possible (if the device uses only that subset of the
13I2C protocol). This makes it possible to use the device driver on both 15I2C protocol). This makes it possible to use the device driver on both
@@ -15,7 +17,12 @@ SMBus adapters and I2C adapters (the SMBus command set is automatically
15translated to I2C on I2C adapters, but plain I2C commands can not be 17translated to I2C on I2C adapters, but plain I2C commands can not be
16handled at all on most pure SMBus adapters). 18handled at all on most pure SMBus adapters).
17 19
18Below is a list of SMBus commands. 20Below is a list of SMBus protocol operations, and the functions executing
21them. Note that the names used in the SMBus protocol specifications usually
22don't match these function names. For some of the operations which pass a
23single data byte, the functions using SMBus protocol operation names execute
24a different protocol operation entirely.
25
19 26
20Key to symbols 27Key to symbols
21============== 28==============
@@ -35,17 +42,16 @@ Count (8 bits): A data byte containing the length of a block operation.
35[..]: Data sent by I2C device, as opposed to data sent by the host adapter. 42[..]: Data sent by I2C device, as opposed to data sent by the host adapter.
36 43
37 44
38SMBus Write Quick 45SMBus Quick Command
39================= 46===================
40 47
41This sends a single bit to the device, at the place of the Rd/Wr bit. 48This sends a single bit to the device, at the place of the Rd/Wr bit.
42There is no equivalent Read Quick command.
43 49
44A Addr Rd/Wr [A] P 50A Addr Rd/Wr [A] P
45 51
46 52
47SMBus Read Byte 53SMBus Receive Byte: i2c_smbus_read_byte()
48=============== 54==========================================
49 55
50This reads a single byte from a device, without specifying a device 56This reads a single byte from a device, without specifying a device
51register. Some devices are so simple that this interface is enough; for 57register. Some devices are so simple that this interface is enough; for
@@ -55,17 +61,17 @@ the previous SMBus command.
55S Addr Rd [A] [Data] NA P 61S Addr Rd [A] [Data] NA P
56 62
57 63
58SMBus Write Byte 64SMBus Send Byte: i2c_smbus_write_byte()
59================ 65========================================
60 66
61This is the reverse of Read Byte: it sends a single byte to a device. 67This operation is the reverse of Receive Byte: it sends a single byte
62See Read Byte for more information. 68to a device. See Receive Byte for more information.
63 69
64S Addr Wr [A] Data [A] P 70S Addr Wr [A] Data [A] P
65 71
66 72
67SMBus Read Byte Data 73SMBus Read Byte: i2c_smbus_read_byte_data()
68==================== 74============================================
69 75
70This reads a single byte from a device, from a designated register. 76This reads a single byte from a device, from a designated register.
71The register is specified through the Comm byte. 77The register is specified through the Comm byte.
@@ -73,30 +79,30 @@ The register is specified through the Comm byte.
73S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P 79S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
74 80
75 81
76SMBus Read Word Data 82SMBus Read Word: i2c_smbus_read_word_data()
77==================== 83============================================
78 84
79This command is very like Read Byte Data; again, data is read from a 85This operation is very like Read Byte; again, data is read from a
80device, from a designated register that is specified through the Comm 86device, from a designated register that is specified through the Comm
81byte. But this time, the data is a complete word (16 bits). 87byte. But this time, the data is a complete word (16 bits).
82 88
83S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P 89S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
84 90
85 91
86SMBus Write Byte Data 92SMBus Write Byte: i2c_smbus_write_byte_data()
87===================== 93==============================================
88 94
89This writes a single byte to a device, to a designated register. The 95This writes a single byte to a device, to a designated register. The
90register is specified through the Comm byte. This is the opposite of 96register is specified through the Comm byte. This is the opposite of
91the Read Byte Data command. 97the Read Byte operation.
92 98
93S Addr Wr [A] Comm [A] Data [A] P 99S Addr Wr [A] Comm [A] Data [A] P
94 100
95 101
96SMBus Write Word Data 102SMBus Write Word: i2c_smbus_write_word_data()
97===================== 103==============================================
98 104
99This is the opposite operation of the Read Word Data command. 16 bits 105This is the opposite of the Read Word operation. 16 bits
100of data is written to a device, to the designated register that is 106of data is written to a device, to the designated register that is
101specified through the Comm byte. 107specified through the Comm byte.
102 108
@@ -113,8 +119,8 @@ S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]
113 S Addr Rd [A] [DataLow] A [DataHigh] NA P 119 S Addr Rd [A] [DataLow] A [DataHigh] NA P
114 120
115 121
116SMBus Block Read 122SMBus Block Read: i2c_smbus_read_block_data()
117================ 123==============================================
118 124
119This command reads a block of up to 32 bytes from a device, from a 125This command reads a block of up to 32 bytes from a device, from a
120designated register that is specified through the Comm byte. The amount 126designated register that is specified through the Comm byte. The amount
@@ -124,8 +130,8 @@ S Addr Wr [A] Comm [A]
124 S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P 130 S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
125 131
126 132
127SMBus Block Write 133SMBus Block Write: i2c_smbus_write_block_data()
128================= 134================================================
129 135
130The opposite of the Block Read command, this writes up to 32 bytes to 136The opposite of the Block Read command, this writes up to 32 bytes to
131a device, to a designated register that is specified through the 137a device, to a designated register that is specified through the
@@ -134,10 +140,11 @@ Comm byte. The amount of data is specified in the Count byte.
134S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P 140S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
135 141
136 142
137SMBus Block Process Call 143SMBus Block Write - Block Read Process Call
138======================== 144===========================================
139 145
140SMBus Block Process Call was introduced in Revision 2.0 of the specification. 146SMBus Block Write - Block Read Process Call was introduced in
147Revision 2.0 of the specification.
141 148
142This command selects a device register (through the Comm byte), sends 149This command selects a device register (through the Comm byte), sends
1431 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return. 1501 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return.
@@ -159,13 +166,16 @@ alerting device's address.
159 166
160Packet Error Checking (PEC) 167Packet Error Checking (PEC)
161=========================== 168===========================
169
162Packet Error Checking was introduced in Revision 1.1 of the specification. 170Packet Error Checking was introduced in Revision 1.1 of the specification.
163 171
164PEC adds a CRC-8 error-checking byte to all transfers. 172PEC adds a CRC-8 error-checking byte to transfers using it, immediately
173before the terminating STOP.
165 174
166 175
167Address Resolution Protocol (ARP) 176Address Resolution Protocol (ARP)
168================================= 177=================================
178
169The Address Resolution Protocol was introduced in Revision 2.0 of 179The Address Resolution Protocol was introduced in Revision 2.0 of
170the specification. It is a higher-layer protocol which uses the 180the specification. It is a higher-layer protocol which uses the
171messages above. 181messages above.
@@ -177,14 +187,17 @@ require PEC checksums.
177 187
178I2C Block Transactions 188I2C Block Transactions
179====================== 189======================
190
180The following I2C block transactions are supported by the 191The following I2C block transactions are supported by the
181SMBus layer and are described here for completeness. 192SMBus layer and are described here for completeness.
193They are *NOT* defined by the SMBus specification.
194
182I2C block transactions do not limit the number of bytes transferred 195I2C block transactions do not limit the number of bytes transferred
183but the SMBus layer places a limit of 32 bytes. 196but the SMBus layer places a limit of 32 bytes.
184 197
185 198
186I2C Block Read 199I2C Block Read: i2c_smbus_read_i2c_block_data()
187============== 200================================================
188 201
189This command reads a block of bytes from a device, from a 202This command reads a block of bytes from a device, from a
190designated register that is specified through the Comm byte. 203designated register that is specified through the Comm byte.
@@ -203,8 +216,8 @@ S Addr Wr [A] Comm1 [A] Comm2 [A]
203 S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P 216 S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
204 217
205 218
206I2C Block Write 219I2C Block Write: i2c_smbus_write_i2c_block_data()
207=============== 220==================================================
208 221
209The opposite of the Block Read command, this writes bytes to 222The opposite of the Block Read command, this writes bytes to
210a device, to a designated register that is specified through the 223a device, to a designated register that is specified through the
@@ -212,5 +225,3 @@ Comm byte. Note that command lengths of 0, 2, or more bytes are
212supported as they are indistinguishable from data. 225supported as they are indistinguishable from data.
213 226
214S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P 227S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
215
216