summaryrefslogtreecommitdiff
path: root/chip/mec1322/dma.c
diff options
context:
space:
mode:
authorDivya Jyothi <divya.jyothi@intel.com>2014-10-27 15:03:06 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-20 23:03:49 +0000
commitad0069268f37113eb0e4dccb93a94cfe7f5a6779 (patch)
treea5c35075b32b677538023cbb27aef3fa7eaadfec /chip/mec1322/dma.c
parent1291eb4b1dafead1d6910ea0032ebbb3f31a612d (diff)
downloadchrome-ec-ad0069268f37113eb0e4dccb93a94cfe7f5a6779.tar.gz
Strago: Spi support added on Private SPI lines
BUG=None TEST=Tested on Braswell Reference Design BRANCH=None Change-Id: Idc064e1af837e5e6a1bf4174885bd10624f463d2 Signed-off-by: Divya Jyothi <divya.jyothi@intel.com> Reviewed-on: https://chromium-review.googlesource.com/226297 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Divya Jyothi <zdivyajyothi@gmail.com> Tested-by: Divya Jyothi <zdivyajyothi@gmail.com>
Diffstat (limited to 'chip/mec1322/dma.c')
-rw-r--r--chip/mec1322/dma.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/mec1322/dma.c b/chip/mec1322/dma.c
index c064003544..53e09122af 100644
--- a/chip/mec1322/dma.c
+++ b/chip/mec1322/dma.c
@@ -29,6 +29,9 @@ void dma_disable(enum dma_channel channel)
if (chan->ctrl & (1 << 0))
chan->ctrl &= ~(1 << 0);
+
+ if (chan->act == 1)
+ chan->act = 0;
}
/**
@@ -83,7 +86,9 @@ void dma_prepare_tx(const struct dma_option *option, unsigned count,
void dma_start_rx(const struct dma_option *option, unsigned count,
void *memory)
{
- mec1322_dma_chan_t *chan = dma_get_channel(option->channel);
+ mec1322_dma_chan_t *chan;
+
+ chan = dma_get_channel(option->channel);
prepare_channel(chan, count, option->periph, memory,
MEC1322_DMA_INC_MEM | MEC1322_DMA_DEV(option->channel) |
@@ -111,6 +116,9 @@ int dma_wait(enum dma_channel channel)
mec1322_dma_chan_t *chan = dma_get_channel(channel);
timestamp_t deadline;
+ if (chan->act == 0)
+ return EC_SUCCESS;
+
deadline.val = get_time().val + DMA_TRANSFER_TIMEOUT_US;
while (!(chan->int_status & 0x4)) {
if (deadline.val <= get_time().val)