sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget./translations/zh_CN/i2c/slave-testunit-backendmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/zh_TW/i2c/slave-testunit-backendmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/it_IT/i2c/slave-testunit-backendmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/ja_JP/i2c/slave-testunit-backendmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/ko_KR/i2c/slave-testunit-backendmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/sp_SP/i2c/slave-testunit-backendmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhH/var/lib/git/docbuild/linux/Documentation/i2c/slave-testunit-backend.rsthKubhsection)}(hhh](htitle)}(h Linux I2C slave testunit backendh]h Linux I2C slave testunit backend}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h2by Wolfram Sang in 2020h](hby Wolfram Sang <}(hhhhhNhNubh reference)}(hwsa@sang-engineering.comh]hwsa@sang-engineering.com}(hhhhhNhNubah}(h]h ]h"]h$]h&]refurimailto:wsa@sang-engineering.comuh1hhhubh > in 2020}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXqThis backend can be used to trigger test cases for I2C bus masters which require a remote device with certain capabilities (and which are usually not so easy to obtain). Examples include multi-master testing, and SMBus Host Notify testing. For some tests, the I2C slave controller must be able to switch between master and slave mode because it needs to send data, too.h]hXqThis backend can be used to trigger test cases for I2C bus masters which require a remote device with certain capabilities (and which are usually not so easy to obtain). Examples include multi-master testing, and SMBus Host Notify testing. For some tests, the I2C slave controller must be able to switch between master and slave mode because it needs to send data, too.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hNote that this is a device for testing and debugging. It should not be enabled in a production build. And while there is some versioning and we try hard to keep backward compatibility, there is no stable ABI guaranteed!h]hNote that this is a device for testing and debugging. It should not be enabled in a production build. And while there is some versioning and we try hard to keep backward compatibility, there is no stable ABI guaranteed!}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hFInstantiating the device is regular. Example for bus 0, address 0x30::h]hEInstantiating the device is regular. Example for bus 0, address 0x30:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh literal_block)}(hF# echo "slave-testunit 0x1030" > /sys/bus/i2c/devices/i2c-0/new_deviceh]hF# echo "slave-testunit 0x1030" > /sys/bus/i2c/devices/i2c-0/new_device}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhhhubh)}(hOr using firmware nodes. Here is a devicetree example (note this is only a debug device, so there are no official DT bindings)::h]hOr using firmware nodes. Here is a devicetree example (note this is only a debug device, so there are no official DT bindings):}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubj)}(h&i2c0 { ... testunit@30 { compatible = "slave-testunit"; reg = <(0x30 | I2C_OWN_SLAVE_ADDRESS)>; }; };h]h&i2c0 { ... testunit@30 { compatible = "slave-testunit"; reg = <(0x30 | I2C_OWN_SLAVE_ADDRESS)>; }; };}hj7sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhhhubh)}(hAfter that, you will have the device listening. Reading will return a single byte. Its value is 0 if the testunit is idle, otherwise the command number of the currently running command.h]hAfter that, you will have the device listening. Reading will return a single byte. Its value is 0 if the testunit is idle, otherwise the command number of the currently running command.}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hhhhubh)}(hWhen writing, the device consists of 4 8-bit registers and, except for some "partial" commands, all registers must be written to start a testcase, i.e. you usually write 4 bytes to the device. The registers are:h]hWhen writing, the device consists of 4 8-bit registers and, except for some “partial” commands, all registers must be written to start a testcase, i.e. you usually write 4 bytes to the device. The registers are:}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hhhhubhtable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthK!uh1jkhjhubjl)}(hhh]h}(h]h ]h"]h$]h&]colwidthK!uh1jkhjhubjl)}(hhh]h}(h]h ]h"]h$]h&]colwidthK!uh1jkhjhubhthead)}(hhh]hrow)}(hhh](hentry)}(hhh]h)}(hOffseth]hOffset}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hNameh]hName}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h Descriptionh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjhubhtbody)}(hhh](j)}(hhh](j)}(hhh]h)}(h0x00h]h0x00}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hCMDh]hCMD}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hwhich test to triggerh]hwhich test to trigger}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(h0x01h]h0x01}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj>ubah}(h]h ]h"]h$]h&]uh1jhj;ubj)}(hhh]h)}(hDATALh]hDATAL}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjUubah}(h]h ]h"]h$]h&]uh1jhj;ubj)}(hhh]h)}(h!configuration byte 1 for the testh]h!configuration byte 1 for the test}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjlubah}(h]h ]h"]h$]h&]uh1jhj;ubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(h0x02h]h0x02}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATAHh]hDATAH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h!configuration byte 2 for the testh]h!configuration byte 2 for the test}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(h0x03h]h0x03}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDELAYh]hDELAY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h'delay in n * 10ms until test is startedh]h'delay in n * 10ms until test is started}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhubeh}(h]h ]h"]h$]h&]colsKuh1jfhjcubah}(h]h ]h"]h$]h&]uh1jahhhhhhhNubh)}(hKUsing 'i2cset' from the i2c-tools package, the generic command looks like::h]hNUsing ‘i2cset’ from the i2c-tools package, the generic command looks like:}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hhhhubj)}(hH# i2cset -y ih]hH# i2cset -y i}hjFsbah}(h]h ]h"]h$]h&]hhuh1jhhhK5hhhhubh)}(hDELAY is a generic parameter which will delay the execution of the test in CMD. While a command is running (including the delay), new commands will not be acknowledged. You need to wait until the old one is completed.h]hDELAY is a generic parameter which will delay the execution of the test in CMD. While a command is running (including the delay), new commands will not be acknowledged. You need to wait until the old one is completed.}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hhhhubh)}(h{The commands are described in the following section. An invalid command will result in the transfer not being acknowledged.h]h{The commands are described in the following section. An invalid command will result in the transfer not being acknowledged.}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK;hhhhubh)}(hhh](h)}(hCommandsh]hCommands}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhjphhhhhK?ubh)}(hhh](h)}(h 0x00 NOOPh]h 0x00 NOOP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKBubh)}(hReserved for future use.h]hReserved for future use.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjhhubeh}(h]x00-noopah ]h"] 0x00 noopah$]h&]uh1hhjphhhhhKBubh)}(hhh](h)}(h0x01 READ_BYTESh]h0x01 READ_BYTES}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKGubjb)}(hhh]jg)}(hhh](jl)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCMDh]hCMD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATALh]hDATAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATAHh]hDATAH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDELAYh]hDELAY}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhj/ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]j)}(hhh](j)}(hhh]h)}(h0x01h]h0x01}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhjXubah}(h]h ]h"]h$]h&]uh1jhjUubj)}(hhh]h)}(hFaddress to read data from (lower 7 bits, highest bit currently unused)h]hFaddress to read data from (lower 7 bits, highest bit currently unused)}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjoubah}(h]h ]h"]h$]h&]uh1jhjUubj)}(hhh]h)}(hnumber of bytes to readh]hnumber of bytes to read}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShjubah}(h]h ]h"]h$]h&]uh1jhjUubj)}(hhh]h)}(hn * 10msh]hn * 10ms}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThjubah}(h]h ]h"]h$]h&]uh1jhjUubeh}(h]h ]h"]h$]h&]uh1jhjRubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]colsKuh1jfhjubah}(h]h ]h"]h$]h&]uh1jahjhhhNhNubh)}(hXZAlso needs master mode. This is useful to test if your bus master driver is handling multi-master correctly. You can trigger the testunit to read bytes from another device on the bus. If the bus master under test also wants to access the bus at the same time, the bus will be busy. Example to read 128 bytes from device 0x50 after 50ms of delay::h]hXYAlso needs master mode. This is useful to test if your bus master driver is handling multi-master correctly. You can trigger the testunit to read bytes from another device on the bus. If the bus master under test also wants to access the bus at the same time, the bus will be busy. Example to read 128 bytes from device 0x50 after 50ms of delay:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjhhubj)}(h"# i2cset -y 0 0x30 1 0x50 0x80 5 ih]h"# i2cset -y 0 0x30 1 0x50 0x80 5 i}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK\hjhhubeh}(h]x01-read-bytesah ]h"]0x01 read_bytesah$]h&]uh1hhjphhhhhKGubh)}(hhh](h)}(h0x02 SMBUS_HOST_NOTIFYh]h0x02 SMBUS_HOST_NOTIFY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK_ubjb)}(hhh]jg)}(hhh](jl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCMDh]hCMD}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKdhj2ubah}(h]h ]h"]h$]h&]uh1jhj/ubj)}(hhh]h)}(hDATALh]hDATAL}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehjIubah}(h]h ]h"]h$]h&]uh1jhj/ubj)}(hhh]h)}(hDATAHh]hDATAH}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKfhj`ubah}(h]h ]h"]h$]h&]uh1jhj/ubj)}(hhh]h)}(hDELAYh]hDELAY}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKghjwubah}(h]h ]h"]h$]h&]uh1jhj/ubeh}(h]h ]h"]h$]h&]uh1jhj,ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]j)}(hhh](j)}(hhh]h)}(h0x02h]h0x02}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h#low byte of the status word to sendh]h#low byte of the status word to send}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKjhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h$high byte of the status word to sendh]h$high byte of the status word to send}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hn * 10msh]hn * 10ms}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]colsKuh1jfhjubah}(h]h ]h"]h$]h&]uh1jahjhhhNhNubh)}(hAlso needs master mode. This test will send an SMBUS_HOST_NOTIFY message to the host. Note that the status word is currently ignored in the Linux Kernel. Example to send a notification with status word 0x6442 after 10ms::h]hAlso needs master mode. This test will send an SMBUS_HOST_NOTIFY message to the host. Note that the status word is currently ignored in the Linux Kernel. Example to send a notification with status word 0x6442 after 10ms:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjhhubj)}(h"# i2cset -y 0 0x30 2 0x42 0x64 1 ih]h"# i2cset -y 0 0x30 2 0x42 0x64 1 i}hj#sbah}(h]h ]h"]h$]h&]hhuh1jhhhKrhjhhubh)}(hpIf the host controller supports HostNotify, this message with debug level should appear (Linux 6.11 and later)::h]hoIf the host controller supports HostNotify, this message with debug level should appear (Linux 6.11 and later):}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjhhubj)}(h%Detected HostNotify from address 0x30h]h%Detected HostNotify from address 0x30}hj?sbah}(h]h ]h"]h$]h&]hhuh1jhhhKwhjhhubeh}(h]x02-smbus-host-notifyah ]h"]0x02 smbus_host_notifyah$]h&]uh1hhjphhhhhK_ubh)}(hhh](h)}(h0x03 SMBUS_BLOCK_PROC_CALLh]h0x03 SMBUS_BLOCK_PROC_CALL}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjUhhhhhKzubjb)}(hhh]jg)}(hhh](jl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjiubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjiubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjiubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjiubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCMDh]hCMD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATALh]hDATAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATAHh]hDATAH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDELAYh]hDELAY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjiubj)}(hhh]j)}(hhh](j)}(hhh]h)}(h0x03h]h0x03}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h,0x01 (i.e. one further byte will be written)h]h,0x01 (i.e. one further byte will be written)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hnumber of bytes to be sent backh]hnumber of bytes to be sent back}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj2ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hleave out, partial command!h]hleave out, partial command!}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjIubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjiubeh}(h]h ]h"]h$]h&]colsKuh1jfhjfubah}(h]h ]h"]h$]h&]uh1jahjUhhhNhNubh)}(hXPartial command. This test will respond to a block process call as defined by the SMBus specification. The one data byte written specifies how many bytes will be sent back in the following read transfer. Note that in this read transfer, the testunit will prefix the length of the bytes to follow. So, if your host bus driver emulates SMBus calls like the majority does, it needs to support the I2C_M_RECV_LEN flag of an i2c_msg. This is a good testcase for it. The returned data consists of the length first, and then of an array of bytes from length-1 to 0. Here is an example which emulates i2c_smbus_block_process_call() using i2ctransfer (you need i2c-tools v4.2 or later)::h]hXPartial command. This test will respond to a block process call as defined by the SMBus specification. The one data byte written specifies how many bytes will be sent back in the following read transfer. Note that in this read transfer, the testunit will prefix the length of the bytes to follow. So, if your host bus driver emulates SMBus calls like the majority does, it needs to support the I2C_M_RECV_LEN flag of an i2c_msg. This is a good testcase for it. The returned data consists of the length first, and then of an array of bytes from length-1 to 0. Here is an example which emulates i2c_smbus_block_process_call() using i2ctransfer (you need i2c-tools v4.2 or later):}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjUhhubj)}(h{# i2ctransfer -y 0 w3@0x30 3 1 0x10 r? 0x10 0x0f 0x0e 0x0d 0x0c 0x0b 0x0a 0x09 0x08 0x07 0x06 0x05 0x04 0x03 0x02 0x01 0x00h]h{# i2ctransfer -y 0 w3@0x30 3 1 0x10 r? 0x10 0x0f 0x0e 0x0d 0x0c 0x0b 0x0a 0x09 0x08 0x07 0x06 0x05 0x04 0x03 0x02 0x01 0x00}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjUhhubeh}(h]x03-smbus-block-proc-callah ]h"]0x03 smbus_block_proc_callah$]h&]uh1hhjphhhhhKzubh)}(hhh](h)}(h0x04 GET_VERSION_WITH_REP_STARTh]h0x04 GET_VERSION_WITH_REP_START}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjb)}(hhh]jg)}(hhh](jl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCMDh]hCMD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATALh]hDATAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDATAHh]hDATAH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hDELAYh]hDELAY}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj#ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]j)}(hhh](j)}(hhh]h)}(h0x04h]h0x04}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjLubah}(h]h ]h"]h$]h&]uh1jhjIubj)}(hhh]h)}(hcurrently unusedh]hcurrently unused}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubah}(h]h ]h"]h$]h&]uh1jhjIubj)}(hhh]h)}(hcurrently unusedh]hcurrently unused}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjzubah}(h]h ]h"]h$]h&]uh1jhjIubj)}(hhh]h)}(hleave out, partial command!h]hleave out, partial command!}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjIubeh}(h]h ]h"]h$]h&]uh1jhjFubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]colsKuh1jfhjubah}(h]h ]h"]h$]h&]uh1jahjhhhNhNubh)}(hXPartial command. After sending this command, the testunit will reply to a read message with a NUL terminated version string based on UTS_RELEASE. The first character is always a 'v' and the length of the version string is at maximum 128 bytes. However, it will only respond if the read message is connected to the write message via repeated start. If your controller driver handles repeated start correctly, this will work::h]hXPartial command. After sending this command, the testunit will reply to a read message with a NUL terminated version string based on UTS_RELEASE. The first character is always a ‘v’ and the length of the version string is at maximum 128 bytes. However, it will only respond if the read message is connected to the write message via repeated start. If your controller driver handles repeated start correctly, this will work:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hy# i2ctransfer -y 0 w3@0x30 4 0 0 r128 0x76 0x36 0x2e 0x31 0x31 0x2e 0x30 0x2d 0x72 0x63 0x31 0x2d 0x30 0x30 0x30 0x30 ...h]hy# i2ctransfer -y 0 w3@0x30 4 0 0 r128 0x76 0x36 0x2e 0x31 0x31 0x2e 0x30 0x2d 0x72 0x63 0x31 0x2d 0x30 0x30 0x30 0x30 ...}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hKIf you have i2c-tools 4.4 or later, you can print out the data right away::h]hJIf you have i2c-tools 4.4 or later, you can print out the data right away:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hH# i2ctransfer -y -b 0 w3@0x30 4 0 0 r128 v6.11.0-rc1-00009-gd37a1b4d3fd0h]hH# i2ctransfer -y -b 0 w3@0x30 4 0 0 r128 v6.11.0-rc1-00009-gd37a1b4d3fd0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hSTOP/START combinations between the two messages will *not* work because they are not equivalent to a REPEATED START. As an example, this returns just the default response::h](h6STOP/START combinations between the two messages will }(hjhhhNhNubhemphasis)}(h*not*h]hnot}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hjubhq work because they are not equivalent to a REPEATED START. As an example, this returns just the default response:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h1# i2cset -y 0 0x30 4 0 0 i; i2cget -y 0 0x30 0x00h]h1# i2cset -y 0 0x30 4 0 0 i; i2cget -y 0 0x30 0x00}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubeh}(h]x04-get-version-with-rep-startah ]h"]0x04 get_version_with_rep_startah$]h&]uh1hhjphhhhhKubh)}(hhh](h)}(h0x05 SMBUS_ALERT_REQUESTh]h0x05 SMBUS_ALERT_REQUEST}(hj4 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj1 hhhhhKubjb)}(hhh]jg)}(hhh](jl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjE ubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjE ubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjE ubjl)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jkhjE ubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCMDh]hCMD}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjr ubah}(h]h ]h"]h$]h&]uh1jhjo ubj)}(hhh]h)}(hDATALh]hDATAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjo ubj)}(hhh]h)}(hDATAHh]hDATAH}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjo ubj)}(hhh]h)}(hDELAYh]hDELAY}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjo ubeh}(h]h ]h"]h$]h&]uh1jhjl ubah}(h]h ]h"]h$]h&]uh1jhjE ubj)}(hhh]j)}(hhh](j)}(hhh]h)}(h0x05h]h0x05}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubj)}(hhh]h)}(h2response value (7 MSBs interpreted as I2C address)h]h2response value (7 MSBs interpreted as I2C address)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubj)}(hhh]h)}(hcurrently unusedh]hcurrently unused}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubj)}(hhh]h)}(hn * 10msh]hn * 10ms}(hj( hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj% ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhjE ubeh}(h]h ]h"]h$]h&]colsKuh1jfhjB ubah}(h]h ]h"]h$]h&]uh1jahj1 hhhNhNubh)}(hX<This test raises an interrupt via the SMBAlert pin which the host controller must handle. The pin must be connected to the testunit as a GPIO. GPIO access is not allowed to sleep. Currently, this can only be described using firmware nodes. So, for devicetree, you would add something like this to the testunit node::h]hX;This test raises an interrupt via the SMBAlert pin which the host controller must handle. The pin must be connected to the testunit as a GPIO. GPIO access is not allowed to sleep. Currently, this can only be described using firmware nodes. So, for devicetree, you would add something like this to the testunit node:}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 hhubj)}(h$gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;h]h$gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;}hjc sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj1 hhubh)}(h^The following command will trigger the alert with a response of 0xc9 after 1 second of delay::h]h]The following command will trigger the alert with a response of 0xc9 after 1 second of delay:}(hjq hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 hhubj)}(h$# i2cset -y 0 0x30 5 0xc9 0x00 100 ih]h$# i2cset -y 0 0x30 5 0xc9 0x00 100 i}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj1 hhubh)}(hYIf the host controller supports SMBusAlert, this message with debug level should appear::h]hXIf the host controller supports SMBusAlert, this message with debug level should appear:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 hhubj)}(h3smbus_alert 0-000c: SMBALERT# from dev 0x64, flag 1h]h3smbus_alert 0-000c: SMBALERT# from dev 0x64, flag 1}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj1 hhubh)}(hThis message may appear more than once because the testunit is software not hardware and, thus, may not be able to react to the response of the host fast enough. The interrupt count should increase only by one, though::h]hThis message may appear more than once because the testunit is software not hardware and, thus, may not be able to react to the response of the host fast enough. The interrupt count should increase only by one, though:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 hhubj)}(h^# cat /proc/interrupts | grep smbus_alert 93: 1 gpio-rcar 26 Edge smbus_alerth]h^# cat /proc/interrupts | grep smbus_alert 93: 1 gpio-rcar 26 Edge smbus_alert}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj1 hhubh)}(hzIf the host does not respond to the alert within 1 second, the test will be aborted and the testunit will report an error.h]hzIf the host does not respond to the alert within 1 second, the test will be aborted and the testunit will report an error.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 hhubh)}(hFor this test, the testunit will shortly drop its assigned address and listen on the SMBus Alert Response Address (0x0c). It will reassign its original address afterwards.h]hFor this test, the testunit will shortly drop its assigned address and listen on the SMBus Alert Response Address (0x0c). It will reassign its original address afterwards.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 hhubeh}(h]x05-smbus-alert-requestah ]h"]0x05 smbus_alert_requestah$]h&]uh1hhjphhhhhKubeh}(h]commandsah ]h"]commandsah$]h&]uh1hhhhhhhhK?ubeh}(h] linux-i2c-slave-testunit-backendah ]h"] linux i2c slave testunit backendah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j j j jjjjjRjOjjj. j+ j j u nametypes}(j j jjjRjj. j uh}(j hj jpjjjjjOjjjUj+ jj j1 u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.