Skip to content

Commit af6e7de

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Driver bugfixes for I2C. Most of them are for the new mlxbf driver which got more exposure after rc1. The sh_mobile patch should already have reached you during the merge window, but I accidently dropped it. However, since it fixes a problem with rebooting, it is still fine for rc3" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: designware: slave should do WRITE_REQUESTED before WRITE_RECEIVED i2c: designware: call i2c_dw_read_clear_intrbits_slave() once i2c: mlxbf: I2C_MLXBF should depend on MELLANOX_PLATFORM i2c: mlxbf: Update author and maintainer email info i2c: mlxbf: Update reference clock frequency i2c: mlxbf: Remove unecessary wrapper functions i2c: mlxbf: Fix resrticted cast warning of sparse i2c: mlxbf: Add CONFIG_ACPI to guard ACPI function call i2c: sh_mobile: implement atomic transfers i2c: mediatek: move dma reset before i2c reset
2 parents 4b1d362 + 3b5f7f1 commit af6e7de

6 files changed

Lines changed: 177 additions & 177 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11163,7 +11163,7 @@ F: Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt
1116311163
F: drivers/input/touchscreen/melfas_mip4.c
1116411164

1116511165
MELLANOX BLUEFIELD I2C DRIVER
11166-
M: Khalil Blaiech <kblaiech@mellanox.com>
11166+
M: Khalil Blaiech <kblaiech@nvidia.com>
1116711167
L: linux-i2c@vger.kernel.org
1116811168
S: Supported
1116911169
F: drivers/i2c/busses/i2c-mlxbf.c

drivers/i2c/busses/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ config I2C_LPC2K
733733

734734
config I2C_MLXBF
735735
tristate "Mellanox BlueField I2C controller"
736-
depends on ARM64
736+
depends on MELLANOX_PLATFORM && ARM64
737737
help
738738
Enabling this option will add I2C SMBus support for Mellanox BlueField
739739
system.

drivers/i2c/busses/i2c-designware-slave.c

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
159159
u32 raw_stat, stat, enabled, tmp;
160160
u8 val = 0, slave_activity;
161161

162-
regmap_read(dev->map, DW_IC_INTR_STAT, &stat);
163162
regmap_read(dev->map, DW_IC_ENABLE, &enabled);
164163
regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_stat);
165164
regmap_read(dev->map, DW_IC_STATUS, &tmp);
@@ -168,32 +167,30 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
168167
if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY) || !dev->slave)
169168
return 0;
170169

170+
stat = i2c_dw_read_clear_intrbits_slave(dev);
171171
dev_dbg(dev->dev,
172172
"%#x STATUS SLAVE_ACTIVITY=%#x : RAW_INTR_STAT=%#x : INTR_STAT=%#x\n",
173173
enabled, slave_activity, raw_stat, stat);
174174

175-
if ((stat & DW_IC_INTR_RX_FULL) && (stat & DW_IC_INTR_STOP_DET))
176-
i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED, &val);
175+
if (stat & DW_IC_INTR_RX_FULL) {
176+
if (dev->status != STATUS_WRITE_IN_PROGRESS) {
177+
dev->status = STATUS_WRITE_IN_PROGRESS;
178+
i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED,
179+
&val);
180+
}
181+
182+
regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
183+
val = tmp;
184+
if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
185+
&val))
186+
dev_vdbg(dev->dev, "Byte %X acked!", val);
187+
}
177188

178189
if (stat & DW_IC_INTR_RD_REQ) {
179190
if (slave_activity) {
180-
if (stat & DW_IC_INTR_RX_FULL) {
181-
regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
182-
val = tmp;
183-
184-
if (!i2c_slave_event(dev->slave,
185-
I2C_SLAVE_WRITE_RECEIVED,
186-
&val)) {
187-
dev_vdbg(dev->dev, "Byte %X acked!",
188-
val);
189-
}
190-
regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
191-
stat = i2c_dw_read_clear_intrbits_slave(dev);
192-
} else {
193-
regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
194-
regmap_read(dev->map, DW_IC_CLR_RX_UNDER, &tmp);
195-
stat = i2c_dw_read_clear_intrbits_slave(dev);
196-
}
191+
regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
192+
193+
dev->status = STATUS_READ_IN_PROGRESS;
197194
if (!i2c_slave_event(dev->slave,
198195
I2C_SLAVE_READ_REQUESTED,
199196
&val))
@@ -205,21 +202,11 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
205202
if (!i2c_slave_event(dev->slave, I2C_SLAVE_READ_PROCESSED,
206203
&val))
207204
regmap_read(dev->map, DW_IC_CLR_RX_DONE, &tmp);
208-
209-
i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
210-
stat = i2c_dw_read_clear_intrbits_slave(dev);
211-
return 1;
212205
}
213206

214-
if (stat & DW_IC_INTR_RX_FULL) {
215-
regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
216-
val = tmp;
217-
if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
218-
&val))
219-
dev_vdbg(dev->dev, "Byte %X acked!", val);
220-
} else {
207+
if (stat & DW_IC_INTR_STOP_DET) {
208+
dev->status = STATUS_IDLE;
221209
i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
222-
stat = i2c_dw_read_clear_intrbits_slave(dev);
223210
}
224211

225212
return 1;
@@ -230,7 +217,6 @@ static irqreturn_t i2c_dw_isr_slave(int this_irq, void *dev_id)
230217
struct dw_i2c_dev *dev = dev_id;
231218
int ret;
232219

233-
i2c_dw_read_clear_intrbits_slave(dev);
234220
ret = i2c_dw_irq_handler_slave(dev);
235221
if (ret > 0)
236222
complete(&dev->cmd_complete);

0 commit comments

Comments
 (0)