diff options
author | Jan Glauber <jglauber@cavium.com> | 2016-11-14 13:50:43 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-11-29 14:04:21 -0500 |
commit | dfa2ccc30e6556bd526f54f0e16fc9e5af4293cb (patch) | |
tree | 5cef57e8c9c8126f6106f391e1f019579c4869ef /drivers | |
parent | e5517c2a5a49ed5e99047008629f1cd60246ea0e (diff) |
Revert "i2c: octeon: thunderx: Limit register access retries"
This reverts commit 70121f7f3725 ("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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-octeon-core.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-octeon-core.h | 27 |
2 files changed, 12 insertions, 19 deletions
diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c index 419b54bfc7c7..5e63b17f935d 100644 --- a/drivers/i2c/busses/i2c-octeon-core.c +++ b/drivers/i2c/busses/i2c-octeon-core.c | |||
@@ -381,9 +381,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, | |||
381 | if (result) | 381 | if (result) |
382 | return result; | 382 | return result; |
383 | 383 | ||
384 | data[i] = octeon_i2c_data_read(i2c, &result); | 384 | data[i] = octeon_i2c_data_read(i2c); |
385 | if (result) | ||
386 | return result; | ||
387 | if (recv_len && i == 0) { | 385 | if (recv_len && i == 0) { |
388 | if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) | 386 | if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) |
389 | return -EPROTO; | 387 | return -EPROTO; |
diff --git a/drivers/i2c/busses/i2c-octeon-core.h b/drivers/i2c/busses/i2c-octeon-core.h index 1db7c835a454..87151ea74acd 100644 --- a/drivers/i2c/busses/i2c-octeon-core.h +++ b/drivers/i2c/busses/i2c-octeon-core.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <linux/i2c.h> | 5 | #include <linux/i2c.h> |
6 | #include <linux/i2c-smbus.h> | 6 | #include <linux/i2c-smbus.h> |
7 | #include <linux/io.h> | 7 | #include <linux/io.h> |
8 | #include <linux/iopoll.h> | ||
9 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
10 | #include <linux/pci.h> | 9 | #include <linux/pci.h> |
11 | 10 | ||
@@ -145,9 +144,9 @@ static inline void octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8 | |||
145 | u64 tmp; | 144 | u64 tmp; |
146 | 145 | ||
147 | __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI(i2c)); | 146 | __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI(i2c)); |
148 | 147 | do { | |
149 | readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp, tmp & SW_TWSI_V, | 148 | tmp = __raw_readq(i2c->twsi_base + SW_TWSI(i2c)); |
150 | I2C_OCTEON_EVENT_WAIT, i2c->adap.timeout); | 149 | } while ((tmp & SW_TWSI_V) != 0); |
151 | } | 150 | } |
152 | 151 | ||
153 | #define octeon_i2c_ctl_write(i2c, val) \ | 152 | #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 | |||
164 | * | 163 | * |
165 | * The I2C core registers are accessed indirectly via the SW_TWSI CSR. | 164 | * The I2C core registers are accessed indirectly via the SW_TWSI CSR. |
166 | */ | 165 | */ |
167 | static inline int octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg, | 166 | static inline u8 octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg) |
168 | int *error) | ||
169 | { | 167 | { |
170 | u64 tmp; | 168 | u64 tmp; |
171 | int ret; | ||
172 | 169 | ||
173 | __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI(i2c)); | 170 | __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); | ||
174 | 174 | ||
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; | ||
180 | return tmp & 0xFF; | 175 | return tmp & 0xFF; |
181 | } | 176 | } |
182 | 177 | ||
183 | #define octeon_i2c_ctl_read(i2c) \ | 178 | #define octeon_i2c_ctl_read(i2c) \ |
184 | octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_CTL, NULL) | 179 | octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_CTL) |
185 | #define octeon_i2c_data_read(i2c, error) \ | 180 | #define octeon_i2c_data_read(i2c) \ |
186 | octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_DATA, error) | 181 | octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_DATA) |
187 | #define octeon_i2c_stat_read(i2c) \ | 182 | #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) |
189 | 184 | ||
190 | /** | 185 | /** |
191 | * octeon_i2c_read_int - read the TWSI_INT register | 186 | * octeon_i2c_read_int - read the TWSI_INT register |