Blame view

drivers/dma/sirf-dma.c 25.3 KB
ca21a146a   Rongjun Ying   dmaengine: add CS...
1
2
3
4
5
6
7
8
9
10
11
  /*
   * DMA controller driver for CSR SiRFprimaII
   *
   * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
   *
   * Licensed under GPLv2 or later.
   */
  
  #include <linux/module.h>
  #include <linux/dmaengine.h>
  #include <linux/dma-mapping.h>
2a76689bc   Barry Song   dmaengine: sirf: ...
12
  #include <linux/pm_runtime.h>
ca21a146a   Rongjun Ying   dmaengine: add CS...
13
14
15
16
17
18
19
  #include <linux/interrupt.h>
  #include <linux/io.h>
  #include <linux/slab.h>
  #include <linux/of_irq.h>
  #include <linux/of_address.h>
  #include <linux/of_device.h>
  #include <linux/of_platform.h>
a7e340657   Barry Song   dmaengine:sirf:ta...
20
  #include <linux/clk.h>
2e041c946   Barry Song   dmaengine: sirf: ...
21
  #include <linux/of_dma.h>
ca21a146a   Rongjun Ying   dmaengine: add CS...
22
  #include <linux/sirfsoc_dma.h>
949ff5b8d   Vinod Koul   dmaengine: fix fo...
23
  #include "dmaengine.h"
ca21a146a   Rongjun Ying   dmaengine: add CS...
24
25
26
27
28
29
30
31
32
33
34
35
  #define SIRFSOC_DMA_DESCRIPTORS                 16
  #define SIRFSOC_DMA_CHANNELS                    16
  
  #define SIRFSOC_DMA_CH_ADDR                     0x00
  #define SIRFSOC_DMA_CH_XLEN                     0x04
  #define SIRFSOC_DMA_CH_YLEN                     0x08
  #define SIRFSOC_DMA_CH_CTRL                     0x0C
  
  #define SIRFSOC_DMA_WIDTH_0                     0x100
  #define SIRFSOC_DMA_CH_VALID                    0x140
  #define SIRFSOC_DMA_CH_INT                      0x144
  #define SIRFSOC_DMA_INT_EN                      0x148
f7d935dcc   Barry Song   dmaengine: sirf: ...
36
  #define SIRFSOC_DMA_INT_EN_CLR			0x14C
ca21a146a   Rongjun Ying   dmaengine: add CS...
37
  #define SIRFSOC_DMA_CH_LOOP_CTRL                0x150
f7d935dcc   Barry Song   dmaengine: sirf: ...
38
  #define SIRFSOC_DMA_CH_LOOP_CTRL_CLR            0x15C
ca21a146a   Rongjun Ying   dmaengine: add CS...
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  
  #define SIRFSOC_DMA_MODE_CTRL_BIT               4
  #define SIRFSOC_DMA_DIR_CTRL_BIT                5
  
  /* xlen and dma_width register is in 4 bytes boundary */
  #define SIRFSOC_DMA_WORD_LEN			4
  
  struct sirfsoc_dma_desc {
  	struct dma_async_tx_descriptor	desc;
  	struct list_head		node;
  
  	/* SiRFprimaII 2D-DMA parameters */
  
  	int             xlen;           /* DMA xlen */
  	int             ylen;           /* DMA ylen */
  	int             width;          /* DMA width */
  	int             dir;
  	bool            cyclic;         /* is loop DMA? */
  	u32             addr;		/* DMA buffer address */
  };
  
  struct sirfsoc_dma_chan {
  	struct dma_chan			chan;
  	struct list_head		free;
  	struct list_head		prepared;
  	struct list_head		queued;
  	struct list_head		active;
  	struct list_head		completed;
ca21a146a   Rongjun Ying   dmaengine: add CS...
67
68
69
70
71
72
73
74
  	unsigned long			happened_cyclic;
  	unsigned long			completed_cyclic;
  
  	/* Lock for this structure */
  	spinlock_t			lock;
  
  	int				mode;
  };
2a76689bc   Barry Song   dmaengine: sirf: ...
75
76
77
78
  struct sirfsoc_dma_regs {
  	u32				ctrl[SIRFSOC_DMA_CHANNELS];
  	u32				interrupt_en;
  };
ca21a146a   Rongjun Ying   dmaengine: add CS...
79
80
81
82
83
84
  struct sirfsoc_dma {
  	struct dma_device		dma;
  	struct tasklet_struct		tasklet;
  	struct sirfsoc_dma_chan		channels[SIRFSOC_DMA_CHANNELS];
  	void __iomem			*base;
  	int				irq;
a7e340657   Barry Song   dmaengine:sirf:ta...
85
  	struct clk			*clk;
f7d935dcc   Barry Song   dmaengine: sirf: ...
86
  	bool				is_marco;
2a76689bc   Barry Song   dmaengine: sirf: ...
87
  	struct sirfsoc_dma_regs		regs_save;
ca21a146a   Rongjun Ying   dmaengine: add CS...
88
89
90
  };
  
  #define DRV_NAME	"sirfsoc_dma"
2a76689bc   Barry Song   dmaengine: sirf: ...
91
  static int sirfsoc_dma_runtime_suspend(struct device *dev);
ca21a146a   Rongjun Ying   dmaengine: add CS...
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  /* Convert struct dma_chan to struct sirfsoc_dma_chan */
  static inline
  struct sirfsoc_dma_chan *dma_chan_to_sirfsoc_dma_chan(struct dma_chan *c)
  {
  	return container_of(c, struct sirfsoc_dma_chan, chan);
  }
  
  /* Convert struct dma_chan to struct sirfsoc_dma */
  static inline struct sirfsoc_dma *dma_chan_to_sirfsoc_dma(struct dma_chan *c)
  {
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(c);
  	return container_of(schan, struct sirfsoc_dma, channels[c->chan_id]);
  }
  
  /* Execute all queued DMA descriptors */
  static void sirfsoc_dma_execute(struct sirfsoc_dma_chan *schan)
  {
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(&schan->chan);
  	int cid = schan->chan.chan_id;
  	struct sirfsoc_dma_desc *sdesc = NULL;
  
  	/*
  	 * lock has been held by functions calling this, so we don't hold
  	 * lock again
  	 */
  
  	sdesc = list_first_entry(&schan->queued, struct sirfsoc_dma_desc,
  		node);
  	/* Move the first queued descriptor to active list */
26fd12209   Barry Song   dmaengine: sirf: ...
121
  	list_move_tail(&sdesc->node, &schan->active);
ca21a146a   Rongjun Ying   dmaengine: add CS...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
  
  	/* Start the DMA transfer */
  	writel_relaxed(sdesc->width, sdma->base + SIRFSOC_DMA_WIDTH_0 +
  		cid * 4);
  	writel_relaxed(cid | (schan->mode << SIRFSOC_DMA_MODE_CTRL_BIT) |
  		(sdesc->dir << SIRFSOC_DMA_DIR_CTRL_BIT),
  		sdma->base + cid * 0x10 + SIRFSOC_DMA_CH_CTRL);
  	writel_relaxed(sdesc->xlen, sdma->base + cid * 0x10 +
  		SIRFSOC_DMA_CH_XLEN);
  	writel_relaxed(sdesc->ylen, sdma->base + cid * 0x10 +
  		SIRFSOC_DMA_CH_YLEN);
  	writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN) |
  		(1 << cid), sdma->base + SIRFSOC_DMA_INT_EN);
  
  	/*
  	 * writel has an implict memory write barrier to make sure data is
  	 * flushed into memory before starting DMA
  	 */
  	writel(sdesc->addr >> 2, sdma->base + cid * 0x10 + SIRFSOC_DMA_CH_ADDR);
  
  	if (sdesc->cyclic) {
  		writel((1 << cid) | 1 << (cid + 16) |
  			readl_relaxed(sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL),
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL);
  		schan->happened_cyclic = schan->completed_cyclic = 0;
  	}
  }
  
  /* Interrupt handler */
  static irqreturn_t sirfsoc_dma_irq(int irq, void *data)
  {
  	struct sirfsoc_dma *sdma = data;
  	struct sirfsoc_dma_chan *schan;
  	struct sirfsoc_dma_desc *sdesc = NULL;
  	u32 is;
  	int ch;
  
  	is = readl(sdma->base + SIRFSOC_DMA_CH_INT);
  	while ((ch = fls(is) - 1) >= 0) {
  		is &= ~(1 << ch);
  		writel_relaxed(1 << ch, sdma->base + SIRFSOC_DMA_CH_INT);
  		schan = &sdma->channels[ch];
  
  		spin_lock(&schan->lock);
  
  		sdesc = list_first_entry(&schan->active, struct sirfsoc_dma_desc,
  			node);
  		if (!sdesc->cyclic) {
  			/* Execute queued descriptors */
  			list_splice_tail_init(&schan->active, &schan->completed);
  			if (!list_empty(&schan->queued))
  				sirfsoc_dma_execute(schan);
  		} else
  			schan->happened_cyclic++;
  
  		spin_unlock(&schan->lock);
  	}
  
  	/* Schedule tasklet */
  	tasklet_schedule(&sdma->tasklet);
  
  	return IRQ_HANDLED;
  }
  
  /* process completed descriptors */
  static void sirfsoc_dma_process_completed(struct sirfsoc_dma *sdma)
  {
  	dma_cookie_t last_cookie = 0;
  	struct sirfsoc_dma_chan *schan;
  	struct sirfsoc_dma_desc *sdesc;
  	struct dma_async_tx_descriptor *desc;
  	unsigned long flags;
  	unsigned long happened_cyclic;
  	LIST_HEAD(list);
  	int i;
  
  	for (i = 0; i < sdma->dma.chancnt; i++) {
  		schan = &sdma->channels[i];
  
  		/* Get all completed descriptors */
  		spin_lock_irqsave(&schan->lock, flags);
  		if (!list_empty(&schan->completed)) {
  			list_splice_tail_init(&schan->completed, &list);
  			spin_unlock_irqrestore(&schan->lock, flags);
  
  			/* Execute callbacks and run dependencies */
  			list_for_each_entry(sdesc, &list, node) {
  				desc = &sdesc->desc;
  
  				if (desc->callback)
  					desc->callback(desc->callback_param);
  
  				last_cookie = desc->cookie;
  				dma_run_dependencies(desc);
  			}
  
  			/* Free descriptors */
  			spin_lock_irqsave(&schan->lock, flags);
  			list_splice_tail_init(&list, &schan->free);
4d4e58de3   Russell King - ARM Linux   dmaengine: move l...
221
  			schan->chan.completed_cookie = last_cookie;
ca21a146a   Rongjun Ying   dmaengine: add CS...
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
  			spin_unlock_irqrestore(&schan->lock, flags);
  		} else {
  			/* for cyclic channel, desc is always in active list */
  			sdesc = list_first_entry(&schan->active, struct sirfsoc_dma_desc,
  				node);
  
  			if (!sdesc || (sdesc && !sdesc->cyclic)) {
  				/* without active cyclic DMA */
  				spin_unlock_irqrestore(&schan->lock, flags);
  				continue;
  			}
  
  			/* cyclic DMA */
  			happened_cyclic = schan->happened_cyclic;
  			spin_unlock_irqrestore(&schan->lock, flags);
  
  			desc = &sdesc->desc;
  			while (happened_cyclic != schan->completed_cyclic) {
  				if (desc->callback)
  					desc->callback(desc->callback_param);
  				schan->completed_cyclic++;
  			}
  		}
  	}
  }
  
  /* DMA Tasklet */
  static void sirfsoc_dma_tasklet(unsigned long data)
  {
  	struct sirfsoc_dma *sdma = (void *)data;
  
  	sirfsoc_dma_process_completed(sdma);
  }
  
  /* Submit descriptor to hardware */
  static dma_cookie_t sirfsoc_dma_tx_submit(struct dma_async_tx_descriptor *txd)
  {
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(txd->chan);
  	struct sirfsoc_dma_desc *sdesc;
  	unsigned long flags;
  	dma_cookie_t cookie;
  
  	sdesc = container_of(txd, struct sirfsoc_dma_desc, desc);
  
  	spin_lock_irqsave(&schan->lock, flags);
  
  	/* Move descriptor to queue */
  	list_move_tail(&sdesc->node, &schan->queued);
884485e1f   Russell King - ARM Linux   dmaengine: consol...
270
  	cookie = dma_cookie_assign(txd);
ca21a146a   Rongjun Ying   dmaengine: add CS...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
  
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	return cookie;
  }
  
  static int sirfsoc_dma_slave_config(struct sirfsoc_dma_chan *schan,
  	struct dma_slave_config *config)
  {
  	unsigned long flags;
  
  	if ((config->src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES) ||
  		(config->dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES))
  		return -EINVAL;
  
  	spin_lock_irqsave(&schan->lock, flags);
  	schan->mode = (config->src_maxburst == 4 ? 1 : 0);
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	return 0;
  }
  
  static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan)
  {
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(&schan->chan);
  	int cid = schan->chan.chan_id;
  	unsigned long flags;
2b99c2592   Barry Song   DMAEngine: sirf: ...
298
  	spin_lock_irqsave(&schan->lock, flags);
ca21a146a   Rongjun Ying   dmaengine: add CS...
299

f7d935dcc   Barry Song   dmaengine: sirf: ...
300
301
302
303
304
  	if (!sdma->is_marco) {
  		writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN) &
  			~(1 << cid), sdma->base + SIRFSOC_DMA_INT_EN);
  		writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL)
  			& ~((1 << cid) | 1 << (cid + 16)),
ca21a146a   Rongjun Ying   dmaengine: add CS...
305
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL);
f7d935dcc   Barry Song   dmaengine: sirf: ...
306
307
308
309
310
311
312
  	} else {
  		writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_INT_EN_CLR);
  		writel_relaxed((1 << cid) | 1 << (cid + 16),
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL_CLR);
  	}
  
  	writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_CH_VALID);
ca21a146a   Rongjun Ying   dmaengine: add CS...
313

ca21a146a   Rongjun Ying   dmaengine: add CS...
314
315
  	list_splice_tail_init(&schan->active, &schan->free);
  	list_splice_tail_init(&schan->queued, &schan->free);
2b99c2592   Barry Song   DMAEngine: sirf: ...
316

ca21a146a   Rongjun Ying   dmaengine: add CS...
317
318
319
320
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	return 0;
  }
2518d1d1f   Barry Song   DMAEngine: sirf: ...
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
  static int sirfsoc_dma_pause_chan(struct sirfsoc_dma_chan *schan)
  {
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(&schan->chan);
  	int cid = schan->chan.chan_id;
  	unsigned long flags;
  
  	spin_lock_irqsave(&schan->lock, flags);
  
  	if (!sdma->is_marco)
  		writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL)
  			& ~((1 << cid) | 1 << (cid + 16)),
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL);
  	else
  		writel_relaxed((1 << cid) | 1 << (cid + 16),
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL_CLR);
  
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	return 0;
  }
  
  static int sirfsoc_dma_resume_chan(struct sirfsoc_dma_chan *schan)
  {
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(&schan->chan);
  	int cid = schan->chan.chan_id;
  	unsigned long flags;
  
  	spin_lock_irqsave(&schan->lock, flags);
  
  	if (!sdma->is_marco)
  		writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL)
  			| ((1 << cid) | 1 << (cid + 16)),
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL);
  	else
  		writel_relaxed((1 << cid) | 1 << (cid + 16),
  			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL);
ca21a146a   Rongjun Ying   dmaengine: add CS...
357
358
359
360
361
362
363
364
365
366
367
368
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	return 0;
  }
  
  static int sirfsoc_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  	unsigned long arg)
  {
  	struct dma_slave_config *config;
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
  
  	switch (cmd) {
2518d1d1f   Barry Song   DMAEngine: sirf: ...
369
370
371
372
  	case DMA_PAUSE:
  		return sirfsoc_dma_pause_chan(schan);
  	case DMA_RESUME:
  		return sirfsoc_dma_resume_chan(schan);
ca21a146a   Rongjun Ying   dmaengine: add CS...
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
  	case DMA_TERMINATE_ALL:
  		return sirfsoc_dma_terminate_all(schan);
  	case DMA_SLAVE_CONFIG:
  		config = (struct dma_slave_config *)arg;
  		return sirfsoc_dma_slave_config(schan, config);
  
  	default:
  		break;
  	}
  
  	return -ENOSYS;
  }
  
  /* Alloc channel resources */
  static int sirfsoc_dma_alloc_chan_resources(struct dma_chan *chan)
  {
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan);
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
  	struct sirfsoc_dma_desc *sdesc;
  	unsigned long flags;
  	LIST_HEAD(descs);
  	int i;
2a76689bc   Barry Song   dmaengine: sirf: ...
395
  	pm_runtime_get_sync(sdma->dma.dev);
ca21a146a   Rongjun Ying   dmaengine: add CS...
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
  	/* Alloc descriptors for this channel */
  	for (i = 0; i < SIRFSOC_DMA_DESCRIPTORS; i++) {
  		sdesc = kzalloc(sizeof(*sdesc), GFP_KERNEL);
  		if (!sdesc) {
  			dev_notice(sdma->dma.dev, "Memory allocation error. "
  				"Allocated only %u descriptors
  ", i);
  			break;
  		}
  
  		dma_async_tx_descriptor_init(&sdesc->desc, chan);
  		sdesc->desc.flags = DMA_CTRL_ACK;
  		sdesc->desc.tx_submit = sirfsoc_dma_tx_submit;
  
  		list_add_tail(&sdesc->node, &descs);
  	}
  
  	/* Return error only if no descriptors were allocated */
  	if (i == 0)
  		return -ENOMEM;
  
  	spin_lock_irqsave(&schan->lock, flags);
  
  	list_splice_tail_init(&descs, &schan->free);
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	return i;
  }
  
  /* Free channel resources */
  static void sirfsoc_dma_free_chan_resources(struct dma_chan *chan)
  {
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
2a76689bc   Barry Song   dmaengine: sirf: ...
429
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan);
ca21a146a   Rongjun Ying   dmaengine: add CS...
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
  	struct sirfsoc_dma_desc *sdesc, *tmp;
  	unsigned long flags;
  	LIST_HEAD(descs);
  
  	spin_lock_irqsave(&schan->lock, flags);
  
  	/* Channel must be idle */
  	BUG_ON(!list_empty(&schan->prepared));
  	BUG_ON(!list_empty(&schan->queued));
  	BUG_ON(!list_empty(&schan->active));
  	BUG_ON(!list_empty(&schan->completed));
  
  	/* Move data */
  	list_splice_tail_init(&schan->free, &descs);
  
  	spin_unlock_irqrestore(&schan->lock, flags);
  
  	/* Free descriptors */
  	list_for_each_entry_safe(sdesc, tmp, &descs, node)
  		kfree(sdesc);
2a76689bc   Barry Song   dmaengine: sirf: ...
450
451
  
  	pm_runtime_put(sdma->dma.dev);
ca21a146a   Rongjun Ying   dmaengine: add CS...
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
  }
  
  /* Send pending descriptor to hardware */
  static void sirfsoc_dma_issue_pending(struct dma_chan *chan)
  {
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
  	unsigned long flags;
  
  	spin_lock_irqsave(&schan->lock, flags);
  
  	if (list_empty(&schan->active) && !list_empty(&schan->queued))
  		sirfsoc_dma_execute(schan);
  
  	spin_unlock_irqrestore(&schan->lock, flags);
  }
  
  /* Check request completion status */
  static enum dma_status
  sirfsoc_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
  	struct dma_tx_state *txstate)
  {
add93b578   Rongjun Ying   dmaengine: sirf: ...
473
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan);
ca21a146a   Rongjun Ying   dmaengine: add CS...
474
475
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
  	unsigned long flags;
96a2af41c   Russell King - ARM Linux   dmaengine: consol...
476
  	enum dma_status ret;
add93b578   Rongjun Ying   dmaengine: sirf: ...
477
478
479
480
481
  	struct sirfsoc_dma_desc *sdesc;
  	int cid = schan->chan.chan_id;
  	unsigned long dma_pos;
  	unsigned long dma_request_bytes;
  	unsigned long residue;
ca21a146a   Rongjun Ying   dmaengine: add CS...
482
483
  
  	spin_lock_irqsave(&schan->lock, flags);
add93b578   Rongjun Ying   dmaengine: sirf: ...
484
485
486
487
488
  
  	sdesc = list_first_entry(&schan->active, struct sirfsoc_dma_desc,
  			node);
  	dma_request_bytes = (sdesc->xlen + 1) * (sdesc->ylen + 1) *
  		(sdesc->width * SIRFSOC_DMA_WORD_LEN);
96a2af41c   Russell King - ARM Linux   dmaengine: consol...
489
  	ret = dma_cookie_status(chan, cookie, txstate);
add93b578   Rongjun Ying   dmaengine: sirf: ...
490
491
492
493
  	dma_pos = readl_relaxed(sdma->base + cid * 0x10 + SIRFSOC_DMA_CH_ADDR)
  		<< 2;
  	residue = dma_request_bytes - (dma_pos - sdesc->addr);
  	dma_set_residue(txstate, residue);
ca21a146a   Rongjun Ying   dmaengine: add CS...
494
  	spin_unlock_irqrestore(&schan->lock, flags);
96a2af41c   Russell King - ARM Linux   dmaengine: consol...
495
  	return ret;
ca21a146a   Rongjun Ying   dmaengine: add CS...
496
497
498
499
500
501
502
503
504
505
506
  }
  
  static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved(
  	struct dma_chan *chan, struct dma_interleaved_template *xt,
  	unsigned long flags)
  {
  	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan);
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
  	struct sirfsoc_dma_desc *sdesc = NULL;
  	unsigned long iflags;
  	int ret;
5997e089e   Barry Song   dmaengine: sirf: ...
507
  	if ((xt->dir != DMA_MEM_TO_DEV) && (xt->dir != DMA_DEV_TO_MEM)) {
ca21a146a   Rongjun Ying   dmaengine: add CS...
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
  		ret = -EINVAL;
  		goto err_dir;
  	}
  
  	/* Get free descriptor */
  	spin_lock_irqsave(&schan->lock, iflags);
  	if (!list_empty(&schan->free)) {
  		sdesc = list_first_entry(&schan->free, struct sirfsoc_dma_desc,
  			node);
  		list_del(&sdesc->node);
  	}
  	spin_unlock_irqrestore(&schan->lock, iflags);
  
  	if (!sdesc) {
  		/* try to free completed descriptors */
  		sirfsoc_dma_process_completed(sdma);
  		ret = 0;
  		goto no_desc;
  	}
  
  	/* Place descriptor in prepared list */
  	spin_lock_irqsave(&schan->lock, iflags);
  
  	/*
  	 * Number of chunks in a frame can only be 1 for prima2
  	 * and ylen (number of frame - 1) must be at least 0
  	 */
  	if ((xt->frame_size == 1) && (xt->numf > 0)) {
  		sdesc->cyclic = 0;
  		sdesc->xlen = xt->sgl[0].size / SIRFSOC_DMA_WORD_LEN;
  		sdesc->width = (xt->sgl[0].size + xt->sgl[0].icg) /
  				SIRFSOC_DMA_WORD_LEN;
  		sdesc->ylen = xt->numf - 1;
  		if (xt->dir == DMA_MEM_TO_DEV) {
  			sdesc->addr = xt->src_start;
  			sdesc->dir = 1;
  		} else {
  			sdesc->addr = xt->dst_start;
  			sdesc->dir = 0;
  		}
  
  		list_add_tail(&sdesc->node, &schan->prepared);
  	} else {
  		pr_err("sirfsoc DMA Invalid xfer
  ");
  		ret = -EINVAL;
  		goto err_xfer;
  	}
  	spin_unlock_irqrestore(&schan->lock, iflags);
  
  	return &sdesc->desc;
  err_xfer:
  	spin_unlock_irqrestore(&schan->lock, iflags);
  no_desc:
  err_dir:
  	return ERR_PTR(ret);
  }
  
  static struct dma_async_tx_descriptor *
  sirfsoc_dma_prep_cyclic(struct dma_chan *chan, dma_addr_t addr,
  	size_t buf_len, size_t period_len,
ec8b5e48c   Peter Ujfalusi   dmaengine: Pass f...
569
  	enum dma_transfer_direction direction, unsigned long flags, void *context)
ca21a146a   Rongjun Ying   dmaengine: add CS...
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
  {
  	struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
  	struct sirfsoc_dma_desc *sdesc = NULL;
  	unsigned long iflags;
  
  	/*
  	 * we only support cycle transfer with 2 period
  	 * If the X-length is set to 0, it would be the loop mode.
  	 * The DMA address keeps increasing until reaching the end of a loop
  	 * area whose size is defined by (DMA_WIDTH x (Y_LENGTH + 1)). Then
  	 * the DMA address goes back to the beginning of this area.
  	 * In loop mode, the DMA data region is divided into two parts, BUFA
  	 * and BUFB. DMA controller generates interrupts twice in each loop:
  	 * when the DMA address reaches the end of BUFA or the end of the
  	 * BUFB
  	 */
  	if (buf_len !=  2 * period_len)
  		return ERR_PTR(-EINVAL);
  
  	/* Get free descriptor */
  	spin_lock_irqsave(&schan->lock, iflags);
  	if (!list_empty(&schan->free)) {
  		sdesc = list_first_entry(&schan->free, struct sirfsoc_dma_desc,
  			node);
  		list_del(&sdesc->node);
  	}
  	spin_unlock_irqrestore(&schan->lock, iflags);
  
  	if (!sdesc)
696b4ff8b   Jingoo Han   dma: sirf: use NU...
599
  		return NULL;
ca21a146a   Rongjun Ying   dmaengine: add CS...
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
  
  	/* Place descriptor in prepared list */
  	spin_lock_irqsave(&schan->lock, iflags);
  	sdesc->addr = addr;
  	sdesc->cyclic = 1;
  	sdesc->xlen = 0;
  	sdesc->ylen = buf_len / SIRFSOC_DMA_WORD_LEN - 1;
  	sdesc->width = 1;
  	list_add_tail(&sdesc->node, &schan->prepared);
  	spin_unlock_irqrestore(&schan->lock, iflags);
  
  	return &sdesc->desc;
  }
  
  /*
   * The DMA controller consists of 16 independent DMA channels.
   * Each channel is allocated to a different function
   */
  bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id)
  {
  	unsigned int ch_nr = (unsigned int) chan_id;
  
  	if (ch_nr == chan->chan_id +
  		chan->device->dev_id * SIRFSOC_DMA_CHANNELS)
  		return true;
  
  	return false;
  }
  EXPORT_SYMBOL(sirfsoc_dma_filter_id);
ba07d812f   Rongjun Ying   dmaengine: sirf: ...
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
  #define SIRFSOC_DMA_BUSWIDTHS \
  	(BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) | \
  	BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
  	BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
  	BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \
  	BIT(DMA_SLAVE_BUSWIDTH_8_BYTES))
  
  static int sirfsoc_dma_device_slave_caps(struct dma_chan *dchan,
  	struct dma_slave_caps *caps)
  {
  	caps->src_addr_widths = SIRFSOC_DMA_BUSWIDTHS;
  	caps->dstn_addr_widths = SIRFSOC_DMA_BUSWIDTHS;
  	caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
  	caps->cmd_pause = true;
  	caps->cmd_terminate = true;
  
  	return 0;
  }
2e041c946   Barry Song   dmaengine: sirf: ...
647
648
649
650
651
  static struct dma_chan *of_dma_sirfsoc_xlate(struct of_phandle_args *dma_spec,
  	struct of_dma *ofdma)
  {
  	struct sirfsoc_dma *sdma = ofdma->of_dma_data;
  	unsigned int request = dma_spec->args[0];
f3817e777   Dan Carpenter   dmaengine: sirf: ...
652
  	if (request >= SIRFSOC_DMA_CHANNELS)
2e041c946   Barry Song   dmaengine: sirf: ...
653
654
655
656
  		return NULL;
  
  	return dma_get_slave_channel(&sdma->channels[request].chan);
  }
463a1f8b3   Bill Pemberton   dma: remove use o...
657
  static int sirfsoc_dma_probe(struct platform_device *op)
ca21a146a   Rongjun Ying   dmaengine: add CS...
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
  {
  	struct device_node *dn = op->dev.of_node;
  	struct device *dev = &op->dev;
  	struct dma_device *dma;
  	struct sirfsoc_dma *sdma;
  	struct sirfsoc_dma_chan *schan;
  	struct resource res;
  	ulong regs_start, regs_size;
  	u32 id;
  	int ret, i;
  
  	sdma = devm_kzalloc(dev, sizeof(*sdma), GFP_KERNEL);
  	if (!sdma) {
  		dev_err(dev, "Memory exhausted!
  ");
  		return -ENOMEM;
  	}
f7d935dcc   Barry Song   dmaengine: sirf: ...
675
676
  	if (of_device_is_compatible(dn, "sirf,marco-dmac"))
  		sdma->is_marco = true;
ca21a146a   Rongjun Ying   dmaengine: add CS...
677
678
679
  	if (of_property_read_u32(dn, "cell-index", &id)) {
  		dev_err(dev, "Fail to get DMAC index
  ");
94d3901c1   Julia Lawall   drivers/dma/sirf-...
680
  		return -ENODEV;
ca21a146a   Rongjun Ying   dmaengine: add CS...
681
682
683
684
685
686
  	}
  
  	sdma->irq = irq_of_parse_and_map(dn, 0);
  	if (sdma->irq == NO_IRQ) {
  		dev_err(dev, "Error mapping IRQ!
  ");
94d3901c1   Julia Lawall   drivers/dma/sirf-...
687
  		return -EINVAL;
ca21a146a   Rongjun Ying   dmaengine: add CS...
688
  	}
a7e340657   Barry Song   dmaengine:sirf:ta...
689
690
691
692
693
694
  	sdma->clk = devm_clk_get(dev, NULL);
  	if (IS_ERR(sdma->clk)) {
  		dev_err(dev, "failed to get a clock.
  ");
  		return PTR_ERR(sdma->clk);
  	}
ca21a146a   Rongjun Ying   dmaengine: add CS...
695
696
697
698
  	ret = of_address_to_resource(dn, 0, &res);
  	if (ret) {
  		dev_err(dev, "Error parsing memory region!
  ");
94d3901c1   Julia Lawall   drivers/dma/sirf-...
699
  		goto irq_dispose;
ca21a146a   Rongjun Ying   dmaengine: add CS...
700
701
702
703
704
705
706
707
708
709
710
711
  	}
  
  	regs_start = res.start;
  	regs_size = resource_size(&res);
  
  	sdma->base = devm_ioremap(dev, regs_start, regs_size);
  	if (!sdma->base) {
  		dev_err(dev, "Error mapping memory region!
  ");
  		ret = -ENOMEM;
  		goto irq_dispose;
  	}
94d3901c1   Julia Lawall   drivers/dma/sirf-...
712
  	ret = request_irq(sdma->irq, &sirfsoc_dma_irq, 0, DRV_NAME, sdma);
ca21a146a   Rongjun Ying   dmaengine: add CS...
713
714
715
716
  	if (ret) {
  		dev_err(dev, "Error requesting IRQ!
  ");
  		ret = -EINVAL;
94d3901c1   Julia Lawall   drivers/dma/sirf-...
717
  		goto irq_dispose;
ca21a146a   Rongjun Ying   dmaengine: add CS...
718
719
720
721
722
723
724
725
726
727
728
729
730
  	}
  
  	dma = &sdma->dma;
  	dma->dev = dev;
  	dma->chancnt = SIRFSOC_DMA_CHANNELS;
  
  	dma->device_alloc_chan_resources = sirfsoc_dma_alloc_chan_resources;
  	dma->device_free_chan_resources = sirfsoc_dma_free_chan_resources;
  	dma->device_issue_pending = sirfsoc_dma_issue_pending;
  	dma->device_control = sirfsoc_dma_control;
  	dma->device_tx_status = sirfsoc_dma_tx_status;
  	dma->device_prep_interleaved_dma = sirfsoc_dma_prep_interleaved;
  	dma->device_prep_dma_cyclic = sirfsoc_dma_prep_cyclic;
ba07d812f   Rongjun Ying   dmaengine: sirf: ...
731
  	dma->device_slave_caps = sirfsoc_dma_device_slave_caps;
ca21a146a   Rongjun Ying   dmaengine: add CS...
732
733
734
735
736
737
738
739
740
741
742
  
  	INIT_LIST_HEAD(&dma->channels);
  	dma_cap_set(DMA_SLAVE, dma->cap_mask);
  	dma_cap_set(DMA_CYCLIC, dma->cap_mask);
  	dma_cap_set(DMA_INTERLEAVE, dma->cap_mask);
  	dma_cap_set(DMA_PRIVATE, dma->cap_mask);
  
  	for (i = 0; i < dma->chancnt; i++) {
  		schan = &sdma->channels[i];
  
  		schan->chan.device = dma;
d3ee98cdc   Russell King - ARM Linux   dmaengine: consol...
743
  		dma_cookie_init(&schan->chan);
ca21a146a   Rongjun Ying   dmaengine: add CS...
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
  
  		INIT_LIST_HEAD(&schan->free);
  		INIT_LIST_HEAD(&schan->prepared);
  		INIT_LIST_HEAD(&schan->queued);
  		INIT_LIST_HEAD(&schan->active);
  		INIT_LIST_HEAD(&schan->completed);
  
  		spin_lock_init(&schan->lock);
  		list_add_tail(&schan->chan.device_node, &dma->channels);
  	}
  
  	tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma);
  
  	/* Register DMA engine */
  	dev_set_drvdata(dev, sdma);
2a76689bc   Barry Song   dmaengine: sirf: ...
759

ca21a146a   Rongjun Ying   dmaengine: add CS...
760
761
762
  	ret = dma_async_device_register(dma);
  	if (ret)
  		goto free_irq;
2e041c946   Barry Song   dmaengine: sirf: ...
763
764
765
766
767
768
769
  	/* Device-tree DMA controller registration */
  	ret = of_dma_controller_register(dn, of_dma_sirfsoc_xlate, sdma);
  	if (ret) {
  		dev_err(dev, "failed to register DMA controller
  ");
  		goto unreg_dma_dev;
  	}
2a76689bc   Barry Song   dmaengine: sirf: ...
770
  	pm_runtime_enable(&op->dev);
ca21a146a   Rongjun Ying   dmaengine: add CS...
771
772
773
774
  	dev_info(dev, "initialized SIRFSOC DMAC driver
  ");
  
  	return 0;
2e041c946   Barry Song   dmaengine: sirf: ...
775
776
  unreg_dma_dev:
  	dma_async_device_unregister(dma);
ca21a146a   Rongjun Ying   dmaengine: add CS...
777
  free_irq:
94d3901c1   Julia Lawall   drivers/dma/sirf-...
778
  	free_irq(sdma->irq, sdma);
ca21a146a   Rongjun Ying   dmaengine: add CS...
779
780
  irq_dispose:
  	irq_dispose_mapping(sdma->irq);
ca21a146a   Rongjun Ying   dmaengine: add CS...
781
782
  	return ret;
  }
4bf27b8b3   Greg Kroah-Hartman   Drivers: dma: rem...
783
  static int sirfsoc_dma_remove(struct platform_device *op)
ca21a146a   Rongjun Ying   dmaengine: add CS...
784
785
786
  {
  	struct device *dev = &op->dev;
  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
2e041c946   Barry Song   dmaengine: sirf: ...
787
  	of_dma_controller_free(op->dev.of_node);
ca21a146a   Rongjun Ying   dmaengine: add CS...
788
  	dma_async_device_unregister(&sdma->dma);
94d3901c1   Julia Lawall   drivers/dma/sirf-...
789
  	free_irq(sdma->irq, sdma);
ca21a146a   Rongjun Ying   dmaengine: add CS...
790
  	irq_dispose_mapping(sdma->irq);
2a76689bc   Barry Song   dmaengine: sirf: ...
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
  	pm_runtime_disable(&op->dev);
  	if (!pm_runtime_status_suspended(&op->dev))
  		sirfsoc_dma_runtime_suspend(&op->dev);
  
  	return 0;
  }
  
  static int sirfsoc_dma_runtime_suspend(struct device *dev)
  {
  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
  
  	clk_disable_unprepare(sdma->clk);
  	return 0;
  }
  
  static int sirfsoc_dma_runtime_resume(struct device *dev)
  {
  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
  	int ret;
  
  	ret = clk_prepare_enable(sdma->clk);
  	if (ret < 0) {
  		dev_err(dev, "clk_enable failed: %d
  ", ret);
  		return ret;
  	}
  	return 0;
  }
  
  static int sirfsoc_dma_pm_suspend(struct device *dev)
  {
  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
  	struct sirfsoc_dma_regs *save = &sdma->regs_save;
  	struct sirfsoc_dma_desc *sdesc;
  	struct sirfsoc_dma_chan *schan;
  	int ch;
  	int ret;
  
  	/*
  	 * if we were runtime-suspended before, resume to enable clock
  	 * before accessing register
  	 */
  	if (pm_runtime_status_suspended(dev)) {
  		ret = sirfsoc_dma_runtime_resume(dev);
  		if (ret < 0)
  			return ret;
  	}
  
  	/*
  	 * DMA controller will lose all registers while suspending
  	 * so we need to save registers for active channels
  	 */
  	for (ch = 0; ch < SIRFSOC_DMA_CHANNELS; ch++) {
  		schan = &sdma->channels[ch];
  		if (list_empty(&schan->active))
  			continue;
  		sdesc = list_first_entry(&schan->active,
  			struct sirfsoc_dma_desc,
  			node);
  		save->ctrl[ch] = readl_relaxed(sdma->base +
  			ch * 0x10 + SIRFSOC_DMA_CH_CTRL);
  	}
  	save->interrupt_en = readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN);
  
  	/* Disable clock */
  	sirfsoc_dma_runtime_suspend(dev);
  
  	return 0;
  }
  
  static int sirfsoc_dma_pm_resume(struct device *dev)
  {
  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
  	struct sirfsoc_dma_regs *save = &sdma->regs_save;
  	struct sirfsoc_dma_desc *sdesc;
  	struct sirfsoc_dma_chan *schan;
  	int ch;
  	int ret;
  
  	/* Enable clock before accessing register */
  	ret = sirfsoc_dma_runtime_resume(dev);
  	if (ret < 0)
  		return ret;
  
  	writel_relaxed(save->interrupt_en, sdma->base + SIRFSOC_DMA_INT_EN);
  	for (ch = 0; ch < SIRFSOC_DMA_CHANNELS; ch++) {
  		schan = &sdma->channels[ch];
  		if (list_empty(&schan->active))
  			continue;
  		sdesc = list_first_entry(&schan->active,
  			struct sirfsoc_dma_desc,
  			node);
  		writel_relaxed(sdesc->width,
  			sdma->base + SIRFSOC_DMA_WIDTH_0 + ch * 4);
  		writel_relaxed(sdesc->xlen,
  			sdma->base + ch * 0x10 + SIRFSOC_DMA_CH_XLEN);
  		writel_relaxed(sdesc->ylen,
  			sdma->base + ch * 0x10 + SIRFSOC_DMA_CH_YLEN);
  		writel_relaxed(save->ctrl[ch],
  			sdma->base + ch * 0x10 + SIRFSOC_DMA_CH_CTRL);
  		writel_relaxed(sdesc->addr >> 2,
  			sdma->base + ch * 0x10 + SIRFSOC_DMA_CH_ADDR);
  	}
  
  	/* if we were runtime-suspended before, suspend again */
  	if (pm_runtime_status_suspended(dev))
  		sirfsoc_dma_runtime_suspend(dev);
ca21a146a   Rongjun Ying   dmaengine: add CS...
898
899
  	return 0;
  }
2a76689bc   Barry Song   dmaengine: sirf: ...
900
901
902
903
  static const struct dev_pm_ops sirfsoc_dma_pm_ops = {
  	SET_RUNTIME_PM_OPS(sirfsoc_dma_runtime_suspend, sirfsoc_dma_runtime_resume, NULL)
  	SET_SYSTEM_SLEEP_PM_OPS(sirfsoc_dma_pm_suspend, sirfsoc_dma_pm_resume)
  };
ca21a146a   Rongjun Ying   dmaengine: add CS...
904
905
  static struct of_device_id sirfsoc_dma_match[] = {
  	{ .compatible = "sirf,prima2-dmac", },
f7d935dcc   Barry Song   dmaengine: sirf: ...
906
  	{ .compatible = "sirf,marco-dmac", },
ca21a146a   Rongjun Ying   dmaengine: add CS...
907
908
909
910
911
  	{},
  };
  
  static struct platform_driver sirfsoc_dma_driver = {
  	.probe		= sirfsoc_dma_probe,
a7d6e3ec2   Bill Pemberton   dma: remove use o...
912
  	.remove		= sirfsoc_dma_remove,
ca21a146a   Rongjun Ying   dmaengine: add CS...
913
914
915
  	.driver = {
  		.name = DRV_NAME,
  		.owner = THIS_MODULE,
2a76689bc   Barry Song   dmaengine: sirf: ...
916
  		.pm = &sirfsoc_dma_pm_ops,
ca21a146a   Rongjun Ying   dmaengine: add CS...
917
918
919
  		.of_match_table	= sirfsoc_dma_match,
  	},
  };
42361f20f   Barry Song   dmaengine: sirf: ...
920
921
922
923
924
925
926
927
928
929
930
931
  static __init int sirfsoc_dma_init(void)
  {
  	return platform_driver_register(&sirfsoc_dma_driver);
  }
  
  static void __exit sirfsoc_dma_exit(void)
  {
  	platform_driver_unregister(&sirfsoc_dma_driver);
  }
  
  subsys_initcall(sirfsoc_dma_init);
  module_exit(sirfsoc_dma_exit);
ca21a146a   Rongjun Ying   dmaengine: add CS...
932
933
934
935
936
  
  MODULE_AUTHOR("Rongjun Ying <rongjun.ying@csr.com>, "
  	"Barry Song <baohua.song@csr.com>");
  MODULE_DESCRIPTION("SIRFSOC DMA control driver");
  MODULE_LICENSE("GPL v2");