diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2016-06-10 15:03:30 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-06-14 16:00:15 +1000 |
commit | 5808b75d08d7936d19923045b7f35c0e8ae75755 (patch) | |
tree | d986aea3809d91037ee811f05247573b3b25190a /include | |
parent | e6b2e38abb906023c1ef3631b21ad00d26fc0b5f (diff) | |
download | skiboot-5808b75d08d7936d19923045b7f35c0e8ae75755.zip skiboot-5808b75d08d7936d19923045b7f35c0e8ae75755.tar.gz skiboot-5808b75d08d7936d19923045b7f35c0e8ae75755.tar.bz2 |
hw/p8-i2c: Allow to set I2C request timeout
Prior to PCI enumeration, the PHB slot's power state might be changed
during fundamental reset. The fundamental reset is implemented by state
machine and it's driven by a polling mechanism in predetermined interval
(A). On the other hand, PCI slot's power supply is controlled by I2C
chip on Firenze platform. It means the PCI slot's power supply state is
changed through I2C request which has a timeout timer running in variable
interval (B).
Comparing to (A), (B) is small and short. That means I2C timeout is reached
before first poll running in interval of (A). It's unexpected behaviour.
This allows to set I2C request timeout ((B)) to avoid the issue.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/i2c.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h index dea0644..83c6ec5 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -26,6 +26,8 @@ struct i2c_bus { int (*queue_req)(struct i2c_request *req); struct i2c_request *(*alloc_req)(struct i2c_bus *bus); void (*free_req)(struct i2c_request *req); + void (*set_req_timeout)(struct i2c_request *req, + uint64_t duration); }; /* @@ -80,6 +82,13 @@ static inline int i2c_queue_req(struct i2c_request *req) return req->bus->queue_req(req); } +static inline void i2c_set_req_timeout(struct i2c_request *req, + uint64_t duration) +{ + if (req->bus->set_req_timeout) + req->bus->set_req_timeout(req, duration); +} + /* P8 implementation details */ extern void p8_i2c_init(void); extern void p8_i2c_interrupt(uint32_t chip_id); |