diff options
author | Aseda Aboagye <aaboagye@google.com> | 2015-10-19 13:37:40 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-19 21:26:50 -0700 |
commit | ab24609287462400c3f23cd86e71b32c5242c57f (patch) | |
tree | 7e13c7787aa7aedc4579fde4526e7afa30dac6dc | |
parent | 2b82f806352d3bc811a9c7692904ff1bf9b64109 (diff) | |
download | chrome-ec-ab24609287462400c3f23cd86e71b32c5242c57f.tar.gz |
mec1322: Abort curr DMA xfer in dma_disable_all().
When we call dma_disable_all(), we should abort any current transaction
on a channel in addition to disabling the channel. Simply disabling the
channel will ignore any future requests, but a DMA operation may be
ongoing. Lastly, soft-reset the block so that it's a clean state next
time we want to use it.
BUG=None
BRANCH=None
TEST=Enable CONFIG_REPLACE_LOADER_WITH_BSS_SLOW on GLaDOS and add a few
items to the section. 'sysjump' between RO and RW a few times without
encountering a forced hard fault.
TEST=make -j buildall tests
Change-Id: Ia05702b928fbb12265b16d785b6e6dac09807582
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/306915
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | chip/mec1322/dma.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/mec1322/dma.c b/chip/mec1322/dma.c index afd76aedc4..b354fea2a4 100644 --- a/chip/mec1322/dma.c +++ b/chip/mec1322/dma.c @@ -37,12 +37,20 @@ void dma_disable(enum dma_channel channel) void dma_disable_all(void) { int ch; + mec1322_dma_regs_t *dma; for (ch = 0; ch < MEC1322_DMAC_COUNT; ch++) { mec1322_dma_chan_t *chan = dma_get_channel(ch); + /* Abort any current transfer. */ + chan->ctrl |= (1 << 25); + /* Disable the channel. */ chan->ctrl &= ~(1 << 0); chan->act = 0; } + + /* Soft-reset the block. */ + dma = MEC1322_DMA_REGS; + dma->ctrl |= 0x2; } /** |