diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-11-07 16:16:31 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-11-07 16:16:31 +1100 |
commit | 2b6b701f1dd15a4f0e39d51d048b90ea729ecc75 (patch) | |
tree | ef0179308240cb519c79309169adf85cde03ffab /include | |
parent | cd3ff93ad228c25330878db021ec30ca97638e2d (diff) | |
download | skiboot-2b6b701f1dd15a4f0e39d51d048b90ea729ecc75.zip skiboot-2b6b701f1dd15a4f0e39d51d048b90ea729ecc75.tar.gz skiboot-2b6b701f1dd15a4f0e39d51d048b90ea729ecc75.tar.bz2 |
i2c: Rework P8 i2c driver
This updates the i2c driver significantly, using a simpler state machine,
using the new timer for timeouts, and fixing a number of issues. I also
changed the Linux interface so I've changed the token number since some
builds have been done with the old code already.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/i2c.h | 3 | ||||
-rw-r--r-- | include/opal.h | 23 |
2 files changed, 23 insertions, 3 deletions
diff --git a/include/i2c.h b/include/i2c.h index 921a9dd..af88ba0 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -25,11 +25,12 @@ struct i2c_bus { int (*queue_req)(struct i2c_bus *bus, struct i2c_request *req); struct i2c_request *(*alloc_req)(struct i2c_bus *bus); - void (*dealloc_req)(struct i2c_request *req); + void (*free_req)(struct i2c_request *req); }; struct i2c_request { struct list_node link; + struct i2c_bus *bus; enum i2c_operation { I2C_READ, /* RAW read from the device without offset */ I2C_WRITE, /* RAW write to the device without offset */ diff --git a/include/opal.h b/include/opal.h index 730aee7..8d37d9d 100644 --- a/include/opal.h +++ b/include/opal.h @@ -142,10 +142,11 @@ #define OPAL_WRITE_TPO 103 #define OPAL_READ_TPO 104 #define OPAL_GET_DPO_STATUS 105 -#define OPAL_I2C_REQUEST 106 +#define OPAL_OLD_I2C_REQUEST 106 /* Deprecated */ #define OPAL_IPMI_SEND 107 #define OPAL_IPMI_RECV 108 -#define OPAL_LAST 108 +#define OPAL_I2C_REQUEST 109 +#define OPAL_LAST 109 #ifndef __ASSEMBLY__ @@ -890,6 +891,24 @@ enum { #define OPAL_PHB_CAPI_FLAG_SNOOP_CONTROL 0x00000001 #define OPAL_PHB_CAPI_FLAG_REVERT_TO_PCIE 0x00000002 +/* OPAL I2C request */ +struct opal_i2c_request { + uint8_t type; +#define OPAL_I2C_RAW_READ 0 +#define OPAL_I2C_RAW_WRITE 1 +#define OPAL_I2C_SM_READ 2 +#define OPAL_I2C_SM_WRITE 3 + uint8_t flags; +#define OPAL_I2C_ADDR_10 0x01 /* Not supported yet */ + uint8_t subaddr_sz; /* Max 4 */ + uint8_t reserved; + uint16_t addr; /* 7 or 10 bit address */ + uint16_t reserved2; + uint32_t subaddr; /* Sub-address if any */ + uint32_t size; /* Data size */ + uint64_t buffer_ra; /* Buffer real address */ +}; + /****** Internal **********/ #include <skiboot.h> |