From a1cde77c518fce237e7499bf5768afbba2defb92 Mon Sep 17 00:00:00 2001 From: davidjames Date: Thu, 28 Jun 2012 19:55:07 -0700 Subject: [PATCH] Revert "dma: Deprecate dma_start_tx() in favor of dma_prepare_tx()" This reverts commit 7af4172be4afad9d576549721a82b3a47d701647 / Iac605b879b3556f33af5585b298ada6bc4f52c90. This change bypassed the commit queue and broke daisy as a result. BUG=chrome-os-partner:10533 TEST=build and boot on snow Signed-off-by: Simon Glass Change-Id: I7a05ab42f71a901d167bde977f8a025c7ef62dfc Reviewed-on: https://gerrit.chromium.org/gerrit/26379 Reviewed-by: David James Tested-by: David James --- chip/stm32/dma.c | 14 +++++++------- chip/stm32/dma.h | 19 ++++--------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/chip/stm32/dma.c b/chip/stm32/dma.c index 8325d2edba..86a08af51c 100644 --- a/chip/stm32/dma.c +++ b/chip/stm32/dma.c @@ -72,19 +72,20 @@ static void prepare_channel(struct dma_channel *chan, unsigned count, ctrl |= 0 << 10; /* MSIZE (memory size in bytes) */ ctrl |= 1 << 8; /* PSIZE (16-bits for now) */ REG32(&chan->ccr) = ctrl; -} -void dma_go(struct dma_channel *chan) -{ /* Fire it up */ - REG32(&chan->ccr) |= DMA_EN; + ctrl |= DMA_EN; + REG32(&chan->ccr) = ctrl; } -void dma_prepare_tx(struct dma_channel *chan, unsigned count, void *periph, - const void *memory) +int dma_start_tx(unsigned channel, unsigned count, void *periph, + const void *memory) { + struct dma_channel *chan = dma_get_channel(channel); + prepare_channel(chan, count, periph, memory, DMA_MINC_MASK | DMA_DIR_FROM_MEM_MASK); + return 0; } int dma_start_rx(unsigned channel, unsigned count, void *periph, @@ -93,7 +94,6 @@ int dma_start_rx(unsigned channel, unsigned count, void *periph, struct dma_channel *chan = dma_get_channel(channel); prepare_channel(chan, count, periph, memory, DMA_MINC_MASK); - dma_go(chan); return 0; } diff --git a/chip/stm32/dma.h b/chip/stm32/dma.h index 1cc8a5009c..7ab24df756 100644 --- a/chip/stm32/dma.h +++ b/chip/stm32/dma.h @@ -84,18 +84,15 @@ enum { struct dma_channel *dma_get_channel(int channel); /** - * Prepare a DMA transfer to transmit data from memory to a peripheral + * Start a DMA transfer to transmit data from memory to a peripheral * - * Call dma_go() afterwards to actually start the transfer. - * - * @param chan Channel to prepare (use dma_get_channel()) + * @param channel Channel number to read (DMAC_...) * @param count Number of bytes to transfer * @param periph Pointer to peripheral data register * @param memory Pointer to memory address - * @return pointer to prepared channel */ -void dma_prepare_tx(struct dma_channel *chan, unsigned count, - void *periph, const void *memory); +int dma_start_tx(unsigned channel, unsigned count, void *periph, + const void *memory); /** * Start a DMA transfer to receive data to memory from a peripheral @@ -117,14 +114,6 @@ int dma_start_rx(unsigned channel, unsigned count, void *periph, */ void dma_disable(unsigned channel); -/** -/** - * Start a previously-prepared dma channel - * - * @param chan Channel to start (returned from dma_prepare...()) - */ -void dma_go(struct dma_channel *chan); - /** * Testing: Print out the data transferred by a channel *