diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-10-09 22:18:12 (GMT) |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-12-15 05:14:18 (GMT) |
commit | d2e015d65fc692475b8513259d6afacd2cded8e8 (patch) | |
tree | e296f8daa8a7ba957d0ae080c71212f77172d382 /arch/blackfin/include | |
parent | adfc046740b4161cbb1f0a3ea0d4200e21113489 (diff) | |
download | linux-fsl-qoriq-d2e015d65fc692475b8513259d6afacd2cded8e8.tar.xz |
Blackfin: convert DMA mutex to an atomic and drop redundant code
The DMA channel status field was encoding redundant info wrt the DMA MMR
config register, and it was doing an incomplete job of checking all DMA
channels (some drivers write directly to the config register). So drop
the tristate field in favor of a binary atomic field. This simplifies
the code in general, removes the implicit need for sleeping, and forces
the suspend code to handle all channels properly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r-- | arch/blackfin/include/asm/dma.h | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h index c9a5962..e3c0dfa 100644 --- a/arch/blackfin/include/asm/dma.h +++ b/arch/blackfin/include/asm/dma.h @@ -10,6 +10,7 @@ #include <linux/interrupt.h> #include <mach/dma.h> +#include <asm/atomic.h> #include <asm/blackfin.h> #include <asm/page.h> @@ -19,11 +20,6 @@ * Generic DMA Declarations * ****************************************************************************/ -enum dma_chan_status { - DMA_CHANNEL_FREE, - DMA_CHANNEL_REQUESTED, - DMA_CHANNEL_ENABLED, -}; /*------------------------- * config reg bits value @@ -104,11 +100,9 @@ struct dma_register { }; -struct mutex; struct dma_channel { - struct mutex dmalock; const char *device_id; - enum dma_chan_status chan_status; + atomic_t chan_status; volatile struct dma_register *regs; struct dmasg *sg; /* large mode descriptor */ unsigned int irq; @@ -220,24 +214,19 @@ static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize static inline int dma_channel_active(unsigned int channel) { - if (dma_ch[channel].chan_status == DMA_CHANNEL_FREE) - return 0; - else - return 1; + return atomic_read(&dma_ch[channel].chan_status); } static inline void disable_dma(unsigned int channel) { dma_ch[channel].regs->cfg &= ~DMAEN; SSYNC(); - dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED; } static inline void enable_dma(unsigned int channel) { dma_ch[channel].regs->curr_x_count = 0; dma_ch[channel].regs->curr_y_count = 0; dma_ch[channel].regs->cfg |= DMAEN; - dma_ch[channel].chan_status = DMA_CHANNEL_ENABLED; } void free_dma(unsigned int channel); int request_dma(unsigned int channel, const char *device_id); |