From 452af71f36685c932a5cce540a48c1818df6533f Mon Sep 17 00:00:00 2001 From: Bryan Wu Date: Mon, 22 Oct 2007 00:02:14 +0800 Subject: [PATCH] Blackfin arch: dma add some API and cleanup bf54x DMA definition Signed-off-by: Bryan Wu --- arch/blackfin/kernel/bfin_dma_5xx.c | 26 +++++++++++++++++++ arch/blackfin/mach-bf548/dma.c | 1 + include/asm-blackfin/dma.h | 7 ++--- include/asm-blackfin/mach-bf548/defBF549.h | 2 +- .../asm-blackfin/mach-bf548/defBF54x_base.h | 2 +- include/asm-blackfin/mach-bf548/dma.h | 2 +- 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index e19164fb4cd1..503eef4c7fec 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c @@ -420,6 +420,32 @@ unsigned short get_dma_curr_ycount(unsigned int channel) } EXPORT_SYMBOL(get_dma_curr_ycount); +unsigned long get_dma_next_desc_ptr(unsigned int channel) +{ + BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE + && channel < MAX_BLACKFIN_DMA_CHANNEL)); + + return dma_ch[channel].regs->next_desc_ptr; +} +EXPORT_SYMBOL(get_dma_next_desc_ptr); + +unsigned long get_dma_curr_desc_ptr(unsigned int channel) +{ + BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE + && channel < MAX_BLACKFIN_DMA_CHANNEL)); + + return dma_ch[channel].regs->curr_desc_ptr; +} + +unsigned long get_dma_curr_addr(unsigned int channel) +{ + BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE + && channel < MAX_BLACKFIN_DMA_CHANNEL)); + + return dma_ch[channel].regs->curr_addr_ptr; +} +EXPORT_SYMBOL(get_dma_curr_addr); + static void *__dma_memcpy(void *dest, const void *src, size_t size) { int direction; /* 1 - address decrease, 0 - address increase */ diff --git a/arch/blackfin/mach-bf548/dma.c b/arch/blackfin/mach-bf548/dma.c index a8184113be48..957bf1366eff 100644 --- a/arch/blackfin/mach-bf548/dma.c +++ b/arch/blackfin/mach-bf548/dma.c @@ -64,6 +64,7 @@ (struct dma_register *) MDMA_D3_NEXT_DESC_PTR, (struct dma_register *) MDMA_S3_NEXT_DESC_PTR, }; +EXPORT_SYMBOL(base_addr); int channel2irq(unsigned int channel) { diff --git a/include/asm-blackfin/dma.h b/include/asm-blackfin/dma.h index b42a531e7a1b..b469505af364 100644 --- a/include/asm-blackfin/dma.h +++ b/include/asm-blackfin/dma.h @@ -109,9 +109,7 @@ struct dma_register { unsigned long curr_desc_ptr; /* DMA Current Descriptor Pointer register */ - unsigned short curr_addr_ptr_lo; /* DMA Current Address Pointer - register */ - unsigned short curr_addr_ptr_hi; /* DMA Current Address Pointer + unsigned long curr_addr_ptr; /* DMA Current Address Pointer register */ unsigned short irq_status; /* DMA irq status register */ unsigned short dummy6; @@ -166,6 +164,9 @@ void set_dma_curr_addr(unsigned int channel, unsigned long addr); unsigned short get_dma_curr_irqstat(unsigned int channel); unsigned short get_dma_curr_xcount(unsigned int channel); unsigned short get_dma_curr_ycount(unsigned int channel); +unsigned long get_dma_next_desc_ptr(unsigned int channel); +unsigned long get_dma_curr_desc_ptr(unsigned int channel); +unsigned long get_dma_curr_addr(unsigned int channel); /* set large DMA mode descriptor */ void set_dma_sg(unsigned int channel, struct dmasg *sg, int nr_sg); diff --git a/include/asm-blackfin/mach-bf548/defBF549.h b/include/asm-blackfin/mach-bf548/defBF549.h index 50b3fe55ef0c..4e46d657e50e 100644 --- a/include/asm-blackfin/mach-bf548/defBF549.h +++ b/include/asm-blackfin/mach-bf548/defBF549.h @@ -1178,7 +1178,7 @@ /* Bit masks for HOST_STATUS */ -#define READY 0x1 /* DMA Ready */ +#define DMA_READY 0x1 /* DMA Ready */ #define FIFOFULL 0x2 /* FIFO Full */ #define FIFOEMPTY 0x4 /* FIFO Empty */ #define DMA_COMPLETE 0x8 /* DMA Complete */ diff --git a/include/asm-blackfin/mach-bf548/defBF54x_base.h b/include/asm-blackfin/mach-bf548/defBF54x_base.h index d40db5cc5d5f..1d365c844ffe 100644 --- a/include/asm-blackfin/mach-bf548/defBF54x_base.h +++ b/include/asm-blackfin/mach-bf548/defBF54x_base.h @@ -3303,7 +3303,7 @@ #define MFD 0xf000 /* Multi channel Frame Delay */ #define FSDR 0x80 /* Frame Sync to Data Relationship */ -#define MCMEM 0x10 /* Multi channel Frame Mode Enable */ +#define MCMEN 0x10 /* Multi channel Frame Mode Enable */ #define MCDRXPE 0x8 /* Multi channel DMA Receive Packing */ #define MCDTXPE 0x4 /* Multi channel DMA Transmit Packing */ #define MCCRM 0x3 /* 2X Clock Recovery Mode */ diff --git a/include/asm-blackfin/mach-bf548/dma.h b/include/asm-blackfin/mach-bf548/dma.h index 14cb10cc24ae..4d97d3aa97cd 100644 --- a/include/asm-blackfin/mach-bf548/dma.h +++ b/include/asm-blackfin/mach-bf548/dma.h @@ -70,5 +70,5 @@ #define MAX_BLACKFIN_DMA_CHANNEL 32 extern int channel2irq(unsigned int channel); -extern struct dma_register *base_addr[]; +extern struct dma_register *base_addr[MAX_BLACKFIN_DMA_CHANNEL]; #endif -- 2.20.1