]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Aug 2025 13:19:18 +0000 (15:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Aug 2025 13:19:18 +0000 (15:19 +0200)
added patches:
pwm-imx-tpm-reset-counter-if-cmod-is-0.patch
wifi-brcmsmac-remove-const-from-tbl_ptr-parameter-in-wlc_lcnphy_common_read_table.patch
zynq_fpga-use-sgtable-based-scatterlist-wrappers.patch

queue-5.4/pwm-imx-tpm-reset-counter-if-cmod-is-0.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/wifi-brcmsmac-remove-const-from-tbl_ptr-parameter-in-wlc_lcnphy_common_read_table.patch [new file with mode: 0644]
queue-5.4/zynq_fpga-use-sgtable-based-scatterlist-wrappers.patch [new file with mode: 0644]

diff --git a/queue-5.4/pwm-imx-tpm-reset-counter-if-cmod-is-0.patch b/queue-5.4/pwm-imx-tpm-reset-counter-if-cmod-is-0.patch
new file mode 100644 (file)
index 0000000..56dc058
--- /dev/null
@@ -0,0 +1,58 @@
+From 65c6f742ab14ab1a2679fba72b82dcc0289d96f1 Mon Sep 17 00:00:00 2001
+From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
+Date: Mon, 28 Jul 2025 15:41:44 -0400
+Subject: pwm: imx-tpm: Reset counter if CMOD is 0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
+
+commit 65c6f742ab14ab1a2679fba72b82dcc0289d96f1 upstream.
+
+As per the i.MX93 TRM, section 67.3.2.1 "MOD register update", the value
+of the TPM counter does NOT get updated when writing MOD.MOD unless
+SC.CMOD != 0. Therefore, with the current code, assuming the following
+sequence:
+
+       1) pwm_disable()
+       2) pwm_apply_might_sleep() /* period is changed here */
+       3) pwm_enable()
+
+and assuming only one channel is active, if CNT.COUNT is higher than the
+MOD.MOD value written during the pwm_apply_might_sleep() call then, when
+re-enabling the PWM during pwm_enable(), the counter will end up resetting
+after UINT32_MAX - CNT.COUNT + MOD.MOD cycles instead of MOD.MOD cycles as
+normally expected.
+
+Fix this problem by forcing a reset of the TPM counter before MOD.MOD is
+written.
+
+Fixes: 738a1cfec2ed ("pwm: Add i.MX TPM PWM driver support")
+Cc: stable@vger.kernel.org
+Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
+Link: https://lore.kernel.org/r/20250728194144.22884-1-laurentiumihalcea111@gmail.com
+Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pwm/pwm-imx-tpm.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/drivers/pwm/pwm-imx-tpm.c
++++ b/drivers/pwm/pwm-imx-tpm.c
+@@ -205,6 +205,15 @@ static int pwm_imx_tpm_apply_hw(struct p
+               writel(val, tpm->base + PWM_IMX_TPM_SC);
+               /*
++               * if the counter is disabled (CMOD == 0), programming the new
++               * period length (MOD) will not reset the counter (CNT). If
++               * CNT.COUNT happens to be bigger than the new MOD value then
++               * the counter will end up being reset way too late. Therefore,
++               * manually reset it to 0.
++               */
++              if (!cmod)
++                      writel(0x0, tpm->base + PWM_IMX_TPM_CNT);
++              /*
+                * set period count:
+                * if the PWM is disabled (CMOD[1:0] = 2b00), then MOD register
+                * is updated when MOD register is written.
index 7ba5d6ed28732b1f08724677398885ee879eaa91..41c8decaa6e391cc695245a490998dc928876100 100644 (file)
@@ -293,3 +293,6 @@ ext4-check-fast-symlink-for-ea_inode-correctly.patch
 ext4-fix-fsmap-end-of-range-reporting-with-bigalloc.patch
 ext4-fix-reserved-gdt-blocks-handling-in-fsmap.patch
 ata-libata-scsi-fix-ata_to_sense_error-status-handling.patch
+zynq_fpga-use-sgtable-based-scatterlist-wrappers.patch
+wifi-brcmsmac-remove-const-from-tbl_ptr-parameter-in-wlc_lcnphy_common_read_table.patch
+pwm-imx-tpm-reset-counter-if-cmod-is-0.patch
diff --git a/queue-5.4/wifi-brcmsmac-remove-const-from-tbl_ptr-parameter-in-wlc_lcnphy_common_read_table.patch b/queue-5.4/wifi-brcmsmac-remove-const-from-tbl_ptr-parameter-in-wlc_lcnphy_common_read_table.patch
new file mode 100644 (file)
index 0000000..c773644
--- /dev/null
@@ -0,0 +1,46 @@
+From 81284e86bf8849f8e98e8ead3ff5811926b2107f Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Tue, 15 Jul 2025 19:45:23 -0700
+Subject: wifi: brcmsmac: Remove const from tbl_ptr parameter in wlc_lcnphy_common_read_table()
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 81284e86bf8849f8e98e8ead3ff5811926b2107f upstream.
+
+A new warning in clang [1] complains that diq_start in
+wlc_lcnphy_tx_iqlo_cal() is passed uninitialized as a const pointer to
+wlc_lcnphy_common_read_table():
+
+  drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c:2728:13: error: variable 'diq_start' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
+   2728 |                                                      &diq_start, 1, 16, 69);
+        |                                                       ^~~~~~~~~
+
+The table pointer passed to wlc_lcnphy_common_read_table() should not be
+considered constant, as wlc_phy_read_table() is ultimately going to
+update it. Remove the const qualifier from the tbl_ptr to clear up the
+warning.
+
+Cc: stable@vger.kernel.org
+Closes: https://github.com/ClangBuiltLinux/linux/issues/2108
+Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
+Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>>
+Link: https://patch.msgid.link/20250715-brcmsmac-fix-uninit-const-pointer-v1-1-16e6a51a8ef4@kernel.org
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
+@@ -974,7 +974,7 @@ void wlc_lcnphy_read_table(struct brcms_
+ static void
+ wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id,
+-                           const u16 *tbl_ptr, u32 tbl_len,
++                           u16 *tbl_ptr, u32 tbl_len,
+                            u32 tbl_width, u32 tbl_offset)
+ {
+       struct phytbl_info tab;
diff --git a/queue-5.4/zynq_fpga-use-sgtable-based-scatterlist-wrappers.patch b/queue-5.4/zynq_fpga-use-sgtable-based-scatterlist-wrappers.patch
new file mode 100644 (file)
index 0000000..288b4ed
--- /dev/null
@@ -0,0 +1,46 @@
+From 37e00703228ab44d0aacc32a97809a4f6f58df1b Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Mon, 16 Jun 2025 14:09:32 +0200
+Subject: zynq_fpga: use sgtable-based scatterlist wrappers
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+commit 37e00703228ab44d0aacc32a97809a4f6f58df1b upstream.
+
+Use common wrappers operating directly on the struct sg_table objects to
+fix incorrect use of statterlists related calls. dma_unmap_sg() function
+has to be called with the number of elements originally passed to the
+dma_map_sg() function, not the one returned in sgtable's nents.
+
+CC: stable@vger.kernel.org
+Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
+Reviewed-by: Xu Yilun <yilun.xu@intel.com>
+Link: https://lore.kernel.org/r/20250616120932.1090614-1-m.szyprowski@samsung.com
+Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/fpga/zynq-fpga.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/fpga/zynq-fpga.c
++++ b/drivers/fpga/zynq-fpga.c
+@@ -406,7 +406,7 @@ static int zynq_fpga_ops_write(struct fp
+       }
+       priv->dma_nelms =
+-          dma_map_sg(mgr->dev.parent, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
++          dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
+       if (priv->dma_nelms == 0) {
+               dev_err(&mgr->dev, "Unable to DMA map (TO_DEVICE)\n");
+               return -ENOMEM;
+@@ -478,7 +478,7 @@ out_clk:
+       clk_disable(priv->clk);
+ out_free:
+-      dma_unmap_sg(mgr->dev.parent, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
++      dma_unmap_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
+       return err;
+ }