diff options
author | Tom Hughes <tomhughes@chromium.org> | 2019-08-02 10:19:43 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-13 00:46:05 +0000 |
commit | 4609b59404bd6e32c4cdb267658511a46557dab2 (patch) | |
tree | fd2182960546330dd7b0d222e49d29be6a4643c1 /chip/mec1322 | |
parent | d09bc18d46c37070e3309b4f72a33d27134dea45 (diff) | |
download | chrome-ec-4609b59404bd6e32c4cdb267658511a46557dab2.tar.gz |
dma: separate out DMA enable status from wait_for_bytes
When wait_for_bytes returns 0 when DMA is disabled, we can't
differentiate between DMA being disabled and a transfer having completed
when it has reached the end of the requested transfer. Separating out
into separate functions lets us distinguish the two cases.
The reason we didn't hit this in the past is that the requested receive
size is generally larger than the actual amount we're sending. Since we
know the amount that we're waiting for from the header, we would stop
the transfer in software.
BRANCH=none
BUG=b:132444384
TEST=On DUTs with bloonchipper and dartmonkey:
ectool --name=cros_fp testmaxtransfer
TEST=make buildall -j
Change-Id: I885161a3e04b7a12d597d8dc8691f599990bda8b
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1734010
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'chip/mec1322')
-rw-r--r-- | chip/mec1322/dma.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chip/mec1322/dma.c b/chip/mec1322/dma.c index ff5a0385c0..a6c6fed5ad 100644 --- a/chip/mec1322/dma.c +++ b/chip/mec1322/dma.c @@ -119,11 +119,14 @@ int dma_bytes_done(mec1322_dma_chan_t *chan, int orig_count) { int xfer_size = (chan->ctrl >> 20) & 0x7; - if (!(chan->ctrl & MEC1322_DMA_RUN)) - return 0; return orig_count - (chan->mem_end - chan->mem_start) / xfer_size; } +bool dma_is_enabled(mec1322_dma_chan_t *chan) +{ + return (chan->ctrl & MEC1322_DMA_RUN); +} + void dma_init(void) { mec1322_dma_regs_t *dma = MEC1322_DMA_REGS; |