]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2024 09:32:37 +0000 (11:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2024 09:32:37 +0000 (11:32 +0200)
added patches:
i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch
spi-bcm63xx-fix-module-autoloading.patch

queue-4.19/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/spi-bcm63xx-fix-module-autoloading.patch [new file with mode: 0644]

diff --git a/queue-4.19/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch b/queue-4.19/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch
new file mode 100644 (file)
index 0000000..8ea464e
--- /dev/null
@@ -0,0 +1,75 @@
+From 521da1e9225450bd323db5fa5bca942b1dc485b7 Mon Sep 17 00:00:00 2001
+From: Robert Hancock <robert.hancock@calian.com>
+Date: Tue, 21 Nov 2023 18:11:16 +0000
+Subject: i2c: xiic: Wait for TX empty to avoid missed TX NAKs
+
+From: Robert Hancock <robert.hancock@calian.com>
+
+commit 521da1e9225450bd323db5fa5bca942b1dc485b7 upstream.
+
+Frequently an I2C write will be followed by a read, such as a register
+address write followed by a read of the register value. In this driver,
+when the TX FIFO half empty interrupt was raised and it was determined
+that there was enough space in the TX FIFO to send the following read
+command, it would do so without waiting for the TX FIFO to actually
+empty.
+
+Unfortunately it appears that in some cases this can result in a NAK
+that was raised by the target device on the write, such as due to an
+unsupported register address, being ignored and the subsequent read
+being done anyway. This can potentially put the I2C bus into an
+invalid state and/or result in invalid read data being processed.
+
+To avoid this, once a message has been fully written to the TX FIFO,
+wait for the TX FIFO empty interrupt before moving on to the next
+message, to ensure NAKs are handled properly.
+
+Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface")
+Signed-off-by: Robert Hancock <robert.hancock@calian.com>
+Cc: <stable@vger.kernel.org> # v2.6.34+
+Reviewed-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
+Acked-by: Michal Simek <michal.simek@amd.com>
+Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-xiic.c |   19 +++++++++----------
+ 1 file changed, 9 insertions(+), 10 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-xiic.c
++++ b/drivers/i2c/busses/i2c-xiic.c
+@@ -478,14 +478,17 @@ static irqreturn_t xiic_process(int irq,
+                       goto out;
+               }
+-              xiic_fill_tx_fifo(i2c);
+-
+-              /* current message sent and there is space in the fifo */
+-              if (!xiic_tx_space(i2c) && xiic_tx_fifo_space(i2c) >= 2) {
++              if (xiic_tx_space(i2c)) {
++                      xiic_fill_tx_fifo(i2c);
++              } else {
++                      /* current message fully written */
+                       dev_dbg(i2c->adap.dev.parent,
+                               "%s end of message sent, nmsgs: %d\n",
+                               __func__, i2c->nmsgs);
+-                      if (i2c->nmsgs > 1) {
++                      /* Don't move onto the next message until the TX FIFO empties,
++                       * to ensure that a NAK is not missed.
++                       */
++                      if (i2c->nmsgs > 1 && (pend & XIIC_INTR_TX_EMPTY_MASK)) {
+                               i2c->nmsgs--;
+                               i2c->tx_msg++;
+                               xfer_more = 1;
+@@ -496,11 +499,7 @@ static irqreturn_t xiic_process(int irq,
+                                       "%s Got TX IRQ but no more to do...\n",
+                                       __func__);
+                       }
+-              } else if (!xiic_tx_space(i2c) && (i2c->nmsgs == 1))
+-                      /* current frame is sent and is last,
+-                       * make sure to disable tx half
+-                       */
+-                      xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK);
++              }
+       }
+ out:
+       dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr);
index d5d4629d320c8dcea3d425b2c4bbfa0662cd2a1a..722c1b1d287f61d54384c448c4e3fd13c2983fd5 100644 (file)
@@ -181,3 +181,5 @@ ext4-fix-i_data_sem-unlock-order-in-ext4_ind_migrate.patch
 spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch
 selftests-breakpoints-use-remaining-time-to-check-if.patch
 selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch
+i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch
+spi-bcm63xx-fix-module-autoloading.patch
diff --git a/queue-4.19/spi-bcm63xx-fix-module-autoloading.patch b/queue-4.19/spi-bcm63xx-fix-module-autoloading.patch
new file mode 100644 (file)
index 0000000..1995c5d
--- /dev/null
@@ -0,0 +1,33 @@
+From 909f34f2462a99bf876f64c5c61c653213e32fce Mon Sep 17 00:00:00 2001
+From: Jinjie Ruan <ruanjinjie@huawei.com>
+Date: Mon, 19 Aug 2024 20:33:48 +0800
+Subject: spi: bcm63xx: Fix module autoloading
+
+From: Jinjie Ruan <ruanjinjie@huawei.com>
+
+commit 909f34f2462a99bf876f64c5c61c653213e32fce upstream.
+
+Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
+based on the alias from platform_device_id table.
+
+Fixes: 44d8fb30941d ("spi/bcm63xx: move register definitions into the driver")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
+Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
+Link: https://patch.msgid.link/20240819123349.4020472-2-ruanjinjie@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/spi/spi-bcm63xx.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/spi/spi-bcm63xx.c
++++ b/drivers/spi/spi-bcm63xx.c
+@@ -484,6 +484,7 @@ static const struct platform_device_id b
+       {
+       },
+ };
++MODULE_DEVICE_TABLE(platform, bcm63xx_spi_dev_match);
+ static const struct of_device_id bcm63xx_spi_of_match[] = {
+       { .compatible = "brcm,bcm6348-spi", .data = &bcm6348_spi_reg_offsets },