OSDN Git Service

ppc/pnv: Add an I2C controller model
authorCédric Le Goater <clg@kaod.org>
Mon, 16 Oct 2023 22:20:12 +0000 (17:20 -0500)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Tue, 7 Nov 2023 18:49:41 +0000 (15:49 -0300)
commit263b81ee15af05cbb2ad284aadabb0981a19c941
treec0823f27ddc54b0d154eec7ebfba9945413cf2c8
parentf46f8e0f37e0ecf68c7ef516bcd74640223a192e
ppc/pnv: Add an I2C controller model

The more recent IBM power processors have an embedded I2C
controller that is accessible by software via the XSCOM
address space.

Each instance of the I2C controller is capable of controlling
multiple I2C buses (one at a time).  Prior to beginning a
transaction on an I2C bus, the bus must be selected by writing
the port number associated with the bus into the PORT_NUM
field of the MODE register.  Once an I2C bus is selected,
the status of the bus can be determined by reading the
Status and Extended Status registers.

I2C bus transactions can be started by writing a command to
the Command register and reading/writing data from/to the
FIFO register.

Not supported :

 . 10 bit I2C addresses
 . Multimaster
 . Slave

Signed-off-by: Cédric Le Goater <clg@kaod.org>
[milesg: Split wiring to powernv9 into its own commit]
[milesg: Added more detail to commit message]
[milesg: Added SPDX Licensed Identifier to new files]
[milesg: updated copyright dates]
[milesg: Added use of g_autofree]
[milesg: Added NULL check after pnv_i2c_get_bus]
Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
Acked-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-ID: <20231016222013.3739530-2-milesg@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
hw/ppc/meson.build
hw/ppc/pnv_i2c.c [new file with mode: 0644]
include/hw/ppc/pnv_i2c.h [new file with mode: 0644]
include/hw/ppc/pnv_xscom.h