From dda4dde724422c2e8082ffd83d3ea3b3ffb82d06 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 26 Sep 2018 11:19:24 +0800 Subject: LF-191-2 i2c: introduce xen i2c paravirtualization driver Add i2c backend frontend support. The transaction only support one msg each time. The frontend sends a request to backend, backend use i2c_transfer to do real transaction to hardware and return the results to frontend. Now i2cdump/get/set works. In domu cfg file, use "vi2c = ['backend=0,be-adapter=5a800000.i2c,addr=0x51;0x44']" to create a dummy controller in frontend and allowed slaves in backend. Currently the slave address check not added, it will be supported in furture patch. Signed-off-by: Peng Fan Acked-by: Leonard Crestez --- include/xen/interface/io/i2cif.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/xen') diff --git a/include/xen/interface/io/i2cif.h b/include/xen/interface/io/i2cif.h index b9542722f77d..c504670429d0 100644 --- a/include/xen/interface/io/i2cif.h +++ b/include/xen/interface/io/i2cif.h @@ -32,7 +32,7 @@ #include #include -#define I2CIF_BUF_LEN 32 +#define I2CIF_BUF_LEN I2C_SMBUS_BLOCK_MAX + 2 #define I2CIF_MAX_MSG 2 #define I2CIF_M_RD 0x0001 /* read data, from slave to master */ @@ -76,6 +76,13 @@ struct i2cif_request { } msg[I2CIF_MAX_MSG]; int num_msg; __u8 write_buf[I2CIF_BUF_LEN]; + + bool is_smbus; + __u16 addr; + __u16 flags; + __u8 read_write; + __u8 command; + int protocol; }; struct i2cif_response { -- cgit v1.2.3