diff options
author | Frederic Barrat <fbarrat@linux.ibm.com> | 2019-03-12 21:35:15 +0100 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-03-13 21:55:18 -0500 |
commit | 998911498597f3a057d73f7c78c075d830d22731 (patch) | |
tree | 3a3e9ff0c0ceebba5d6325541010bb2fc815737a /hw/npu2-common.c | |
parent | d75436f0d3d0f4b8ecdb28fb2f08dd34d2119c24 (diff) | |
download | skiboot-998911498597f3a057d73f7c78c075d830d22731.zip skiboot-998911498597f3a057d73f7c78c075d830d22731.tar.gz skiboot-998911498597f3a057d73f7c78c075d830d22731.tar.bz2 |
npu2-opencapi: Fix adapter reset when using 2 adapters
If two opencapi adapters are on the same obus, we may try to train the
two links in parallel at boot time, when all the PCI links are being
trained. Both links use the same i2c controller to handle the reset
signal, so some care is needed to make sure resetting one doesn't
interfere with the reset of the other. We need to keep track of the
current state of the i2c controller (and use locking).
This went mostly unnoticed as you need to have 2 opencapi cards on the
same socket and links tended to train anyway because of the retries.
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/npu2-common.c')
-rw-r--r-- | hw/npu2-common.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/npu2-common.c b/hw/npu2-common.c index ec69953..3d0b636 100644 --- a/hw/npu2-common.c +++ b/hw/npu2-common.c @@ -182,6 +182,9 @@ static struct npu2 *setup_npu(struct dt_node *dn) npu->xscom_base = dt_get_address(dn, 0, NULL); npu->phb_index = dt_prop_get_u32(dn, "ibm,phb-index"); + init_lock(&npu->i2c_lock); + npu->i2c_pin_mode = ~0; // input mode by default + npu->i2c_pin_wr_state = ~0; // reset is active low if (platform.ocapi) { /* Find I2C port for handling device presence/reset */ snprintf(port_name, sizeof(port_name), "p8_%08x_e%dp%d", |