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

Oliver O'Halloran oohall at gmail.com
Mon Oct 12 13:53:10 AEDT 2020


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 at gmail.com>
---
 hw/p8-i2c.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

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);
-- 
2.26.2



More information about the Skiboot mailing list