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