Skip to content

Commit 0321977

Browse files
marcanjannau
authored andcommitted
i2c: pasemi: Log bus reset causes
Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent 2ae5092 commit 0321977

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/* Register offsets */
2222
#define REG_MTXFIFO 0x00
2323
#define REG_MRXFIFO 0x04
24+
#define REG_XFSTA 0x0c
2425
#define REG_SMSTA 0x14
2526
#define REG_IMASK 0x18
2627
#define REG_CTL 0x1c
@@ -84,7 +85,7 @@ static void pasemi_reset(struct pasemi_smbus *smbus)
8485

8586
static int pasemi_smb_clear(struct pasemi_smbus *smbus)
8687
{
87-
unsigned int status;
88+
unsigned int status, xfstatus;
8889
int timeout = TRANSFER_TIMEOUT_MS;
8990

9091
status = reg_read(smbus, REG_SMSTA);
@@ -95,15 +96,21 @@ static int pasemi_smb_clear(struct pasemi_smbus *smbus)
9596
status = reg_read(smbus, REG_SMSTA);
9697
}
9798

99+
xfstatus = reg_read(smbus, REG_XFSTA);
100+
98101
if (timeout < 0) {
99-
dev_warn(smbus->dev, "Bus is still stuck (status 0x%08x)\n", status);
102+
dev_warn(smbus->dev, "Bus is still stuck (status 0x%08x xfstatus 0x%08x)\n",
103+
status, xfstatus);
100104
return -EIO;
101105
}
102106

103107
/* If any badness happened or there is data in the FIFOs, reset the FIFOs */
104108
if ((status & (SMSTA_MRNE | SMSTA_JMD | SMSTA_MTO | SMSTA_TOM | SMSTA_MTN | SMSTA_MTA)) ||
105-
!(status & SMSTA_MTE))
109+
!(status & SMSTA_MTE)) {
110+
dev_warn(smbus->dev, "Issuing reset due to status 0x%08x (xfstatus 0x%08x)\n",
111+
status, xfstatus);
106112
pasemi_reset(smbus);
113+
}
107114

108115
/* Clear the flags */
109116
reg_write(smbus, REG_SMSTA, status);

0 commit comments

Comments
 (0)