linux/include/linux/dma
Md Sadre Alam 867621ba20 dmaengine: qcom: bam_dma: Fix command element mask field for BAM v1.6.0+
BAM version 1.6.0 and later changed the behavior of the mask field in
command elements for read operations.

In older BAM versions, or prior implementation assumptions, the mask
field was effectively ignored for read commands. However, starting from
BAM v1.6.0, the mask field for read commands is repurposed to carry the
upper 4 bits of the destination address, enabling support for 36-bit
addressing. For write commands, the mask field continues to function as
a traditional write mask.

The current driver sets mask = 0xffffffff for all command elements.
While this works for write operations, it breaks read operations on
BAM v1.6.0+ hardware. In such cases, the hardware interprets the upper
address bits as 0xf, resulting in an invalid destination address
(0xf_xxxxxxxx instead of 0x0_xxxxxxxx).

This leads to failures such as NAND enumeration issues observed on
platforms like IPQ5424.

Fix this by assigning the mask field based on command type:
  - For read commands: set mask = 0 (upper address bits = 0)
  - For write commands: retain mask = 0xffffffff

Also update the bam_cmd_element structure documentation to reflect the
dual purpose of the mask field across BAM versions.

This ensures correct behavior on BAM v1.6.0+ while maintaining backward
compatibility with older hardware.

Fixes: dfebb055f7 ("dmaengine: qcom: bam_dma: wrapper functions for command descriptor")
Tested-by: Lakshmi Sowjanya D <lakshmi.d@oss.qualcomm.com>
Signed-off-by: Md Sadre Alam <md.alam@oss.qualcomm.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260615060908.1263171-1-varadarajan.narayanan@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-02 21:20:10 +05:30
..
amd_xdma.h dmaengine: xilinx: xdma: Add user logic interrupt support 2023-02-10 11:32:26 +05:30
dw.h dmaengine: dw: convert to SPDX identifiers 2019-01-07 17:57:13 +05:30
edma.h dmaengine: dw-edma: Add non-LL mode 2026-03-18 15:11:40 +05:30
hsu.h dmaengine: hsu: Include headers we are direct user of 2022-09-04 22:49:35 +05:30
idma64.h dmaengine: idma64: Move driver name to the header 2019-04-26 16:55:23 +05:30
imx-dma.h dmaengine: imx-sdma: Add i2c dma support 2024-04-25 14:41:18 +05:30
k3-event-router.h dmaengine: ti: Add support for k3 event routers 2020-12-11 21:20:09 +05:30
k3-psil.h dmaengine: ti: k3-psil: optimize struct psil_endpoint_config for size 2021-02-01 11:29:11 +05:30
k3-udma-glue.h dmaengine: ti: k3-udma-glue: Drop skip_fdq argument from k3_udma_glue_reset_rx_chn 2025-02-27 12:38:23 +05:30
mxs-dma.h mtd: rawnand: gpmi: Implement exec_op 2019-06-27 20:05:30 +02:00
pxa-dma.h dmaengine: pxa: make the filter function internal 2018-12-03 22:41:07 +01:00
qcom_adm.h dmaengine: qcom-adm: stop abusing slave_id config 2021-12-17 11:23:56 +05:30
qcom_bam_dma.h dmaengine: qcom: bam_dma: Fix command element mask field for BAM v1.6.0+ 2026-07-02 21:20:10 +05:30
qcom-gpi-dma.h dmaengine: qcom: qcom-gpi-dma.h: fix all kernel-doc warnings 2026-03-09 08:28:22 +01:00
sprd-dma.h dmaengine: sprd: Add wrap address support for link-list mode 2019-11-14 16:03:35 +05:30
ti-cppi5.h dmaengine: ti-cppi5: fix all kernel-doc warnings 2026-03-09 08:28:22 +01:00
xilinx_dma.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 40 2019-05-24 17:27:12 +02:00
xilinx_dpdma.h dmaengine: xilinx_dpdma: use correct SDPX tag for header file 2022-01-03 17:05:02 +05:30