1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver For Marvell Two-channel DMA Engine
5 * Copyright: Marvell International Ltd.
9 #include <linux/module.h>
10 #include <linux/init.h>
11 #include <linux/types.h>
12 #include <linux/interrupt.h>
13 #include <linux/dma-mapping.h>
14 #include <linux/slab.h>
15 #include <linux/dmaengine.h>
16 #include <linux/platform_device.h>
17 #include <linux/device.h>
18 #include <linux/platform_data/dma-mmp_tdma.h>
19 #include <linux/of_device.h>
20 #include <linux/of_dma.h>
22 #include "dmaengine.h"
25 * Two-Channel DMA registers
27 #define TDBCR 0x00 /* Byte Count */
28 #define TDSAR 0x10 /* Src Addr */
29 #define TDDAR 0x20 /* Dst Addr */
30 #define TDNDPR 0x30 /* Next Desc */
31 #define TDCR 0x40 /* Control */
32 #define TDCP 0x60 /* Priority*/
33 #define TDCDPR 0x70 /* Current Desc */
34 #define TDIMR 0x80 /* Int Mask */
35 #define TDISR 0xa0 /* Int Status */
37 /* Two-Channel DMA Control Register */
38 #define TDCR_SSZ_8_BITS (0x0 << 22) /* Sample Size */
39 #define TDCR_SSZ_12_BITS (0x1 << 22)
40 #define TDCR_SSZ_16_BITS (0x2 << 22)
41 #define TDCR_SSZ_20_BITS (0x3 << 22)
42 #define TDCR_SSZ_24_BITS (0x4 << 22)
43 #define TDCR_SSZ_32_BITS (0x5 << 22)
44 #define TDCR_SSZ_SHIFT (0x1 << 22)
45 #define TDCR_SSZ_MASK (0x7 << 22)
46 #define TDCR_SSPMOD (0x1 << 21) /* SSP MOD */
47 #define TDCR_ABR (0x1 << 20) /* Channel Abort */
48 #define TDCR_CDE (0x1 << 17) /* Close Desc Enable */
49 #define TDCR_PACKMOD (0x1 << 16) /* Pack Mode (ADMA Only) */
50 #define TDCR_CHANACT (0x1 << 14) /* Channel Active */
51 #define TDCR_FETCHND (0x1 << 13) /* Fetch Next Desc */
52 #define TDCR_CHANEN (0x1 << 12) /* Channel Enable */
53 #define TDCR_INTMODE (0x1 << 10) /* Interrupt Mode */
54 #define TDCR_CHAINMOD (0x1 << 9) /* Chain Mode */
55 #define TDCR_BURSTSZ_MSK (0x7 << 6) /* Burst Size */
56 #define TDCR_BURSTSZ_4B (0x0 << 6)
57 #define TDCR_BURSTSZ_8B (0x1 << 6)
58 #define TDCR_BURSTSZ_16B (0x3 << 6)
59 #define TDCR_BURSTSZ_32B (0x6 << 6)
60 #define TDCR_BURSTSZ_64B (0x7 << 6)
61 #define TDCR_BURSTSZ_SQU_1B (0x5 << 6)
62 #define TDCR_BURSTSZ_SQU_2B (0x6 << 6)
63 #define TDCR_BURSTSZ_SQU_4B (0x0 << 6)
64 #define TDCR_BURSTSZ_SQU_8B (0x1 << 6)
65 #define TDCR_BURSTSZ_SQU_16B (0x3 << 6)
66 #define TDCR_BURSTSZ_SQU_32B (0x7 << 6)
67 #define TDCR_BURSTSZ_128B (0x5 << 6)
68 #define TDCR_DSTDIR_MSK (0x3 << 4) /* Dst Direction */
69 #define TDCR_DSTDIR_ADDR_HOLD (0x2 << 4) /* Dst Addr Hold */
70 #define TDCR_DSTDIR_ADDR_INC (0x0 << 4) /* Dst Addr Increment */
71 #define TDCR_SRCDIR_MSK (0x3 << 2) /* Src Direction */
72 #define TDCR_SRCDIR_ADDR_HOLD (0x2 << 2) /* Src Addr Hold */
73 #define TDCR_SRCDIR_ADDR_INC (0x0 << 2) /* Src Addr Increment */
74 #define TDCR_DSTDESCCONT (0x1 << 1)
75 #define TDCR_SRCDESTCONT (0x1 << 0)
77 /* Two-Channel DMA Int Mask Register */
78 #define TDIMR_COMP (0x1 << 0)
80 /* Two-Channel DMA Int Status Register */
81 #define TDISR_COMP (0x1 << 0)
84 * Two-Channel DMA Descriptor Struct
85 * NOTE: desc's buf must be aligned to 16 bytes.
87 struct mmp_tdma_desc
{
99 #define TDMA_MAX_XFER_BYTES SZ_64K
101 struct mmp_tdma_chan
{
103 struct dma_chan chan
;
104 struct dma_async_tx_descriptor desc
;
105 struct tasklet_struct tasklet
;
107 struct mmp_tdma_desc
*desc_arr
;
108 dma_addr_t desc_arr_phys
;
110 enum dma_transfer_direction dir
;
113 enum dma_slave_buswidth buswidth
;
114 enum dma_status status
;
115 struct dma_slave_config slave_config
;
118 enum mmp_tdma_type type
;
120 void __iomem
*reg_base
;
126 struct gen_pool
*pool
;
129 #define TDMA_CHANNEL_NUM 2
130 struct mmp_tdma_device
{
133 struct dma_device device
;
134 struct mmp_tdma_chan
*tdmac
[TDMA_CHANNEL_NUM
];
137 #define to_mmp_tdma_chan(dchan) container_of(dchan, struct mmp_tdma_chan, chan)
139 static int mmp_tdma_config_write(struct dma_chan
*chan
,
140 enum dma_transfer_direction dir
,
141 struct dma_slave_config
*dmaengine_cfg
);
143 static void mmp_tdma_chan_set_desc(struct mmp_tdma_chan
*tdmac
, dma_addr_t phys
)
145 writel(phys
, tdmac
->reg_base
+ TDNDPR
);
146 writel(readl(tdmac
->reg_base
+ TDCR
) | TDCR_FETCHND
,
147 tdmac
->reg_base
+ TDCR
);
150 static void mmp_tdma_enable_irq(struct mmp_tdma_chan
*tdmac
, bool enable
)
153 writel(TDIMR_COMP
, tdmac
->reg_base
+ TDIMR
);
155 writel(0, tdmac
->reg_base
+ TDIMR
);
158 static void mmp_tdma_enable_chan(struct mmp_tdma_chan
*tdmac
)
160 /* enable dma chan */
161 writel(readl(tdmac
->reg_base
+ TDCR
) | TDCR_CHANEN
,
162 tdmac
->reg_base
+ TDCR
);
163 tdmac
->status
= DMA_IN_PROGRESS
;
166 static int mmp_tdma_disable_chan(struct dma_chan
*chan
)
168 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
171 tdcr
= readl(tdmac
->reg_base
+ TDCR
);
173 tdcr
&= ~TDCR_CHANEN
;
174 writel(tdcr
, tdmac
->reg_base
+ TDCR
);
176 tdmac
->status
= DMA_COMPLETE
;
181 static int mmp_tdma_resume_chan(struct dma_chan
*chan
)
183 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
185 writel(readl(tdmac
->reg_base
+ TDCR
) | TDCR_CHANEN
,
186 tdmac
->reg_base
+ TDCR
);
187 tdmac
->status
= DMA_IN_PROGRESS
;
192 static int mmp_tdma_pause_chan(struct dma_chan
*chan
)
194 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
196 writel(readl(tdmac
->reg_base
+ TDCR
) & ~TDCR_CHANEN
,
197 tdmac
->reg_base
+ TDCR
);
198 tdmac
->status
= DMA_PAUSED
;
203 static int mmp_tdma_config_chan(struct dma_chan
*chan
)
205 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
206 unsigned int tdcr
= 0;
208 mmp_tdma_disable_chan(chan
);
210 if (tdmac
->dir
== DMA_MEM_TO_DEV
)
211 tdcr
= TDCR_DSTDIR_ADDR_HOLD
| TDCR_SRCDIR_ADDR_INC
;
212 else if (tdmac
->dir
== DMA_DEV_TO_MEM
)
213 tdcr
= TDCR_SRCDIR_ADDR_HOLD
| TDCR_DSTDIR_ADDR_INC
;
215 if (tdmac
->type
== MMP_AUD_TDMA
) {
216 tdcr
|= TDCR_PACKMOD
;
218 switch (tdmac
->burst_sz
) {
220 tdcr
|= TDCR_BURSTSZ_4B
;
223 tdcr
|= TDCR_BURSTSZ_8B
;
226 tdcr
|= TDCR_BURSTSZ_16B
;
229 tdcr
|= TDCR_BURSTSZ_32B
;
232 tdcr
|= TDCR_BURSTSZ_64B
;
235 tdcr
|= TDCR_BURSTSZ_128B
;
238 dev_err(tdmac
->dev
, "mmp_tdma: unknown burst size.\n");
242 switch (tdmac
->buswidth
) {
243 case DMA_SLAVE_BUSWIDTH_1_BYTE
:
244 tdcr
|= TDCR_SSZ_8_BITS
;
246 case DMA_SLAVE_BUSWIDTH_2_BYTES
:
247 tdcr
|= TDCR_SSZ_16_BITS
;
249 case DMA_SLAVE_BUSWIDTH_4_BYTES
:
250 tdcr
|= TDCR_SSZ_32_BITS
;
253 dev_err(tdmac
->dev
, "mmp_tdma: unknown bus size.\n");
256 } else if (tdmac
->type
== PXA910_SQU
) {
259 switch (tdmac
->burst_sz
) {
261 tdcr
|= TDCR_BURSTSZ_SQU_1B
;
264 tdcr
|= TDCR_BURSTSZ_SQU_2B
;
267 tdcr
|= TDCR_BURSTSZ_SQU_4B
;
270 tdcr
|= TDCR_BURSTSZ_SQU_8B
;
273 tdcr
|= TDCR_BURSTSZ_SQU_16B
;
276 tdcr
|= TDCR_BURSTSZ_SQU_32B
;
279 dev_err(tdmac
->dev
, "mmp_tdma: unknown burst size.\n");
284 writel(tdcr
, tdmac
->reg_base
+ TDCR
);
288 static int mmp_tdma_clear_chan_irq(struct mmp_tdma_chan
*tdmac
)
290 u32 reg
= readl(tdmac
->reg_base
+ TDISR
);
292 if (reg
& TDISR_COMP
) {
295 writel(reg
, tdmac
->reg_base
+ TDISR
);
302 static size_t mmp_tdma_get_pos(struct mmp_tdma_chan
*tdmac
)
306 if (tdmac
->idx
== 0) {
307 reg
= __raw_readl(tdmac
->reg_base
+ TDSAR
);
308 reg
-= tdmac
->desc_arr
[0].src_addr
;
309 } else if (tdmac
->idx
== 1) {
310 reg
= __raw_readl(tdmac
->reg_base
+ TDDAR
);
311 reg
-= tdmac
->desc_arr
[0].dst_addr
;
318 static irqreturn_t
mmp_tdma_chan_handler(int irq
, void *dev_id
)
320 struct mmp_tdma_chan
*tdmac
= dev_id
;
322 if (mmp_tdma_clear_chan_irq(tdmac
) == 0) {
323 tasklet_schedule(&tdmac
->tasklet
);
329 static irqreturn_t
mmp_tdma_int_handler(int irq
, void *dev_id
)
331 struct mmp_tdma_device
*tdev
= dev_id
;
335 for (i
= 0; i
< TDMA_CHANNEL_NUM
; i
++) {
336 struct mmp_tdma_chan
*tdmac
= tdev
->tdmac
[i
];
338 ret
= mmp_tdma_chan_handler(irq
, tdmac
);
339 if (ret
== IRQ_HANDLED
)
349 static void dma_do_tasklet(unsigned long data
)
351 struct mmp_tdma_chan
*tdmac
= (struct mmp_tdma_chan
*)data
;
353 dmaengine_desc_get_callback_invoke(&tdmac
->desc
, NULL
);
356 static void mmp_tdma_free_descriptor(struct mmp_tdma_chan
*tdmac
)
358 struct gen_pool
*gpool
;
359 int size
= tdmac
->desc_num
* sizeof(struct mmp_tdma_desc
);
362 if (gpool
&& tdmac
->desc_arr
)
363 gen_pool_free(gpool
, (unsigned long)tdmac
->desc_arr
,
365 tdmac
->desc_arr
= NULL
;
370 static dma_cookie_t
mmp_tdma_tx_submit(struct dma_async_tx_descriptor
*tx
)
372 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(tx
->chan
);
374 mmp_tdma_chan_set_desc(tdmac
, tdmac
->desc_arr_phys
);
379 static int mmp_tdma_alloc_chan_resources(struct dma_chan
*chan
)
381 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
384 dma_async_tx_descriptor_init(&tdmac
->desc
, chan
);
385 tdmac
->desc
.tx_submit
= mmp_tdma_tx_submit
;
388 ret
= devm_request_irq(tdmac
->dev
, tdmac
->irq
,
389 mmp_tdma_chan_handler
, 0, "tdma", tdmac
);
396 static void mmp_tdma_free_chan_resources(struct dma_chan
*chan
)
398 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
401 devm_free_irq(tdmac
->dev
, tdmac
->irq
, tdmac
);
402 mmp_tdma_free_descriptor(tdmac
);
406 static struct mmp_tdma_desc
*mmp_tdma_alloc_descriptor(struct mmp_tdma_chan
*tdmac
)
408 struct gen_pool
*gpool
;
409 int size
= tdmac
->desc_num
* sizeof(struct mmp_tdma_desc
);
415 tdmac
->desc_arr
= gen_pool_dma_alloc(gpool
, size
, &tdmac
->desc_arr_phys
);
417 return tdmac
->desc_arr
;
420 static struct dma_async_tx_descriptor
*mmp_tdma_prep_dma_cyclic(
421 struct dma_chan
*chan
, dma_addr_t dma_addr
, size_t buf_len
,
422 size_t period_len
, enum dma_transfer_direction direction
,
425 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
426 struct mmp_tdma_desc
*desc
;
427 int num_periods
= buf_len
/ period_len
;
430 if (tdmac
->status
!= DMA_COMPLETE
)
433 if (period_len
> TDMA_MAX_XFER_BYTES
) {
435 "maximum period size exceeded: %zu > %d\n",
436 period_len
, TDMA_MAX_XFER_BYTES
);
440 tdmac
->status
= DMA_IN_PROGRESS
;
441 tdmac
->desc_num
= num_periods
;
442 desc
= mmp_tdma_alloc_descriptor(tdmac
);
446 mmp_tdma_config_write(chan
, direction
, &tdmac
->slave_config
);
448 while (buf
< buf_len
) {
449 desc
= &tdmac
->desc_arr
[i
];
451 if (i
+ 1 == num_periods
)
452 desc
->nxt_desc
= tdmac
->desc_arr_phys
;
454 desc
->nxt_desc
= tdmac
->desc_arr_phys
+
455 sizeof(*desc
) * (i
+ 1);
457 if (direction
== DMA_MEM_TO_DEV
) {
458 desc
->src_addr
= dma_addr
;
459 desc
->dst_addr
= tdmac
->dev_addr
;
461 desc
->src_addr
= tdmac
->dev_addr
;
462 desc
->dst_addr
= dma_addr
;
464 desc
->byte_cnt
= period_len
;
465 dma_addr
+= period_len
;
470 /* enable interrupt */
471 if (flags
& DMA_PREP_INTERRUPT
)
472 mmp_tdma_enable_irq(tdmac
, true);
474 tdmac
->buf_len
= buf_len
;
475 tdmac
->period_len
= period_len
;
481 tdmac
->status
= DMA_ERROR
;
485 static int mmp_tdma_terminate_all(struct dma_chan
*chan
)
487 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
489 mmp_tdma_disable_chan(chan
);
490 /* disable interrupt */
491 mmp_tdma_enable_irq(tdmac
, false);
496 static int mmp_tdma_config(struct dma_chan
*chan
,
497 struct dma_slave_config
*dmaengine_cfg
)
499 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
501 memcpy(&tdmac
->slave_config
, dmaengine_cfg
, sizeof(*dmaengine_cfg
));
506 static int mmp_tdma_config_write(struct dma_chan
*chan
,
507 enum dma_transfer_direction dir
,
508 struct dma_slave_config
*dmaengine_cfg
)
510 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
512 if (dir
== DMA_DEV_TO_MEM
) {
513 tdmac
->dev_addr
= dmaengine_cfg
->src_addr
;
514 tdmac
->burst_sz
= dmaengine_cfg
->src_maxburst
;
515 tdmac
->buswidth
= dmaengine_cfg
->src_addr_width
;
517 tdmac
->dev_addr
= dmaengine_cfg
->dst_addr
;
518 tdmac
->burst_sz
= dmaengine_cfg
->dst_maxburst
;
519 tdmac
->buswidth
= dmaengine_cfg
->dst_addr_width
;
523 return mmp_tdma_config_chan(chan
);
526 static enum dma_status
mmp_tdma_tx_status(struct dma_chan
*chan
,
527 dma_cookie_t cookie
, struct dma_tx_state
*txstate
)
529 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
531 tdmac
->pos
= mmp_tdma_get_pos(tdmac
);
532 dma_set_tx_state(txstate
, chan
->completed_cookie
, chan
->cookie
,
533 tdmac
->buf_len
- tdmac
->pos
);
535 return tdmac
->status
;
538 static void mmp_tdma_issue_pending(struct dma_chan
*chan
)
540 struct mmp_tdma_chan
*tdmac
= to_mmp_tdma_chan(chan
);
542 mmp_tdma_enable_chan(tdmac
);
545 static int mmp_tdma_remove(struct platform_device
*pdev
)
547 if (pdev
->dev
.of_node
)
548 of_dma_controller_free(pdev
->dev
.of_node
);
553 static int mmp_tdma_chan_init(struct mmp_tdma_device
*tdev
,
555 int type
, struct gen_pool
*pool
)
557 struct mmp_tdma_chan
*tdmac
;
559 if (idx
>= TDMA_CHANNEL_NUM
) {
560 dev_err(tdev
->dev
, "too many channels for device!\n");
565 tdmac
= devm_kzalloc(tdev
->dev
, sizeof(*tdmac
), GFP_KERNEL
);
571 tdmac
->dev
= tdev
->dev
;
572 tdmac
->chan
.device
= &tdev
->device
;
575 tdmac
->reg_base
= tdev
->base
+ idx
* 4;
577 tdmac
->status
= DMA_COMPLETE
;
578 tdev
->tdmac
[tdmac
->idx
] = tdmac
;
579 tasklet_init(&tdmac
->tasklet
, dma_do_tasklet
, (unsigned long)tdmac
);
581 /* add the channel to tdma_chan list */
582 list_add_tail(&tdmac
->chan
.device_node
,
583 &tdev
->device
.channels
);
587 struct mmp_tdma_filter_param
{
588 unsigned int chan_id
;
591 static bool mmp_tdma_filter_fn(struct dma_chan
*chan
, void *fn_param
)
593 struct mmp_tdma_filter_param
*param
= fn_param
;
595 if (chan
->chan_id
!= param
->chan_id
)
601 static struct dma_chan
*mmp_tdma_xlate(struct of_phandle_args
*dma_spec
,
602 struct of_dma
*ofdma
)
604 struct mmp_tdma_device
*tdev
= ofdma
->of_dma_data
;
605 dma_cap_mask_t mask
= tdev
->device
.cap_mask
;
606 struct mmp_tdma_filter_param param
;
608 if (dma_spec
->args_count
!= 1)
611 param
.chan_id
= dma_spec
->args
[0];
613 if (param
.chan_id
>= TDMA_CHANNEL_NUM
)
616 return __dma_request_channel(&mask
, mmp_tdma_filter_fn
, ¶m
,
620 static const struct of_device_id mmp_tdma_dt_ids
[] = {
621 { .compatible
= "marvell,adma-1.0", .data
= (void *)MMP_AUD_TDMA
},
622 { .compatible
= "marvell,pxa910-squ", .data
= (void *)PXA910_SQU
},
625 MODULE_DEVICE_TABLE(of
, mmp_tdma_dt_ids
);
627 static int mmp_tdma_probe(struct platform_device
*pdev
)
629 enum mmp_tdma_type type
;
630 const struct of_device_id
*of_id
;
631 struct mmp_tdma_device
*tdev
;
632 struct resource
*iores
;
634 int irq
= 0, irq_num
= 0;
635 int chan_num
= TDMA_CHANNEL_NUM
;
636 struct gen_pool
*pool
= NULL
;
638 of_id
= of_match_device(mmp_tdma_dt_ids
, &pdev
->dev
);
640 type
= (enum mmp_tdma_type
) of_id
->data
;
642 type
= platform_get_device_id(pdev
)->driver_data
;
644 /* always have couple channels */
645 tdev
= devm_kzalloc(&pdev
->dev
, sizeof(*tdev
), GFP_KERNEL
);
649 tdev
->dev
= &pdev
->dev
;
651 for (i
= 0; i
< chan_num
; i
++) {
652 if (platform_get_irq(pdev
, i
) > 0)
656 iores
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
657 tdev
->base
= devm_ioremap_resource(&pdev
->dev
, iores
);
658 if (IS_ERR(tdev
->base
))
659 return PTR_ERR(tdev
->base
);
661 INIT_LIST_HEAD(&tdev
->device
.channels
);
663 if (pdev
->dev
.of_node
)
664 pool
= of_gen_pool_get(pdev
->dev
.of_node
, "asram", 0);
666 pool
= sram_get_gpool("asram");
668 dev_err(&pdev
->dev
, "asram pool not available\n");
672 if (irq_num
!= chan_num
) {
673 irq
= platform_get_irq(pdev
, 0);
674 ret
= devm_request_irq(&pdev
->dev
, irq
,
675 mmp_tdma_int_handler
, 0, "tdma", tdev
);
680 /* initialize channel parameters */
681 for (i
= 0; i
< chan_num
; i
++) {
682 irq
= (irq_num
!= chan_num
) ? 0 : platform_get_irq(pdev
, i
);
683 ret
= mmp_tdma_chan_init(tdev
, i
, irq
, type
, pool
);
688 dma_cap_set(DMA_SLAVE
, tdev
->device
.cap_mask
);
689 dma_cap_set(DMA_CYCLIC
, tdev
->device
.cap_mask
);
690 tdev
->device
.dev
= &pdev
->dev
;
691 tdev
->device
.device_alloc_chan_resources
=
692 mmp_tdma_alloc_chan_resources
;
693 tdev
->device
.device_free_chan_resources
=
694 mmp_tdma_free_chan_resources
;
695 tdev
->device
.device_prep_dma_cyclic
= mmp_tdma_prep_dma_cyclic
;
696 tdev
->device
.device_tx_status
= mmp_tdma_tx_status
;
697 tdev
->device
.device_issue_pending
= mmp_tdma_issue_pending
;
698 tdev
->device
.device_config
= mmp_tdma_config
;
699 tdev
->device
.device_pause
= mmp_tdma_pause_chan
;
700 tdev
->device
.device_resume
= mmp_tdma_resume_chan
;
701 tdev
->device
.device_terminate_all
= mmp_tdma_terminate_all
;
702 tdev
->device
.copy_align
= DMAENGINE_ALIGN_8_BYTES
;
704 dma_set_mask(&pdev
->dev
, DMA_BIT_MASK(64));
705 platform_set_drvdata(pdev
, tdev
);
707 ret
= dmaenginem_async_device_register(&tdev
->device
);
709 dev_err(tdev
->device
.dev
, "unable to register\n");
713 if (pdev
->dev
.of_node
) {
714 ret
= of_dma_controller_register(pdev
->dev
.of_node
,
715 mmp_tdma_xlate
, tdev
);
717 dev_err(tdev
->device
.dev
,
718 "failed to register controller\n");
723 dev_info(tdev
->device
.dev
, "initialized\n");
727 static const struct platform_device_id mmp_tdma_id_table
[] = {
728 { "mmp-adma", MMP_AUD_TDMA
},
729 { "pxa910-squ", PXA910_SQU
},
733 static struct platform_driver mmp_tdma_driver
= {
736 .of_match_table
= mmp_tdma_dt_ids
,
738 .id_table
= mmp_tdma_id_table
,
739 .probe
= mmp_tdma_probe
,
740 .remove
= mmp_tdma_remove
,
743 module_platform_driver(mmp_tdma_driver
);
745 MODULE_LICENSE("GPL");
746 MODULE_DESCRIPTION("MMP Two-Channel DMA Driver");
747 MODULE_ALIAS("platform:mmp-tdma");
748 MODULE_AUTHOR("Leo Yan <leoy@marvell.com>");
749 MODULE_AUTHOR("Zhangfei Gao <zhangfei.gao@marvell.com>");