diff mbox series

[06/10] hw/p8-i2c: Print interrupt status per master

Message ID 20201012025314.1070230-6-oohall@gmail.com
State New
Headers show
Series [01/10] external/trace: Fall back to read() | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (f901fcafae14d38e29f1cc11440086ee678785d0)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot fail Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran Oct. 12, 2020, 2:53 a.m. UTC
Whether I2C interrupts work or not depends on the type of master.
Currently we print a single message to indicate whether IRQs work or
not, but this will be wrong if we have I2C interrupts on the host and
we happen to probe a Centaur I2C master first. Fix this by adding a
message to the per-master print indicating whether the master has
an interrupt or not.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hw/p8-i2c.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 60bea868fda2..78f1e7e32932 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1447,7 +1447,6 @@  static void p8_i2c_init_one(struct dt_node *i2cm, enum p8_i2c_master_type type)
 	struct p8_i2c_master *master;
 	struct list_head *chip_list;
 	uint64_t ex_stat, default_timeout;
-	static bool irq_printed;
 	int64_t rc;
 
 	master = zalloc(sizeof(*master));
@@ -1496,8 +1495,11 @@  static void p8_i2c_init_one(struct dt_node *i2cm, enum p8_i2c_master_type type)
 	init_timer(&master->recovery, p8_i2c_recover, master);
 	init_timer(&master->sensor_cache, p8_i2c_enable_scache, master);
 
-	prlog(PR_INFO, "I2C: Chip %08x Eng. %d Clock %d Mhz\n",
-	      master->chip_id, master->engine_id, lb_freq / 1000000);
+	master->irq_ok = p8_i2c_has_irqs(master);
+
+	prlog(PR_INFO, "I2C: Chip %08x Eng. %d Clock %d Mhz %s\n",
+	      master->chip_id, master->engine_id, lb_freq / 1000000,
+	      master->irq_ok ? "" : "(no interrupt)");
 
 	/* Disable OCC cache during inits */
 	if (master->type == I2C_CENTAUR) {
@@ -1526,14 +1528,6 @@  static void p8_i2c_init_one(struct dt_node *i2cm, enum p8_i2c_master_type type)
 	list_head_init(&master->req_list);
 	list_head_init(&master->ports);
 
-	/* Check if interrupt is usable */
-	master->irq_ok = p8_i2c_has_irqs(master);
-	if (!irq_printed) {
-		irq_printed = true;
-		prlog(PR_INFO, "I2C: Interrupts %sfunctional\n",
-		      master->irq_ok ? "" : "non-");
-	}
-
 	/* Re-enable the sensor cache, we aren't touching HW anymore */
 	if (master->type == I2C_CENTAUR)
 		centaur_enable_sensor_cache(master->chip_id);