<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bwlp/qemu.git/include/hw/i2c, branch spice_video_codecs</title>
<subtitle>Experimental fork of QEMU with video encoding patches</subtitle>
<id>https://git.openslx.org/bwlp/qemu.git/atom/include/hw/i2c?h=spice_video_codecs</id>
<link rel='self' href='https://git.openslx.org/bwlp/qemu.git/atom/include/hw/i2c?h=spice_video_codecs'/>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/'/>
<updated>2022-10-24T09:20:15+00:00</updated>
<entry>
<title>hw/i2c/aspeed: Fix old reg slave receive</title>
<updated>2022-10-24T09:20:15+00:00</updated>
<author>
<name>Peter Delevoryas</name>
</author>
<published>2022-10-24T09:20:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=3648d31fa81c4a391b8cd74e9fcd410a74f72383'/>
<id>urn:sha1:3648d31fa81c4a391b8cd74e9fcd410a74f72383</id>
<content type='text'>
I think when Klaus ported his slave mode changes from the original patch
series to the rewritten I2C module, he changed the behavior of the first
byte that is received by the slave device.

What's supposed to happen is that the AspeedI2CBus's slave device's
i2c_event callback should run, and if the event is "send_async", then it
should populate the byte buffer with the 8-bit I2C address that is being
sent to. Since we only support "send_async", the lowest bit should
always be 0 (indicating that the master is requesting to send data).

This is the code Klaus had previously, for reference. [1]

    switch (event) {
    case I2C_START_SEND:
        bus-&gt;buf = bus-&gt;dev_addr &lt;&lt; 1;

        bus-&gt;buf &amp;= I2CD_BYTE_BUF_RX_MASK;
        bus-&gt;buf &lt;&lt;= I2CD_BYTE_BUF_RX_SHIFT;

        bus-&gt;intr_status |= (I2CD_INTR_SLAVE_ADDR_RX_MATCH | I2CD_INTR_RX_DONE);
        aspeed_i2c_set_state(bus, I2CD_STXD);

        break;

[1]: https://lore.kernel.org/qemu-devel/20220331165737.1073520-4-its@irrelevant.dk/

Fixes: a8d48f59cd021b25 ("hw/i2c/aspeed: add slave device in old register mode")
Signed-off-by: Peter Delevoryas &lt;peter@pjd.dev&gt;
Reviewed-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
Message-Id: &lt;20220820225712.713209-2-peter@pjd.dev&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>hw/i2c/pmbus: Add idle state to return 0xff's</title>
<updated>2022-07-14T14:24:38+00:00</updated>
<author>
<name>Peter Delevoryas</name>
</author>
<published>2022-07-14T14:24:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=d272d1410c91f399af15ef9ae4b561bc621de115'/>
<id>urn:sha1:d272d1410c91f399af15ef9ae4b561bc621de115</id>
<content type='text'>
Signed-off-by: Peter Delevoryas &lt;pdel@fb.com&gt;
Reviewed-by: Titus Rwantare &lt;titusr@google.com&gt;
Message-Id: &lt;20220701000626.77395-2-me@pjd.dev&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>hw/i2c/aspeed: Add new-registers DMA slave mode RX support</title>
<updated>2022-06-30T07:21:14+00:00</updated>
<author>
<name>Peter Delevoryas</name>
</author>
<published>2022-06-30T07:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=1c5d909f882ebd666224e3e1338a87616ebce4ed'/>
<id>urn:sha1:1c5d909f882ebd666224e3e1338a87616ebce4ed</id>
<content type='text'>
This commit adds support for DMA RX in slave mode while using the new
register set in the AST2600 and AST1030. This patch also pretty much
assumes packet mode is enabled, I'm not sure if this will work in DMA
step mode.

This is particularly useful for testing IPMB exchanges between Zephyr
and external devices, which requires multi-master I2C support and DMA in
the new register mode, because the Zephyr drivers from Aspeed use DMA in
the new mode by default. The Zephyr drivers are also using packet mode.

The typical sequence of events for receiving data in DMA slave + packet
mode is that the Zephyr firmware will configure the slave address
register with an address to receive on and configure the bus's function
control register to enable master mode and slave mode simultaneously at
startup, before any transfers are initiated.

RX DMA is enabled in the slave mode command register, and the slave RX
DMA buffer address and slave RX DMA buffer length are set. TX DMA is not
covered in this patch.

When the Aspeed I2C controller receives data from some other I2C master,
it will reset the I2CS_DMA_LEN RX_LEN value to zero, then buffer
incoming data in the RX DMA buffer while incrementing the I2CC_DMA_ADDR
address counter and decrementing the I2CC_DMA_LEN counter. It will also
update the I2CS_DMA_LEN RX_LEN value along the way.

Once all the data has been received, the bus controller will raise an
interrupt indicating a packet command was completed, the slave address
matched, a normal stop condition was seen, and the transfer was an RX
operation.

If the master sent a NACK instead of a normal stop condition, or the
transfer timed out, then a slightly different set of interrupt status
values would be set. Those conditions are not handled in this commit.

The Zephyr firmware then collects data from the RX DMA buffer and clears
the status register by writing the PKT_MODE_EN bit to the status
register. In packet mode, clearing the packet mode interrupt enable bit
also clears most of the other interrupt bits automatically (except for a
few bits above it).

Note: if the master transmit or receive functions were in use
simultaneously with the slave mode receive functionality, then the
master mode functions may have raised the interrupt line for the bus
before the DMA slave transfer is complete. It's important to have the
slave's interrupt status register clear throughout the receive
operation, and if the slave attempts to raise the interrupt before the
master interrupt status is cleared, then it needs to re-raise the
interrupt once the master interrupt status is cleared. (And vice-versa).
That's why in this commit, when the master interrupt status is cleared
and the interrupt line is lowered, we call the slave interrupt _raise_
function, to see if the interrupt was pending. (And again, vice-versa).

Signed-off-by: Peter Delevoryas &lt;pdel@fb.com&gt;
Message-Id: &lt;20220630045133.32251-8-me@pjd.dev&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>hw/i2c/aspeed: add slave device in old register mode</title>
<updated>2022-06-30T07:21:14+00:00</updated>
<author>
<name>Klaus Jensen</name>
</author>
<published>2022-06-30T07:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=a8d48f59cd021b25359cc48cb8a897de7802f422'/>
<id>urn:sha1:a8d48f59cd021b25359cc48cb8a897de7802f422</id>
<content type='text'>
Add slave mode functionality for the Aspeed I2C controller in old
register mode. This is implemented by realizing an I2C slave device
owned by the I2C controller and attached to its own bus.

The I2C slave device only implements asynchronous sends on the bus, so
slaves not supporting that will not be able to communicate with it.

Signed-off-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
[ clg: checkpatch fixes ]
Message-Id: &lt;20220601210831.67259-6-its@irrelevant.dk&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
Message-Id: &lt;20220630045133.32251-7-me@pjd.dev&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>hw/i2c: add asynchronous send</title>
<updated>2022-06-30T07:21:14+00:00</updated>
<author>
<name>Klaus Jensen</name>
</author>
<published>2022-06-30T07:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=a78e9839ae5eb0b95d9db8dd672e2977d2831605'/>
<id>urn:sha1:a78e9839ae5eb0b95d9db8dd672e2977d2831605</id>
<content type='text'>
Add an asynchronous version of i2c_send() that requires the slave to
explicitly acknowledge on the bus with i2c_ack().

The current master must use the new i2c_start_send_async() to indicate
that it wants to do an asynchronous transfer. This allows the i2c core
to check if the target slave supports this or not. This approach relies
on adding a new enum i2c_event member, which is why a bunch of other
devices needs changes in their event handling switches.

Signed-off-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
Message-Id: &lt;20220601210831.67259-5-its@irrelevant.dk&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
Message-Id: &lt;20220630045133.32251-6-me@pjd.dev&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>hw/i2c: support multiple masters</title>
<updated>2022-06-30T07:21:14+00:00</updated>
<author>
<name>Klaus Jensen</name>
</author>
<published>2022-06-30T07:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=37fa5ca42623ef08ac99c8d927b6a3af0c76dc7b'/>
<id>urn:sha1:37fa5ca42623ef08ac99c8d927b6a3af0c76dc7b</id>
<content type='text'>
Allow slaves to master the bus by registering a bottom halve. If the bus
is busy, the bottom half is queued up. When a slave has succesfully
mastered the bus, the bottom half is scheduled.

Signed-off-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
[ clg : - fixed typos in commit log ]
Message-Id: &lt;20220601210831.67259-4-its@irrelevant.dk&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
Message-Id: &lt;20220630045133.32251-5-me@pjd.dev&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>hw/i2c/aspeed: add DEV_ADDR in old register mode</title>
<updated>2022-06-22T07:49:34+00:00</updated>
<author>
<name>Klaus Jensen</name>
</author>
<published>2022-06-13T12:05:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=d72a712ce038df621c227c0843354c553fe91b8a'/>
<id>urn:sha1:d72a712ce038df621c227c0843354c553fe91b8a</id>
<content type='text'>
Add support for writing and reading the device address register in old
register mode.

On the AST2400 (only 1 slave address)

  * no upper bits

On the AST2500 (2 possible slave addresses),

  * bit[31] : Slave Address match indicator
  * bit[30] : Slave Address Receiving pending

On the AST2600 (3 possible slave addresses),

  * bit[31-30] : Slave Address match indicator
  * bit[29] : Slave Address Receiving pending

The model could be more precise to take into account all fields but
since the Linux driver is masking the register value being set, it
should be fine. See commit 3fb2e2aeafb2 ("i2c: aspeed: disable
additional device addresses on ast2[56]xx") from Zeiv. This can be
addressed later.

Signed-off-by: Klaus Jensen &lt;k.jensen@samsung.com&gt;
[ clg: add details to commit log ]
Message-Id: &lt;20220601210831.67259-3-its@irrelevant.dk&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>aspeed/i2c: Add ast1030 controller models</title>
<updated>2022-06-22T07:49:34+00:00</updated>
<author>
<name>Cédric Le Goater</name>
</author>
<published>2022-06-13T12:05:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=b35802ce318572cbe4d26bbffb3d133e81871c6c'/>
<id>urn:sha1:b35802ce318572cbe4d26bbffb3d133e81871c6c</id>
<content type='text'>
Based on :

  https://lore.kernel.org/qemu-devel/20220324100439.478317-2-troy_lee@aspeedtech.com/

Cc: Troy Lee &lt;troy_lee@aspeedtech.com&gt;
Cc: Jamin Lin &lt;jamin_lin@aspeedtech.com&gt;
Cc: Steven Lee &lt;steven_lee@aspeedtech.com&gt;
Reviewed-by: Joel Stanley &lt;joel@jms.id.au&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>aspeed: i2c: Move regs and helpers to header file</title>
<updated>2022-06-22T07:49:34+00:00</updated>
<author>
<name>Joe Komlodi</name>
</author>
<published>2022-06-13T12:05:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=e532cd0485dc4dc0983d4cc95083c592223c02c0'/>
<id>urn:sha1:e532cd0485dc4dc0983d4cc95083c592223c02c0</id>
<content type='text'>
Moves register definitions and short commonly used inlined functiosn to
the header file to help tidy up the implementation file.

Signed-off-by: Joe Komlodi &lt;komlodi@google.com&gt;
Change-Id: I34dff7485b6bbe3c9482715ccd94dbd65dc5f324
Message-Id: &lt;20220331043248.2237838-8-komlodi@google.com&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
<entry>
<title>aspeed: i2c: Add new mode support</title>
<updated>2022-06-22T07:49:34+00:00</updated>
<author>
<name>Joe Komlodi</name>
</author>
<published>2022-06-13T12:05:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=ba2cccd64e90f342673e3916dd1c0a8911813903'/>
<id>urn:sha1:ba2cccd64e90f342673e3916dd1c0a8911813903</id>
<content type='text'>
On AST2600, I2C has a secondary mode, called "new mode", which changes
the layout of registers, adds some minor behavior changes, and
introduces a new way to transfer data called "packet mode".

Most of the bit positions of the fields are the same between old and new
mode, so we use SHARED_FIELD_XX macros to reuse most of the code between
the different modes.

For packet mode, most of the command behavior is the same compared to
other modes, but there are some minor changes to how interrupts are
handled compared to other modes.

Signed-off-by: Joe Komlodi &lt;komlodi@google.com&gt;
Change-Id: I072f8301964f623afc74af1fe50c12e5caef199e
Message-Id: &lt;20220331043248.2237838-6-komlodi@google.com&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
</feed>
