]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.10
authorSasha Levin <sashal@kernel.org>
Sat, 18 Jan 2025 22:25:55 +0000 (17:25 -0500)
committerSasha Levin <sashal@kernel.org>
Sat, 18 Jan 2025 22:25:55 +0000 (17:25 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.10/i2c-mux-demux-pinctrl-check-initial-mux-selection-to.patch [new file with mode: 0644]
queue-5.10/i2c-rcar-fix-nack-handling-when-being-a-target.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/i2c-mux-demux-pinctrl-check-initial-mux-selection-to.patch b/queue-5.10/i2c-mux-demux-pinctrl-check-initial-mux-selection-to.patch
new file mode 100644 (file)
index 0000000..a15b4aa
--- /dev/null
@@ -0,0 +1,37 @@
+From 855e6666f83bd0f65ba9d37e40b35d0ccd1c7efa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Jan 2025 08:29:45 +0100
+Subject: i2c: mux: demux-pinctrl: check initial mux selection, too
+
+From: Wolfram Sang <wsa+renesas@sang-engineering.com>
+
+[ Upstream commit ca89f73394daf92779ddaa37b42956f4953f3941 ]
+
+When misconfigured, the initial setup of the current mux channel can
+fail, too. It must be checked as well.
+
+Fixes: 50a5ba876908 ("i2c: mux: demux-pinctrl: add driver")
+Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/muxes/i2c-demux-pinctrl.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
+index 45a3f7e7b3f68..cea057704c00c 100644
+--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
+@@ -261,7 +261,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
+       pm_runtime_no_callbacks(&pdev->dev);
+       /* switch to first parent as active master */
+-      i2c_demux_activate_master(priv, 0);
++      err = i2c_demux_activate_master(priv, 0);
++      if (err)
++              goto err_rollback;
+       err = device_create_file(&pdev->dev, &dev_attr_available_masters);
+       if (err)
+-- 
+2.39.5
+
diff --git a/queue-5.10/i2c-rcar-fix-nack-handling-when-being-a-target.patch b/queue-5.10/i2c-rcar-fix-nack-handling-when-being-a-target.patch
new file mode 100644 (file)
index 0000000..0bf20c0
--- /dev/null
@@ -0,0 +1,95 @@
+From 1a79333fcf36e75c964376fec336a882280f3488 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Jan 2025 13:36:23 +0100
+Subject: i2c: rcar: fix NACK handling when being a target
+
+From: Wolfram Sang <wsa+renesas@sang-engineering.com>
+
+[ Upstream commit 093f70c134f70e4632b295240f07d2b50b74e247 ]
+
+When this controller is a target, the NACK handling had two issues.
+First, the return value from the backend was not checked on the initial
+WRITE_REQUESTED. So, the driver missed to send a NACK in this case.
+Also, the NACK always arrives one byte late on the bus, even in the
+WRITE_RECEIVED case. This seems to be a HW issue. We should then not
+rely on the backend to correctly NACK the superfluous byte as well. Fix
+both issues by introducing a flag which gets set whenever the backend
+requests a NACK and keep sending it until we get a STOP condition.
+
+Fixes: de20d1857dd6 ("i2c: rcar: add slave support")
+Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-rcar.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
+index 7a6bae9df568b..08b1580d59c98 100644
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -112,6 +112,8 @@
+ #define ID_P_PM_BLOCKED               BIT(31)
+ #define ID_P_MASK             GENMASK(31, 28)
++#define ID_SLAVE_NACK         BIT(0)
++
+ enum rcar_i2c_type {
+       I2C_RCAR_GEN1,
+       I2C_RCAR_GEN2,
+@@ -145,6 +147,7 @@ struct rcar_i2c_priv {
+       int irq;
+       struct i2c_client *host_notify_client;
++      u8 slave_flags;
+ };
+ #define rcar_i2c_priv_to_dev(p)               ((p)->adap.dev.parent)
+@@ -573,6 +576,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
+ {
+       u32 ssr_raw, ssr_filtered;
+       u8 value;
++      int ret;
+       ssr_raw = rcar_i2c_read(priv, ICSSR) & 0xff;
+       ssr_filtered = ssr_raw & rcar_i2c_read(priv, ICSIER);
+@@ -588,7 +592,10 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
+                       rcar_i2c_write(priv, ICRXTX, value);
+                       rcar_i2c_write(priv, ICSIER, SDE | SSR | SAR);
+               } else {
+-                      i2c_slave_event(priv->slave, I2C_SLAVE_WRITE_REQUESTED, &value);
++                      ret = i2c_slave_event(priv->slave, I2C_SLAVE_WRITE_REQUESTED, &value);
++                      if (ret)
++                              priv->slave_flags |= ID_SLAVE_NACK;
++
+                       rcar_i2c_read(priv, ICRXTX);    /* dummy read */
+                       rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR);
+               }
+@@ -601,18 +608,21 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
+       if (ssr_filtered & SSR) {
+               i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
+               rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */
++              priv->slave_flags &= ~ID_SLAVE_NACK;
+               rcar_i2c_write(priv, ICSIER, SAR);
+               rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
+       }
+       /* master wants to write to us */
+       if (ssr_filtered & SDR) {
+-              int ret;
+-
+               value = rcar_i2c_read(priv, ICRXTX);
+               ret = i2c_slave_event(priv->slave, I2C_SLAVE_WRITE_RECEIVED, &value);
+-              /* Send NACK in case of error */
+-              rcar_i2c_write(priv, ICSCR, SIE | SDBS | (ret < 0 ? FNA : 0));
++              if (ret)
++                      priv->slave_flags |= ID_SLAVE_NACK;
++
++              /* Send NACK in case of error, but it will come 1 byte late :( */
++              rcar_i2c_write(priv, ICSCR, SIE | SDBS |
++                             (priv->slave_flags & ID_SLAVE_NACK ? FNA : 0));
+               rcar_i2c_write(priv, ICSSR, ~SDR & 0xff);
+       }
+-- 
+2.39.5
+
index ecd278c598396bcf23d12f4ddb535f78cca86ecb..e7ada9de1c203557b1ca4fb9eef1993388e98866 100644 (file)
@@ -91,3 +91,5 @@ net-mlx5-add-priorities-for-counters-in-rdma-namespa.patch
 net-mlx5-refactor-mlx5_get_flow_namespace.patch
 net-mlx5-fix-rdma-tx-steering-prio.patch
 drm-v3d-ensure-job-pointer-is-set-to-null-after-job-.patch
+i2c-mux-demux-pinctrl-check-initial-mux-selection-to.patch
+i2c-rcar-fix-nack-handling-when-being-a-target.patch