diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2014-04-28 06:49:43 -0400 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2014-04-30 01:04:39 -0400 |
| commit | cdae05a0f0f7d15837dfd6f4200e8caea03c9cbf (patch) | |
| tree | 9513241fb0020ad9cbd0b2e2fa36f707e09b864b | |
| parent | c2da2340e5818aa72b2e847f1f24b036742ea5c7 (diff) | |
dmaengine: edma: Make reading the position of active channels work
As Joel pointed out, edma_read_position() uses memcpy_fromio() to read
the parameter ram. That's not synchronized with the internal update as
it does a byte by byte copy. We need to do a 32bit read to get a
consistent value.
Further reading destination and source is pointless. In DEV_TO_MEM
transfers we are only interested in the destination, in MEM_TO_DEV we
care about the source. In MEM_TO_MEM it really does not matter which
one you read.
Simple solution: Remove the pointers, select dest/source via a bool
and return the read value.
Remove the export of this function while at it. The only potential
user is the dmaengine and that's always builtin.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
| -rw-r--r-- | arch/arm/common/edma.c | 24 | ||||
| -rw-r--r-- | include/linux/platform_data/edma.h | 2 |
2 files changed, 10 insertions, 16 deletions
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 0b37f7734d0f..25fa735abc6c 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c | |||
| @@ -994,29 +994,23 @@ void edma_set_dest(unsigned slot, dma_addr_t dest_port, | |||
| 994 | EXPORT_SYMBOL(edma_set_dest); | 994 | EXPORT_SYMBOL(edma_set_dest); |
| 995 | 995 | ||
| 996 | /** | 996 | /** |
| 997 | * edma_get_position - returns the current transfer points | 997 | * edma_get_position - returns the current transfer point |
| 998 | * @slot: parameter RAM slot being examined | 998 | * @slot: parameter RAM slot being examined |
| 999 | * @src: pointer to source port position | 999 | * @dst: true selects the dest position, false the source |
| 1000 | * @dst: pointer to destination port position | ||
| 1001 | * | 1000 | * |
| 1002 | * Returns current source and destination addresses for a particular | 1001 | * Returns the position of the current active slot |
| 1003 | * parameter RAM slot. Its channel should not be active when this is called. | ||
| 1004 | */ | 1002 | */ |
| 1005 | void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst) | 1003 | dma_addr_t edma_get_position(unsigned slot, bool dst) |
| 1006 | { | 1004 | { |
| 1007 | struct edmacc_param temp; | 1005 | u32 offs, ctlr = EDMA_CTLR(slot); |
| 1008 | unsigned ctlr; | ||
| 1009 | 1006 | ||
| 1010 | ctlr = EDMA_CTLR(slot); | ||
| 1011 | slot = EDMA_CHAN_SLOT(slot); | 1007 | slot = EDMA_CHAN_SLOT(slot); |
| 1012 | 1008 | ||
| 1013 | edma_read_slot(EDMA_CTLR_CHAN(ctlr, slot), &temp); | 1009 | offs = PARM_OFFSET(slot); |
| 1014 | if (src != NULL) | 1010 | offs += dst ? PARM_DST : PARM_SRC; |
| 1015 | *src = temp.src; | 1011 | |
| 1016 | if (dst != NULL) | 1012 | return edma_read(ctlr, offs); |
| 1017 | *dst = temp.dst; | ||
| 1018 | } | 1013 | } |
| 1019 | EXPORT_SYMBOL(edma_get_position); | ||
| 1020 | 1014 | ||
| 1021 | /** | 1015 | /** |
| 1022 | * edma_set_src_index - configure DMA source address indexing | 1016 | * edma_set_src_index - configure DMA source address indexing |
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h index 923f8a3e4ce0..12f134b1493c 100644 --- a/include/linux/platform_data/edma.h +++ b/include/linux/platform_data/edma.h | |||
| @@ -130,7 +130,7 @@ void edma_set_src(unsigned slot, dma_addr_t src_port, | |||
| 130 | enum address_mode mode, enum fifo_width); | 130 | enum address_mode mode, enum fifo_width); |
| 131 | void edma_set_dest(unsigned slot, dma_addr_t dest_port, | 131 | void edma_set_dest(unsigned slot, dma_addr_t dest_port, |
| 132 | enum address_mode mode, enum fifo_width); | 132 | enum address_mode mode, enum fifo_width); |
| 133 | void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst); | 133 | dma_addr_t edma_get_position(unsigned slot, bool dst); |
| 134 | void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx); | 134 | void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx); |
| 135 | void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx); | 135 | void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx); |
| 136 | void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt, | 136 | void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt, |
