Skip to content

Commit 4d145e3

Browse files
committed
Merge tag 'i2c-for-6.10-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Fixes for the I2C testunit, the Renesas R-Car driver and some MAINTAINERS corrections" * tag 'i2c-for-6.10-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: testunit: avoid re-issued work after read message i2c: rcar: ensure Gen3+ reset does not disturb local targets i2c: mark HostNotify target address as used i2c: testunit: correct Kconfig description MAINTAINERS: VIRTIO I2C loses a maintainer, gains a reviewer MAINTAINERS: delete entries for Thor Thayer i2c: rcar: clear NO_RXDMA flag after resetting i2c: rcar: bring hardware to known state when probing
2 parents d0d0cd3 + 3fdd2d2 commit 4d145e3

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

MAINTAINERS

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -846,12 +846,6 @@ ALPS PS/2 TOUCHPAD DRIVER
846846
R: Pali Rohár <[email protected]>
847847
F: drivers/input/mouse/alps.*
848848

849-
ALTERA I2C CONTROLLER DRIVER
850-
M: Thor Thayer <[email protected]>
851-
S: Maintained
852-
F: Documentation/devicetree/bindings/i2c/i2c-altera.txt
853-
F: drivers/i2c/busses/i2c-altera.c
854-
855849
ALTERA MAILBOX DRIVER
856850
M: Mun Yew Tham <[email protected]>
857851
S: Maintained
@@ -871,21 +865,6 @@ L: [email protected]
871865
S: Maintained
872866
F: drivers/gpio/gpio-altera.c
873867

874-
ALTERA SYSTEM MANAGER DRIVER
875-
M: Thor Thayer <[email protected]>
876-
S: Maintained
877-
F: drivers/mfd/altera-sysmgr.c
878-
F: include/linux/mfd/altera-sysmgr.h
879-
880-
ALTERA SYSTEM RESOURCE DRIVER FOR ARRIA10 DEVKIT
881-
M: Thor Thayer <[email protected]>
882-
S: Maintained
883-
F: drivers/gpio/gpio-altera-a10sr.c
884-
F: drivers/mfd/altera-a10sr.c
885-
F: drivers/reset/reset-a10sr.c
886-
F: include/dt-bindings/reset/altr,rst-mgr-a10sr.h
887-
F: include/linux/mfd/altera-a10sr.h
888-
889868
ALTERA TRIPLE SPEED ETHERNET DRIVER
890869
M: Joyce Ooi <[email protected]>
891870
@@ -23864,8 +23843,8 @@ S: Maintained
2386423843
F: drivers/vhost/scsi.c
2386523844

2386623845
VIRTIO I2C DRIVER
23867-
M: Conghui Chen <[email protected]>
2386823846
M: Viresh Kumar <[email protected]>
23847+
R: "Chen, Jian Jun" <[email protected]>
2386923848
2387023849
2387123850
S: Maintained

drivers/i2c/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ config I2C_SLAVE_EEPROM
135135
Documentation/i2c/slave-eeprom-backend.rst for further details.
136136

137137
config I2C_SLAVE_TESTUNIT
138-
tristate "I2C eeprom testunit driver"
138+
tristate "I2C testunit driver"
139139
help
140140
This backend can be used to trigger test cases for I2C bus masters
141141
which require a remote device with certain capabilities, e.g.

drivers/i2c/busses/i2c-rcar.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ static void rcar_i2c_init(struct rcar_i2c_priv *priv)
257257
}
258258
}
259259

260+
static void rcar_i2c_reset_slave(struct rcar_i2c_priv *priv)
261+
{
262+
rcar_i2c_write(priv, ICSIER, 0);
263+
rcar_i2c_write(priv, ICSSR, 0);
264+
rcar_i2c_write(priv, ICSCR, SDBS);
265+
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
266+
}
267+
260268
static int rcar_i2c_bus_barrier(struct rcar_i2c_priv *priv)
261269
{
262270
int ret;
@@ -875,6 +883,10 @@ static int rcar_i2c_do_reset(struct rcar_i2c_priv *priv)
875883
{
876884
int ret;
877885

886+
/* Don't reset if a slave instance is currently running */
887+
if (priv->slave)
888+
return -EISCONN;
889+
878890
ret = reset_control_reset(priv->rstc);
879891
if (ret)
880892
return ret;
@@ -903,10 +915,10 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
903915

904916
/* Gen3+ needs a reset. That also allows RXDMA once */
905917
if (priv->devtype >= I2C_RCAR_GEN3) {
906-
priv->flags &= ~ID_P_NO_RXDMA;
907918
ret = rcar_i2c_do_reset(priv);
908919
if (ret)
909920
goto out;
921+
priv->flags &= ~ID_P_NO_RXDMA;
910922
}
911923

912924
rcar_i2c_init(priv);
@@ -1033,11 +1045,8 @@ static int rcar_unreg_slave(struct i2c_client *slave)
10331045

10341046
/* ensure no irq is running before clearing ptr */
10351047
disable_irq(priv->irq);
1036-
rcar_i2c_write(priv, ICSIER, 0);
1037-
rcar_i2c_write(priv, ICSSR, 0);
1048+
rcar_i2c_reset_slave(priv);
10381049
enable_irq(priv->irq);
1039-
rcar_i2c_write(priv, ICSCR, SDBS);
1040-
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
10411050

10421051
priv->slave = NULL;
10431052

@@ -1152,7 +1161,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11521161
goto out_pm_disable;
11531162
}
11541163

1155-
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
1164+
/* Bring hardware to known state */
1165+
rcar_i2c_init(priv);
1166+
rcar_i2c_reset_slave(priv);
11561167

11571168
if (priv->devtype < I2C_RCAR_GEN3) {
11581169
irqflags |= IRQF_NO_THREAD;
@@ -1168,6 +1179,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11681179
if (of_property_read_bool(dev->of_node, "smbus"))
11691180
priv->flags |= ID_P_HOST_NOTIFY;
11701181

1182+
/* R-Car Gen3+ needs a reset before every transfer */
11711183
if (priv->devtype >= I2C_RCAR_GEN3) {
11721184
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
11731185
if (IS_ERR(priv->rstc)) {
@@ -1178,6 +1190,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11781190
ret = reset_control_status(priv->rstc);
11791191
if (ret < 0)
11801192
goto out_pm_put;
1193+
1194+
/* hard reset disturbs HostNotify local target, so disable it */
1195+
priv->flags &= ~ID_P_HOST_NOTIFY;
11811196
}
11821197

11831198
ret = platform_get_irq(pdev, 0);

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,7 @@ EXPORT_SYMBOL(i2c_find_device_by_fwnode);
10671067

10681068
static const struct i2c_device_id dummy_id[] = {
10691069
{ "dummy", 0 },
1070+
{ "smbus_host_notify", 0 },
10701071
{ },
10711072
};
10721073

drivers/i2c/i2c-slave-testunit.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
118118
queue_delayed_work(system_long_wq, &tu->worker,
119119
msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY]));
120120
}
121+
122+
/*
123+
* Reset reg_idx to avoid that work gets queued again in case of
124+
* STOP after a following read message. But do not clear TU regs
125+
* here because we still need them in the workqueue!
126+
*/
127+
tu->reg_idx = 0;
121128
break;
122129

123130
case I2C_SLAVE_WRITE_REQUESTED:

0 commit comments

Comments
 (0)