aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-10-24 20:31:08 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-11-02 23:37:19 +0100
commit9b96fcf9f6369982668d1d4cf68dca9453d28a56 (patch)
tree845e3129675b6eeb860e33edf1d47d4482731b6a /target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch
parent6e5ab1b154854e379f20fa6ed64cf4b656c985e7 (diff)
downloadupstream-9b96fcf9f6369982668d1d4cf68dca9453d28a56.tar.gz
upstream-9b96fcf9f6369982668d1d4cf68dca9453d28a56.tar.bz2
upstream-9b96fcf9f6369982668d1d4cf68dca9453d28a56.zip
pistachio: Copy kernel 5.4 patches to 5.10
This just copies the patches and the configuration from kernel 5.4 to kernel 5.10. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch')
-rw-r--r--target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch b/target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch
new file mode 100644
index 0000000000..031a4e3e5e
--- /dev/null
+++ b/target/linux/pistachio/patches-5.10/101-dmaengine-img-mdc-Handle-early-status-read.patch
@@ -0,0 +1,68 @@
+From a2dd154377c9aa6ddda00d39b8c7c334e4fa16ff Mon Sep 17 00:00:00 2001
+From: Damien Horsley <damien.horsley@imgtec.com>
+Date: Tue, 22 Mar 2016 12:46:09 +0000
+Subject: dmaengine: img-mdc: Handle early status read
+
+It is possible that mdc_tx_status may be called before the first
+node has been read from memory.
+
+In this case, the residue value stored in the register is undefined.
+Return the transfer size instead.
+
+Signed-off-by: Damien Horsley <damien.horsley@imgtec.com>
+---
+ drivers/dma/img-mdc-dma.c | 40 ++++++++++++++++++++++++----------------
+ 1 file changed, 24 insertions(+), 16 deletions(-)
+
+--- a/drivers/dma/img-mdc-dma.c
++++ b/drivers/dma/img-mdc-dma.c
+@@ -618,25 +618,33 @@ static enum dma_status mdc_tx_status(str
+ (MDC_CMDS_PROCESSED_CMDS_DONE_MASK + 1);
+
+ /*
+- * If the command loaded event hasn't been processed yet, then
+- * the difference above includes an extra command.
++ * If the first node has not yet been read from memory,
++ * the residue register value is undefined
+ */
+- if (!mdesc->cmd_loaded)
+- cmds--;
+- else
+- cmds += mdesc->list_cmds_done;
+-
+- bytes = mdesc->list_xfer_size;
+- ldesc = mdesc->list;
+- for (i = 0; i < cmds; i++) {
+- bytes -= ldesc->xfer_size + 1;
+- ldesc = ldesc->next_desc;
+- }
+- if (ldesc) {
+- if (residue != MDC_TRANSFER_SIZE_MASK)
+- bytes -= ldesc->xfer_size - residue;
++ if (!mdesc->cmd_loaded && !cmds) {
++ bytes = mdesc->list_xfer_size;
++ } else {
++ /*
++ * If the command loaded event hasn't been processed yet, then
++ * the difference above includes an extra command.
++ */
++ if (!mdesc->cmd_loaded)
++ cmds--;
+ else
++ cmds += mdesc->list_cmds_done;
++
++ bytes = mdesc->list_xfer_size;
++ ldesc = mdesc->list;
++ for (i = 0; i < cmds; i++) {
+ bytes -= ldesc->xfer_size + 1;
++ ldesc = ldesc->next_desc;
++ }
++ if (ldesc) {
++ if (residue != MDC_TRANSFER_SIZE_MASK)
++ bytes -= ldesc->xfer_size - residue;
++ else
++ bytes -= ldesc->xfer_size + 1;
++ }
+ }
+ }
+ spin_unlock_irqrestore(&mchan->vc.lock, flags);