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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Jun 25 16:19:25 AEST 2021


From: Oliver O'Halloran <oohall at gmail.com>

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 40d9ae48b..adefa2781 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1446,7 +1446,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));
@@ -1495,8 +1494,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) {
@@ -1525,14 +1527,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.31.1



More information about the Skiboot mailing list