smbus-protocol 7.45 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2
SMBus Protocol Summary
======================
3

Linus Torvalds's avatar
Linus Torvalds committed
4 5 6 7 8 9 10 11
The following is a summary of the SMBus protocol. It applies to
all revisions of the protocol (1.0, 1.1, and 2.0).
Certain protocol features which are not supported by
this package are briefly described at the end of this document.

Some adapters understand only the SMBus (System Management Bus) protocol,
which is a subset from the I2C protocol. Fortunately, many devices use
only the same subset, which makes it possible to put them on an SMBus.
12

Linus Torvalds's avatar
Linus Torvalds committed
13 14 15 16 17 18 19
If you write a driver for some I2C device, please try to use the SMBus
commands if at all possible (if the device uses only that subset of the
I2C protocol). This makes it possible to use the device driver on both
SMBus adapters and I2C adapters (the SMBus command set is automatically
translated to I2C on I2C adapters, but plain I2C commands can not be
handled at all on most pure SMBus adapters).

20 21 22 23 24 25
Below is a list of SMBus protocol operations, and the functions executing
them.  Note that the names used in the SMBus protocol specifications usually
don't match these function names.  For some of the operations which pass a
single data byte, the functions using SMBus protocol operation names execute
a different protocol operation entirely.

Linus Torvalds's avatar
Linus Torvalds committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

Key to symbols
==============

S     (1 bit) : Start bit
P     (1 bit) : Stop bit
Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) : Accept and reverse accept bit. 
Addr  (7 bits): I2C 7 bit address. Note that this can be expanded as usual to 
                get a 10 bit I2C address.
Comm  (8 bits): Command byte, a data byte which often selects a register on
                the device.
Data  (8 bits): A plain data byte. Sometimes, I write DataLow, DataHigh
                for 16 bit data.
Count (8 bits): A data byte containing the length of a block operation.

[..]: Data sent by I2C device, as opposed to data sent by the host adapter.


45 46
SMBus Quick Command
===================
Linus Torvalds's avatar
Linus Torvalds committed
47 48 49 50 51 52

This sends a single bit to the device, at the place of the Rd/Wr bit.

A Addr Rd/Wr [A] P


53 54
SMBus Receive Byte:  i2c_smbus_read_byte()
==========================================
Linus Torvalds's avatar
Linus Torvalds committed
55 56 57 58 59 60 61 62 63

This reads a single byte from a device, without specifying a device
register. Some devices are so simple that this interface is enough; for
others, it is a shorthand if you want to read the same register as in
the previous SMBus command.

S Addr Rd [A] [Data] NA P


64 65
SMBus Send Byte:  i2c_smbus_write_byte()
========================================
Linus Torvalds's avatar
Linus Torvalds committed
66

67 68
This operation is the reverse of Receive Byte: it sends a single byte
to a device.  See Receive Byte for more information.
Linus Torvalds's avatar
Linus Torvalds committed
69 70 71 72

S Addr Wr [A] Data [A] P


73 74
SMBus Read Byte:  i2c_smbus_read_byte_data()
============================================
Linus Torvalds's avatar
Linus Torvalds committed
75 76 77 78 79 80 81

This reads a single byte from a device, from a designated register.
The register is specified through the Comm byte.

S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P


82 83
SMBus Read Word:  i2c_smbus_read_word_data()
============================================
Linus Torvalds's avatar
Linus Torvalds committed
84

85
This operation is very like Read Byte; again, data is read from a
Linus Torvalds's avatar
Linus Torvalds committed
86 87 88 89 90 91
device, from a designated register that is specified through the Comm
byte. But this time, the data is a complete word (16 bits).

S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P


92 93
SMBus Write Byte:  i2c_smbus_write_byte_data()
==============================================
Linus Torvalds's avatar
Linus Torvalds committed
94 95 96

This writes a single byte to a device, to a designated register. The
register is specified through the Comm byte. This is the opposite of
97
the Read Byte operation.
Linus Torvalds's avatar
Linus Torvalds committed
98 99 100 101

S Addr Wr [A] Comm [A] Data [A] P


102 103
SMBus Write Word:  i2c_smbus_write_word_data()
==============================================
Linus Torvalds's avatar
Linus Torvalds committed
104

105
This is the opposite of the Read Word operation. 16 bits
106
of data is written to a device, to the designated register that is
Linus Torvalds's avatar
Linus Torvalds committed
107 108 109 110 111
specified through the Comm byte. 

S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P


112 113
SMBus Process Call:  i2c_smbus_process_call()
=============================================
Linus Torvalds's avatar
Linus Torvalds committed
114 115 116 117 118 119 120 121

This command selects a device register (through the Comm byte), sends
16 bits of data to it, and reads 16 bits of data in return.

S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] 
                             S Addr Rd [A] [DataLow] A [DataHigh] NA P


122 123
SMBus Block Read:  i2c_smbus_read_block_data()
==============================================
Linus Torvalds's avatar
Linus Torvalds committed
124 125 126 127 128 129 130 131 132

This command reads a block of up to 32 bytes from a device, from a 
designated register that is specified through the Comm byte. The amount
of data is specified by the device in the Count byte.

S Addr Wr [A] Comm [A] 
           S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P


133 134
SMBus Block Write:  i2c_smbus_write_block_data()
================================================
Linus Torvalds's avatar
Linus Torvalds committed
135 136 137 138 139 140 141 142

The opposite of the Block Read command, this writes up to 32 bytes to 
a device, to a designated register that is specified through the
Comm byte. The amount of data is specified in the Count byte.

S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P


143 144
SMBus Block Write - Block Read Process Call
===========================================
Linus Torvalds's avatar
Linus Torvalds committed
145

146 147
SMBus Block Write - Block Read Process Call was introduced in
Revision 2.0 of the specification.
Linus Torvalds's avatar
Linus Torvalds committed
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168

This command selects a device register (through the Comm byte), sends
1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return.

S Addr Wr [A] Comm [A] Count [A] Data [A] ...
                             S Addr Rd [A] [Count] A [Data] ... A P


SMBus Host Notify
=================

This command is sent from a SMBus device acting as a master to the
SMBus host acting as a slave.
It is the same form as Write Word, with the command code replaced by the
alerting device's address.

[S] [HostAddr] [Wr] A [DevAddr] A [DataLow] A [DataHigh] A [P]


Packet Error Checking (PEC)
===========================
169

Linus Torvalds's avatar
Linus Torvalds committed
170 171
Packet Error Checking was introduced in Revision 1.1 of the specification.

172 173
PEC adds a CRC-8 error-checking byte to transfers using it, immediately
before the terminating STOP.
Linus Torvalds's avatar
Linus Torvalds committed
174 175 176 177


Address Resolution Protocol (ARP)
=================================
178

Linus Torvalds's avatar
Linus Torvalds committed
179 180 181 182 183 184 185 186 187 188 189
The Address Resolution Protocol was introduced in Revision 2.0 of
the specification. It is a higher-layer protocol which uses the
messages above.

ARP adds device enumeration and dynamic address assignment to
the protocol. All ARP communications use slave address 0x61 and
require PEC checksums.


I2C Block Transactions
======================
190

Linus Torvalds's avatar
Linus Torvalds committed
191 192
The following I2C block transactions are supported by the
SMBus layer and are described here for completeness.
193 194
They are *NOT* defined by the SMBus specification.

Linus Torvalds's avatar
Linus Torvalds committed
195 196 197 198
I2C block transactions do not limit the number of bytes transferred
but the SMBus layer places a limit of 32 bytes.


199 200
I2C Block Read:  i2c_smbus_read_i2c_block_data()
================================================
Linus Torvalds's avatar
Linus Torvalds committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218

This command reads a block of bytes from a device, from a 
designated register that is specified through the Comm byte.

S Addr Wr [A] Comm [A] 
           S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P


I2C Block Read (2 Comm bytes)
=============================

This command reads a block of bytes from a device, from a 
designated register that is specified through the two Comm bytes.

S Addr Wr [A] Comm1 [A] Comm2 [A] 
           S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P


219 220
I2C Block Write:  i2c_smbus_write_i2c_block_data()
==================================================
Linus Torvalds's avatar
Linus Torvalds committed
221 222 223 224 225 226 227

The opposite of the Block Read command, this writes bytes to 
a device, to a designated register that is specified through the
Comm byte. Note that command lengths of 0, 2, or more bytes are
supported as they are indistinguishable from data.

S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P