Skip to content

Commit dfa2ccc

Browse files
Jan GlauberWolfram Sang
authored andcommitted
Revert "i2c: octeon: thunderx: Limit register access retries"
This reverts commit 70121f7 ("i2c: octeon: thunderx: Limit register access retries"). Using readq_poll_timeout instead of __raw_readq triggers the following debug warning: [ 78.871568] ipmi_ssif: Trying hotmod-specified SSIF interface at i2c address 0x12, adapter Cavium ThunderX i2c adapter at 0000:01:09.4, slave address 0x0 [ 78.886107] do not call blocking ops when !TASK_RUNNING; state=2 set at [<fffffc00080e0088>] prepare_to_wait_event+0x58/0x10c [ 78.897436] ------------[ cut here ]------------ [ 78.902050] WARNING: CPU: 6 PID: 2235 at kernel/sched/core.c:7718 __might_sleep+0x80/0x88 [...] [ 79.133553] [<fffffc00080c3aac>] __might_sleep+0x80/0x88 [ 79.138862] [<fffffc0000e30138>] octeon_i2c_test_iflg+0x4c/0xbc [i2c_thunderx] [ 79.146077] [<fffffc0000e30958>] octeon_i2c_test_ready+0x18/0x70 [i2c_thunderx] [ 79.153379] [<fffffc0000e30b04>] octeon_i2c_wait+0x154/0x1a4 [i2c_thunderx] [ 79.160334] [<fffffc0000e310bc>] octeon_i2c_xfer+0xf4/0xf60 [i2c_thunderx] Signed-off-by: Jan Glauber <jglauber@cavium.com> Acked-by: Steven J. Hill <steven.hill@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent e5517c2 commit dfa2ccc

2 files changed

Lines changed: 12 additions & 19 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
381381
if (result)
382382
return result;
383383

384-
data[i] = octeon_i2c_data_read(i2c, &result);
385-
if (result)
386-
return result;
384+
data[i] = octeon_i2c_data_read(i2c);
387385
if (recv_len && i == 0) {
388386
if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)
389387
return -EPROTO;

drivers/i2c/busses/i2c-octeon-core.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <linux/i2c.h>
66
#include <linux/i2c-smbus.h>
77
#include <linux/io.h>
8-
#include <linux/iopoll.h>
98
#include <linux/kernel.h>
109
#include <linux/pci.h>
1110

@@ -145,9 +144,9 @@ static inline void octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8
145144
u64 tmp;
146145

147146
__raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI(i2c));
148-
149-
readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp, tmp & SW_TWSI_V,
150-
I2C_OCTEON_EVENT_WAIT, i2c->adap.timeout);
147+
do {
148+
tmp = __raw_readq(i2c->twsi_base + SW_TWSI(i2c));
149+
} while ((tmp & SW_TWSI_V) != 0);
151150
}
152151

153152
#define octeon_i2c_ctl_write(i2c, val) \
@@ -164,28 +163,24 @@ static inline void octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8
164163
*
165164
* The I2C core registers are accessed indirectly via the SW_TWSI CSR.
166165
*/
167-
static inline int octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg,
168-
int *error)
166+
static inline u8 octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg)
169167
{
170168
u64 tmp;
171-
int ret;
172169

173170
__raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI(i2c));
171+
do {
172+
tmp = __raw_readq(i2c->twsi_base + SW_TWSI(i2c));
173+
} while ((tmp & SW_TWSI_V) != 0);
174174

175-
ret = readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
176-
tmp & SW_TWSI_V, I2C_OCTEON_EVENT_WAIT,
177-
i2c->adap.timeout);
178-
if (error)
179-
*error = ret;
180175
return tmp & 0xFF;
181176
}
182177

183178
#define octeon_i2c_ctl_read(i2c) \
184-
octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_CTL, NULL)
185-
#define octeon_i2c_data_read(i2c, error) \
186-
octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_DATA, error)
179+
octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_CTL)
180+
#define octeon_i2c_data_read(i2c) \
181+
octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_DATA)
187182
#define octeon_i2c_stat_read(i2c) \
188-
octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_STAT, NULL)
183+
octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_STAT)
189184

190185
/**
191186
* octeon_i2c_read_int - read the TWSI_INT register

0 commit comments

Comments
 (0)