Skip to content

Commit

Permalink
LF-191-2 i2c: introduce xen i2c paravirtualization driver
Browse files Browse the repository at this point in the history
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 <peng.fan@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
  • Loading branch information
MrVan authored and Dong Aisheng committed Nov 2, 2021
1 parent a20c9c9 commit 278ca91
Show file tree
Hide file tree
Showing 5 changed files with 1,023 additions and 1 deletion.
20 changes: 20 additions & 0 deletions drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1404,4 +1404,24 @@ config I2C_VIRTIO
This driver can also be built as a module. If so, the module
will be called i2c-virtio.

config XEN_I2C_FRONTEND
tristate "Xen virtual i2c device support"
depends on XEN
default y
select XEN_XENBUS_FRONTEND
help
This driver implements the front-end of the Xen virtual
i2c device driver. It communicates with a back-end driver
in another domain which drives the actual i2c device.

config XEN_I2C_BACKEND
tristate "Xen i2c-device backend driver"
depends on XEN_BACKEND
help
The i2c-device backend driver allows the kernel to export its
block devices to other guests.

The corresponding Linux frontend driver is enabled by the
CONFIG_XEN_I2C_FRONTEND configuration option.

endmenu
3 changes: 3 additions & 0 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,7 @@ obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
obj-$(CONFIG_I2C_FSI) += i2c-fsi.o
obj-$(CONFIG_I2C_VIRTIO) += i2c-virtio.o

obj-$(CONFIG_XEN_I2C_FRONTEND) += xen-i2cfront.o
obj-$(CONFIG_XEN_I2C_BACKEND) += xen-i2cback.o

ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG

0 comments on commit 278ca91

Please sign in to comment.