[PATCH RESEND v4 0/6] dmaengine: dw: Fix src/dst addr width misconfig

Serge Semin
2024-08-02T07:51:21Z

The main goal of this series is to fix the data disappearance in case of
the DW UART handled by the DW AHB DMA engine. The problem happens on a
portion of the data received when the pre-initialized DEV_TO_MEM
DMA-transfer is paused and then disabled. The data just hangs up in the
DMA-engine FIFO and isn't flushed out to the memory on the DMA-channel
suspension (see the second commit log for details). On a way to find the
denoted problem fix it was discovered that the driver doesn't verify the
peripheral device address width specified by a client driver, which in its
turn if unsupported or undefined value passed may cause DMA-transfer being
misconfigured. It's fixed in the first patch of the series.

In addition to that three cleanup patches follow the fixes described above
in order to make the DWC-engine configuration procedure more coherent.
First one simplifies the CTL_LO register setup methods. Second and third
patches simplify the max-burst calculation procedure and unify it with the
rest of the verification methods. Please see the patches log for more
details.

Final patch is another cleanup which unifies the status variables naming
in the driver.

Link: https://lore.kernel.org/dmaengine/20240416162908.24180-1-fancer.lancer@gmail.com/
Changelog v2:
- Add a note to the Patch #1 commit message about having the verification
method called in the dwc_config() function. (Andy)
- Add hyphen to "1byte" in the in-situ comment. (Andy)
- Convert "err" to "ret" variables and add a new patch which unifies the
status variables naming. (Andy)
- Add a in-situ comment regarding why the memory-side bus width
verification was required. (Andy)
- Group sms+dms and smsize+dmsize local variables initializations up. (Andy)
- Move the zero initializations out to the variables init block
in the prepare_ctllo() callbacks. (Andy)
- Directly refer to dwc_config() in the commit messages. (Andy)
- Convert dwc_verify_maxburst() to returning zero. (Andy)
- Add a comment regarding the values utilized in dwc_verify_p_buswidth()
being pre-verified before the method is called. (Andy)
- Add new patches:
[PATCH v2 4/6] dmaengine: dw: Define encode_maxburst() above prepare_ctllo() callbacks
[PATCH v2 6/6] dmaengine: dw: Unify ret-val local variable naming
(Andy)

Link: https://lore.kernel.org/dmaengine/20240419175655.25547-1-fancer.lancer@gmail.com/
Changelog v3:
- Rebase onto the kernel 6.10-rc4.
- Just resend.

Link: https://lore.kernel.org/dmaengine/20240627172231.24856-1-fancer.lancer@gmail.com/
Changelog v4:
- Rebase onto the kernel 6.11-rc1.
- Just resend.

base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: dmaengine@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Serge Semin (6):
dmaengine: dw: Add peripheral bus width verification
dmaengine: dw: Add memory bus width verification
dmaengine: dw: Simplify prepare CTL_LO methods
dmaengine: dw: Define encode_maxburst() above prepare_ctllo()
callbacks
dmaengine: dw: Simplify max-burst calculation procedure
dmaengine: dw: Unify ret-val local variables naming

drivers/dma/dw/core.c | 131 +++++++++++++++++++++++++++++++-------
drivers/dma/dw/dw.c | 40 +++++++-----
drivers/dma/dw/idma32.c | 19 +++---
drivers/dma/dw/platform.c | 20 +++---
drivers/dma/dw/regs.h | 1 -
5 files changed, 154 insertions(+), 57 deletions(-)

--
2.43.0