aboutsummaryrefslogtreecommitdiff
path: root/hw/p8-i2c.c
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2019-12-03 16:46:17 +1100
committerOliver O'Halloran <oohall@gmail.com>2019-12-04 14:19:37 +1100
commit8b3012e1aa670af09ddd2d378978b3862314c36d (patch)
tree830d966e7eb9cf7da251a910b57d7244df2e7a06 /hw/p8-i2c.c
parent08cd61e9d078419af6ef96ad7e626ae4ed5de9b6 (diff)
downloadskiboot-8b3012e1aa670af09ddd2d378978b3862314c36d.zip
skiboot-8b3012e1aa670af09ddd2d378978b3862314c36d.tar.gz
skiboot-8b3012e1aa670af09ddd2d378978b3862314c36d.tar.bz2
hw/p8-i2c: Don't print warnings when dumping registers
There's not much point complaining if we can't collect debug data. Log a obviously-wrong value and continue. Also convert to using i2cm_read_reg() rather than xscom_read() directly while we're here. Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'hw/p8-i2c.c')
-rw-r--r--hw/p8-i2c.c52
1 files changed, 10 insertions, 42 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 1b28062..990dfca 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -237,7 +237,6 @@ static void p8_i2c_print_debug_info(struct p8_i2c_master_port *port,
{
struct p8_i2c_master *master = port->master;
uint64_t cmd, mode, stat, estat, intm, intc;
- int rc;
/* Print master and request structure bits */
log_simple_error(&e_info(OPAL_RC_I2C_TRANSFER),
@@ -255,48 +254,17 @@ static void p8_i2c_print_debug_info(struct p8_i2c_master_port *port,
" start_time=%016llx end_time=%016llx (duration=%016llx)\n",
master->start_time, end_time, end_time - master->start_time);
- /* Dump the current state of i2c registers */
- rc = xscom_read(master->chip_id, master->xscom_base + I2C_CMD_REG,
- &cmd);
- if (rc) {
- prlog(PR_DEBUG, "I2C: Failed to read CMD_REG\n");
- cmd = 0ull;
- }
-
- rc = xscom_read(master->chip_id, master->xscom_base + I2C_MODE_REG,
- &mode);
- if (rc) {
- prlog(PR_DEBUG, "I2C: Failed to read MODE_REG\n");
- mode = 0ull;
- }
-
- rc = xscom_read(master->chip_id, master->xscom_base + I2C_STAT_REG,
- &stat);
- if (rc) {
- prlog(PR_DEBUG, "I2C: Failed to read STAT_REG\n");
- stat = 0ull;
- }
+ /* initialise to some fake value in case of read errors */
+ cmd = mode = stat = estat = intm = intc = 0xDEAD;
- rc = xscom_read(master->chip_id, master->xscom_base + I2C_EXTD_STAT_REG,
- &estat);
- if (rc) {
- prlog(PR_DEBUG, "I2C: Failed to read EXTD_STAT_REG\n");
- estat = 0ull;
- }
-
- rc = xscom_read(master->chip_id, master->xscom_base + I2C_INTR_MASK_REG,
- &intm);
- if (rc) {
- prlog(PR_DEBUG, "I2C: Failed to read INTR_MASK_REG\n");
- intm = 0ull;
- }
-
- rc = xscom_read(master->chip_id, master->xscom_base + I2C_INTR_COND_REG,
- &intc);
- if (rc) {
- prlog(PR_DEBUG, "I2C: Failed to read INTR_COND_REG\n");
- intc = 0ull;
- }
+ /* Dump the current state of i2c registers */
+ i2cm_read_reg(master, I2C_CMD_REG, &cmd);
+ i2cm_read_reg(master, I2C_MODE_REG, &mode);
+ i2cm_read_reg(master, I2C_MODE_REG, &mode);
+ i2cm_read_reg(master, I2C_STAT_REG, &stat);
+ i2cm_read_reg(master, I2C_EXTD_STAT_REG, &estat);
+ i2cm_read_reg(master, I2C_INTR_MASK_REG, &intm);
+ i2cm_read_reg(master, I2C_INTR_COND_REG, &intc);
log_simple_error(&e_info(OPAL_RC_I2C_TRANSFER), "I2C: Register dump--\n"
" cmd:0x%016llx\tmode:0x%016llx\tstat:0x%016llx\n"