Skip to content

Commit 090c3a4

Browse files
marcanAndi Shyti
authored andcommitted
i2c: pasemi: Log bus reset causes
This ensures we get all information we need to debug issues when users forward us their logs. Signed-off-by: Hector Martin <[email protected]> Reviewed-by: Neal Gompa <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Signed-off-by: Sven Peter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andi Shyti <[email protected]>
1 parent f4f64fa commit 090c3a4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/i2c/busses/i2c-pasemi-core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
/* Register offsets */
2323
#define REG_MTXFIFO 0x00
2424
#define REG_MRXFIFO 0x04
25+
#define REG_XFSTA 0x0c
2526
#define REG_SMSTA 0x14
2627
#define REG_IMASK 0x18
2728
#define REG_CTL 0x1c
@@ -99,14 +100,18 @@ static int pasemi_smb_clear(struct pasemi_smbus *smbus)
99100
USEC_PER_MSEC * PASEMI_TRANSFER_TIMEOUT_MS);
100101

101102
if (ret < 0) {
102-
dev_err(smbus->dev, "Bus is still stuck (status 0x%08x)\n", status);
103+
dev_err(smbus->dev, "Bus is still stuck (status 0x%08x xfstatus 0x%08x)\n",
104+
status, reg_read(smbus, REG_XFSTA));
103105
return -EIO;
104106
}
105107

106108
/* If any badness happened or there is data in the FIFOs, reset the FIFOs */
107109
if ((status & (SMSTA_MRNE | SMSTA_JMD | SMSTA_MTO | SMSTA_TOM | SMSTA_MTN | SMSTA_MTA)) ||
108-
!(status & SMSTA_MTE))
110+
!(status & SMSTA_MTE)) {
111+
dev_warn(smbus->dev, "Issuing reset due to status 0x%08x (xfstatus 0x%08x)\n",
112+
status, reg_read(smbus, REG_XFSTA));
109113
pasemi_reset(smbus);
114+
}
110115

111116
/* Clear the flags */
112117
reg_write(smbus, REG_SMSTA, status);

0 commit comments

Comments
 (0)