aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/bfin_dma_5xx.c
diff options
context:
space:
mode:
authorGraf Yang <graf.yang@analog.com>2009-01-07 10:14:39 -0500
committerBryan Wu <cooloney@kernel.org>2009-01-07 10:14:39 -0500
commitd642a8ad55baee675b14dc4f36fc871a2588c7d1 (patch)
treef8177b51ecaee947e7c6f63ff6c7f38f0299b52b /arch/blackfin/kernel/bfin_dma_5xx.c
parentdbc895f95500a73ebf1ff12fe85f2e2b3790f52f (diff)
Blackfin arch: implement support for /proc/dma
Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel/bfin_dma_5xx.c')
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index a778bc80dc52..2625aa20a92c 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -29,7 +29,9 @@
29 29
30#include <linux/errno.h> 30#include <linux/errno.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/proc_fs.h>
32#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/seq_file.h>
33#include <linux/interrupt.h> 35#include <linux/interrupt.h>
34#include <linux/kernel.h> 36#include <linux/kernel.h>
35#include <linux/param.h> 37#include <linux/param.h>
@@ -67,26 +69,60 @@ static int __init blackfin_dma_init(void)
67 mutex_init(&(dma_ch[i].dmalock)); 69 mutex_init(&(dma_ch[i].dmalock));
68 } 70 }
69 /* Mark MEMDMA Channel 0 as requested since we're using it internally */ 71 /* Mark MEMDMA Channel 0 as requested since we're using it internally */
70 dma_ch[CH_MEM_STREAM0_DEST].chan_status = DMA_CHANNEL_REQUESTED; 72 request_dma(CH_MEM_STREAM0_DEST, "Blackfin dma_memcpy");
71 dma_ch[CH_MEM_STREAM0_SRC].chan_status = DMA_CHANNEL_REQUESTED; 73 request_dma(CH_MEM_STREAM0_SRC, "Blackfin dma_memcpy");
72 74
73#if defined(CONFIG_DEB_DMA_URGENT) 75#if defined(CONFIG_DEB_DMA_URGENT)
74 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() 76 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE()
75 | DEB1_URGENT | DEB2_URGENT | DEB3_URGENT); 77 | DEB1_URGENT | DEB2_URGENT | DEB3_URGENT);
76#endif 78#endif
79
77 return 0; 80 return 0;
78} 81}
79
80arch_initcall(blackfin_dma_init); 82arch_initcall(blackfin_dma_init);
81 83
84#ifdef CONFIG_PROC_FS
85
86static int proc_dma_show(struct seq_file *m, void *v)
87{
88 int i;
89
90 for (i = 0 ; i < MAX_BLACKFIN_DMA_CHANNEL; ++i)
91 if (dma_ch[i].chan_status != DMA_CHANNEL_FREE)
92 seq_printf(m, "%2d: %s\n", i, dma_ch[i].device_id);
93
94 return 0;
95}
96
97static int proc_dma_open(struct inode *inode, struct file *file)
98{
99 return single_open(file, proc_dma_show, NULL);
100}
101
102static const struct file_operations proc_dma_operations = {
103 .open = proc_dma_open,
104 .read = seq_read,
105 .llseek = seq_lseek,
106 .release = single_release,
107};
108
109static int __init proc_dma_init(void)
110{
111 return proc_create("dma", 0, NULL, &proc_dma_operations) != NULL;
112}
113late_initcall(proc_dma_init);
114#endif
115
82/*------------------------------------------------------------------------------ 116/*------------------------------------------------------------------------------
83 * Request the specific DMA channel from the system. 117 * Request the specific DMA channel from the system.
84 *-----------------------------------------------------------------------------*/ 118 *-----------------------------------------------------------------------------*/
85int request_dma(unsigned int channel, char *device_id) 119int request_dma(unsigned int channel, char *device_id)
86{ 120{
87
88 pr_debug("request_dma() : BEGIN \n"); 121 pr_debug("request_dma() : BEGIN \n");
89 122
123 if (device_id == NULL)
124 printk(KERN_WARNING "request_dma(%u): no device_id given\n", channel);
125
90#if defined(CONFIG_BF561) && ANOMALY_05000182 126#if defined(CONFIG_BF561) && ANOMALY_05000182
91 if (channel >= CH_IMEM_STREAM0_DEST && channel <= CH_IMEM_STREAM1_DEST) { 127 if (channel >= CH_IMEM_STREAM0_DEST && channel <= CH_IMEM_STREAM1_DEST) {
92 if (get_cclk() > 500000000) { 128 if (get_cclk() > 500000000) {