aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-11-10 13:50:36 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-14 00:43:21 -0600
commit0cc1fe4e23308fc4f4002c74b475475e96fedcb9 (patch)
treec45728089722346490c1ff6245493a8162fa4a7f
parentb239ebf0ef9b9af79593db18029080565139a426 (diff)
downloadskiboot-0cc1fe4e23308fc4f4002c74b475475e96fedcb9.zip
skiboot-0cc1fe4e23308fc4f4002c74b475475e96fedcb9.tar.gz
skiboot-0cc1fe4e23308fc4f4002c74b475475e96fedcb9.tar.bz2
p8-i2c: Don't write the watermark register at init
On P9 the I2C master is shared with the OCC. Currently the watermark values are set once at init time which is bad for two reasons: a) We don't take the OCC master lock before setting it. Which may cause issues if the OCC is currently using the master. b) The OCC might change the watermark levels and we need to reset them. Change this so that we set the watermark value when a new transaction is started rather than at init time. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> (cherry picked from commit d0f06269ed3cd3e09a9b04c5f70cb3d53a77a689) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/p8-i2c.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index ce56b26..ec2f7fc 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1223,6 +1223,14 @@ static int p8_i2c_start_request(struct p8_i2c_master *master,
if (rc)
return rc;
+ /* program the watermark register */
+ rc = p8_i2c_prog_watermark(master);
+ if (rc) {
+ log_simple_error(&e_info(OPAL_RC_I2C_INIT),
+ "I2C: Failed to program the WATERMARK_REG\n");
+ return rc;
+ }
+
/* Initialize bytes_sent */
master->bytes_sent = 0;
@@ -1680,22 +1688,10 @@ static void p8_i2c_init_one(struct dt_node *i2cm, enum p8_i2c_master_type type)
master->irq_ok ? "" : "non-");
}
- /* Program the watermark register */
- rc = p8_i2c_prog_watermark(master);
-
/* Re-enable the sensor cache, we aren't touching HW anymore */
if (master->type == I2C_CENTAUR)
centaur_enable_sensor_cache(master->chip_id);
- /* Handle errors from p8_i2c_prog_watermark */
- if (rc) {
- log_simple_error(&e_info(OPAL_RC_I2C_INIT),
- "I2C: Failed to program the "
- "WATERMARK_REG\n");
- free(master);
- return;
- }
-
/* Allocate ports driven by this master */
count = 0;
dt_for_each_child(i2cm, i2cm_port)