From 71fd78c194fe3b23770d3812a9781733095eaea2 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 1 Jul 2024 09:16:32 -0400 Subject: [PATCH] Fixes for 6.1 Signed-off-by: Sasha Levin --- ...ounter-ti-eqep-enable-clock-at-probe.patch | 59 +++++++++++++++++++ ...card-write-requests-while-old-comman.patch | 38 ++++++++++++ ...nit-don-t-erase-registers-after-stop.patch | 38 ++++++++++++ ...on-t-include-ams_ctrl_channels-in-sc.patch | 46 +++++++++++++++ queue-6.1/series | 4 ++ 5 files changed, 185 insertions(+) create mode 100644 queue-6.1/counter-ti-eqep-enable-clock-at-probe.patch create mode 100644 queue-6.1/i2c-testunit-discard-write-requests-while-old-comman.patch create mode 100644 queue-6.1/i2c-testunit-don-t-erase-registers-after-stop.patch create mode 100644 queue-6.1/iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch diff --git a/queue-6.1/counter-ti-eqep-enable-clock-at-probe.patch b/queue-6.1/counter-ti-eqep-enable-clock-at-probe.patch new file mode 100644 index 00000000000..546ffed8f92 --- /dev/null +++ b/queue-6.1/counter-ti-eqep-enable-clock-at-probe.patch @@ -0,0 +1,59 @@ +From 8ed97d9c723614eb5f0e6a68c0a8b40d70cb2044 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 17:22:40 -0500 +Subject: counter: ti-eqep: enable clock at probe + +From: David Lechner + +[ Upstream commit 0cf81c73e4c6a4861128a8f27861176ec312af4e ] + +The TI eQEP clock is both a functional and interface clock. Since it is +required for the device to function, we should be enabling it at probe. + +Up to now, we've just been lucky that the clock was enabled by something +else on the system already. + +Fixes: f213729f6796 ("counter: new TI eQEP driver") +Reviewed-by: Judith Mendez +Signed-off-by: David Lechner +Link: https://lore.kernel.org/r/20240621-ti-eqep-enable-clock-v2-1-edd3421b54d4@baylibre.com +Signed-off-by: William Breathitt Gray +Signed-off-by: Sasha Levin +--- + drivers/counter/ti-eqep.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c +index b0f24cf3e891d..4d3de4a35801f 100644 +--- a/drivers/counter/ti-eqep.c ++++ b/drivers/counter/ti-eqep.c +@@ -6,6 +6,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -376,6 +377,7 @@ static int ti_eqep_probe(struct platform_device *pdev) + struct counter_device *counter; + struct ti_eqep_cnt *priv; + void __iomem *base; ++ struct clk *clk; + int err; + + counter = devm_counter_alloc(dev, sizeof(*priv)); +@@ -415,6 +417,10 @@ static int ti_eqep_probe(struct platform_device *pdev) + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + ++ clk = devm_clk_get_enabled(dev, NULL); ++ if (IS_ERR(clk)) ++ return dev_err_probe(dev, PTR_ERR(clk), "failed to enable clock\n"); ++ + err = counter_add(counter); + if (err < 0) { + pm_runtime_put_sync(dev); +-- +2.43.0 + diff --git a/queue-6.1/i2c-testunit-discard-write-requests-while-old-comman.patch b/queue-6.1/i2c-testunit-discard-write-requests-while-old-comman.patch new file mode 100644 index 00000000000..7f6d78d3f7c --- /dev/null +++ b/queue-6.1/i2c-testunit-discard-write-requests-while-old-comman.patch @@ -0,0 +1,38 @@ +From 184e4a99ede789ddc59b5a9bb21a545006424b73 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 13:14:48 +0200 +Subject: i2c: testunit: discard write requests while old command is running + +From: Wolfram Sang + +[ Upstream commit c116deafd1a5cc1e9739099eb32114e90623209c ] + +When clearing registers on new write requests was added, the protection +for currently running commands was missed leading to concurrent access +to the testunit registers. Check the flag beforehand. + +Fixes: b39ab96aa894 ("i2c: testunit: add support for block process calls") +Signed-off-by: Wolfram Sang +Reviewed-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-slave-testunit.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c +index 4945adc69d78d..54c08f48a8b85 100644 +--- a/drivers/i2c/i2c-slave-testunit.c ++++ b/drivers/i2c/i2c-slave-testunit.c +@@ -121,6 +121,9 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, + break; + + case I2C_SLAVE_WRITE_REQUESTED: ++ if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) ++ return -EBUSY; ++ + memset(tu->regs, 0, TU_NUM_REGS); + tu->reg_idx = 0; + break; +-- +2.43.0 + diff --git a/queue-6.1/i2c-testunit-don-t-erase-registers-after-stop.patch b/queue-6.1/i2c-testunit-don-t-erase-registers-after-stop.patch new file mode 100644 index 00000000000..0b0b8ac3fa5 --- /dev/null +++ b/queue-6.1/i2c-testunit-don-t-erase-registers-after-stop.patch @@ -0,0 +1,38 @@ +From 4d2a0d8bc4ef8b7e00f52083fe2c2184dbd2bd92 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 13:14:47 +0200 +Subject: i2c: testunit: don't erase registers after STOP + +From: Wolfram Sang + +[ Upstream commit c422b6a630240f706063e0ecbb894aa8491b1fa1 ] + +STOP fallsthrough to WRITE_REQUESTED but this became problematic when +clearing the testunit registers was added to the latter. Actually, there +is no reason to clear the testunit state after STOP. Doing it when a new +WRITE_REQUESTED arrives is enough. So, no need to fallthrough, at all. + +Fixes: b39ab96aa894 ("i2c: testunit: add support for block process calls") +Signed-off-by: Wolfram Sang +Reviewed-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-slave-testunit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c +index 75ee7ebdb614f..4945adc69d78d 100644 +--- a/drivers/i2c/i2c-slave-testunit.c ++++ b/drivers/i2c/i2c-slave-testunit.c +@@ -118,7 +118,7 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, + queue_delayed_work(system_long_wq, &tu->worker, + msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY])); + } +- fallthrough; ++ break; + + case I2C_SLAVE_WRITE_REQUESTED: + memset(tu->regs, 0, TU_NUM_REGS); +-- +2.43.0 + diff --git a/queue-6.1/iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch b/queue-6.1/iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch new file mode 100644 index 00000000000..4381912cdf5 --- /dev/null +++ b/queue-6.1/iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch @@ -0,0 +1,46 @@ +From 206cbd130c054285376619ac4c3eab47798ec0c4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Mar 2024 12:28:00 -0400 +Subject: iio: xilinx-ams: Don't include ams_ctrl_channels in scan_mask + +From: Sean Anderson + +[ Upstream commit 89b898c627a49b978a4c323ea6856eacfc21f6ba ] + +ams_enable_channel_sequence constructs a "scan_mask" for all the PS and +PL channels. This works out fine, since scan_index for these channels is +less than 64. However, it also includes the ams_ctrl_channels, where +scan_index is greater than 64, triggering undefined behavior. Since we +don't need these channels anyway, just exclude them. + +Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver") +Signed-off-by: Sean Anderson +Link: https://lore.kernel.org/r/20240311162800.11074-1-sean.anderson@linux.dev +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/adc/xilinx-ams.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c +index a507d2e170792..3db021b96ae9d 100644 +--- a/drivers/iio/adc/xilinx-ams.c ++++ b/drivers/iio/adc/xilinx-ams.c +@@ -414,8 +414,12 @@ static void ams_enable_channel_sequence(struct iio_dev *indio_dev) + + /* Run calibration of PS & PL as part of the sequence */ + scan_mask = BIT(0) | BIT(AMS_PS_SEQ_MAX); +- for (i = 0; i < indio_dev->num_channels; i++) +- scan_mask |= BIT_ULL(indio_dev->channels[i].scan_index); ++ for (i = 0; i < indio_dev->num_channels; i++) { ++ const struct iio_chan_spec *chan = &indio_dev->channels[i]; ++ ++ if (chan->scan_index < AMS_CTRL_SEQ_BASE) ++ scan_mask |= BIT_ULL(chan->scan_index); ++ } + + if (ams->ps_base) { + /* put sysmon in a soft reset to change the sequence */ +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index 1eed573af8d..c06cd5a61cb 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -72,3 +72,7 @@ mmc-sdhci-brcmstb-check-r1_status-for-erase-trim-discard.patch mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch mmc-sdhci-do-not-invert-write-protect-twice.patch mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch +iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch +counter-ti-eqep-enable-clock-at-probe.patch +i2c-testunit-don-t-erase-registers-after-stop.patch +i2c-testunit-discard-write-requests-while-old-comman.patch -- 2.47.3