aboutsummaryrefslogtreecommitdiff
path: root/hw/p8-i2c.c
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-13 23:46:52 -0600
commitd0f06269ed3cd3e09a9b04c5f70cb3d53a77a689 (patch)
treed09ec3de9eca74e05a92ce3c0403291a72820663 /hw/p8-i2c.c
parent560eb231d6bf36442cb467b6d63e2c5342c34dd8 (diff)
downloadskiboot-d0f06269ed3cd3e09a9b04c5f70cb3d53a77a689.zip
skiboot-d0f06269ed3cd3e09a9b04c5f70cb3d53a77a689.tar.gz
skiboot-d0f06269ed3cd3e09a9b04c5f70cb3d53a77a689.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>
Diffstat (limited to 'hw/p8-i2c.c')
-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)