smbus: do not immediately complete commands
commit880b1ffe6ec2f0ae25cc4175716227ad275e8b8a
authorHervé Poussineau <hpoussin@reactos.org>
Sun, 10 Dec 2017 17:27:03 +0000 (10 18:27 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 21 Dec 2017 23:42:03 +0000 (22 01:42 +0200)
treeeb0c9904e1f09b56e0c556cf7518716f7c1f4fb6
parentbcfdacfe2f56647d07a0093c415d43d33ee954b2
smbus: do not immediately complete commands

PIIX4 errata says that "immediate polling of the Host Status Register BUSY
bit may indicate that the SMBus is NOT busy."
Due to this, some code does the following steps:
(a) set parameters
(b) start command
(c) check for smbus busy bit set (to know that command started)
(d) check for smbus busy bit not set (to know that command finished)

Let (c) happen, by immediately setting the busy bit, and really executing
the command when status register has been read once.

This fixes a problem with AMIBIOS, which can now properly initialize the PIIX4.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/i2c/pm_smbus.c