summaryrefslogtreecommitdiffstats
path: root/include/hw/i2c
diff options
context:
space:
mode:
authorCorey Minyard2018-08-20 22:26:04 +0200
committerPaolo Bonzini2018-08-23 18:46:25 +0200
commit38ad4fae43b9c57a4ef3111217b110b25dbd3c50 (patch)
treea86604f02e39e2d4ac4c2a56d87aa22a1a2c6eee /include/hw/i2c
parenti2c: pm_smbus: Make the I2C block read command read-only (diff)
downloadqemu-38ad4fae43b9c57a4ef3111217b110b25dbd3c50.tar.gz
qemu-38ad4fae43b9c57a4ef3111217b110b25dbd3c50.tar.xz
qemu-38ad4fae43b9c57a4ef3111217b110b25dbd3c50.zip
i2c: pm_smbus: Add block transfer capability
There was no block transfer code in pm_smbus.c, and it is needed for some devices. So add it. This adds both byte-by-byte block transfers and buffered block transfers. Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1534796770-10295-5-git-send-email-minyard@acm.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/hw/i2c')
-rw-r--r--include/hw/i2c/pm_smbus.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/hw/i2c/pm_smbus.h b/include/hw/i2c/pm_smbus.h
index 2a837afdcb..99d5489e1b 100644
--- a/include/hw/i2c/pm_smbus.h
+++ b/include/hw/i2c/pm_smbus.h
@@ -1,6 +1,8 @@
#ifndef PM_SMBUS_H
#define PM_SMBUS_H
+#define PM_SMBUS_MAX_MSG_SIZE 32
+
typedef struct PMSMBus {
I2CBus *smbus;
MemoryRegion io;
@@ -11,8 +13,22 @@ typedef struct PMSMBus {
uint8_t smb_addr;
uint8_t smb_data0;
uint8_t smb_data1;
- uint8_t smb_data[32];
- uint8_t smb_index;
+ uint8_t smb_data[PM_SMBUS_MAX_MSG_SIZE];
+ uint8_t smb_blkdata;
+ uint8_t smb_auxctl;
+ uint32_t smb_index;
+
+ /* Set by pm_smbus.c */
+ void (*reset)(struct PMSMBus *s);
+
+ /* Set by the user. */
+ bool i2c_enable;
+
+ /* Internally used by pm_smbus. */
+
+ /* Set on block transfers after the last byte has been read, so the
+ INTR bit can be set at the right time. */
+ bool op_done;
} PMSMBus;
void pm_smbus_init(DeviceState *parent, PMSMBus *smb);