1 /* linux/drivers/dma/pl330.c
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
13 #include <linux/init.h>
14 #include <linux/slab.h>
15 #include <linux/module.h>
16 #include <linux/dmaengine.h>
17 #include <linux/interrupt.h>
18 #include <linux/amba/bus.h>
19 #include <linux/amba/pl330.h>
20 #include <linux/pm_runtime.h>
21 #include <linux/scatterlist.h>
24 #define NR_DEFAULT_DESC 16
27 /* In the DMAC pool */
30 * Allocted to some channel during prep_xxx
31 * Also may be sitting on the work_list.
35 * Sitting on the work_list and already submitted
36 * to the PL330 core. Not more than two descriptors
37 * of a channel can be BUSY at any time.
41 * Sitting on the channel work_list but xfer done
47 struct dma_pl330_chan {
48 /* Schedule desc completion */
49 struct tasklet_struct task;
51 /* DMA-Engine Channel */
54 /* List of to be xfered descriptors */
55 struct list_head work_list;
57 /* Pointer to the DMAC that manages this channel,
58 * NULL if the channel is available to be acquired.
59 * As the parent, this DMAC also provides descriptors
62 struct dma_pl330_dmac *dmac;
64 /* To protect channel manipulation */
67 /* Token of a hardware channel thread of PL330 DMAC
68 * NULL if the channel is available to be acquired.
72 /* For D-to-M and M-to-D channels */
73 int burst_sz; /* the peripheral fifo width */
74 int burst_len; /* the number of burst */
77 /* for cyclic capability */
81 struct dma_pl330_dmac {
82 struct pl330_info pif;
84 /* DMA-Engine Device */
85 struct dma_device ddma;
87 /* Pool of descriptors available for the DMAC's channels */
88 struct list_head desc_pool;
89 /* To protect desc_pool manipulation */
92 /* Peripheral channels connected to this DMAC */
93 struct dma_pl330_chan *peripherals; /* keep at end */
98 struct dma_pl330_desc {
99 /* To attach to a queue as child */
100 struct list_head node;
102 /* Descriptor for the DMA Engine API */
103 struct dma_async_tx_descriptor txd;
105 /* Xfer for PL330 core */
106 struct pl330_xfer px;
108 struct pl330_reqcfg rqcfg;
109 struct pl330_req req;
111 enum desc_status status;
113 /* The channel which currently holds this desc */
114 struct dma_pl330_chan *pchan;
117 /* forward declaration */
118 static struct amba_driver pl330_driver;
120 static inline struct dma_pl330_chan *
121 to_pchan(struct dma_chan *ch)
126 return container_of(ch, struct dma_pl330_chan, chan);
129 static inline struct dma_pl330_desc *
130 to_desc(struct dma_async_tx_descriptor *tx)
132 return container_of(tx, struct dma_pl330_desc, txd);
135 static inline void free_desc_list(struct list_head *list)
137 struct dma_pl330_dmac *pdmac;
138 struct dma_pl330_desc *desc;
139 struct dma_pl330_chan *pch;
142 if (list_empty(list))
145 /* Finish off the work list */
146 list_for_each_entry(desc, list, node) {
147 dma_async_tx_callback callback;
150 /* All desc in a list belong to same channel */
152 callback = desc->txd.callback;
153 param = desc->txd.callback_param;
163 spin_lock_irqsave(&pdmac->pool_lock, flags);
164 list_splice_tail_init(list, &pdmac->desc_pool);
165 spin_unlock_irqrestore(&pdmac->pool_lock, flags);
168 static inline void handle_cyclic_desc_list(struct list_head *list)
170 struct dma_pl330_desc *desc;
171 struct dma_pl330_chan *pch;
174 if (list_empty(list))
177 list_for_each_entry(desc, list, node) {
178 dma_async_tx_callback callback;
180 /* Change status to reload it */
183 callback = desc->txd.callback;
185 callback(desc->txd.callback_param);
188 spin_lock_irqsave(&pch->lock, flags);
189 list_splice_tail_init(list, &pch->work_list);
190 spin_unlock_irqrestore(&pch->lock, flags);
193 static inline void fill_queue(struct dma_pl330_chan *pch)
195 struct dma_pl330_desc *desc;
198 list_for_each_entry(desc, &pch->work_list, node) {
200 /* If already submitted */
201 if (desc->status == BUSY)
204 ret = pl330_submit_req(pch->pl330_chid,
209 } else if (ret == -EAGAIN) {
210 /* QFull or DMAC Dying */
213 /* Unacceptable request */
215 dev_err(pch->dmac->pif.dev, "%s:%d Bad Desc(%d)\n",
216 __func__, __LINE__, desc->txd.cookie);
217 tasklet_schedule(&pch->task);
222 static void pl330_tasklet(unsigned long data)
224 struct dma_pl330_chan *pch = (struct dma_pl330_chan *)data;
225 struct dma_pl330_desc *desc, *_dt;
229 spin_lock_irqsave(&pch->lock, flags);
231 /* Pick up ripe tomatoes */
232 list_for_each_entry_safe(desc, _dt, &pch->work_list, node)
233 if (desc->status == DONE) {
234 pch->chan.completed_cookie = desc->txd.cookie;
235 list_move_tail(&desc->node, &list);
238 /* Try to submit a req imm. next to the last completed cookie */
241 /* Make sure the PL330 Channel thread is active */
242 pl330_chan_ctrl(pch->pl330_chid, PL330_OP_START);
244 spin_unlock_irqrestore(&pch->lock, flags);
247 handle_cyclic_desc_list(&list);
249 free_desc_list(&list);
252 static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
254 struct dma_pl330_desc *desc = token;
255 struct dma_pl330_chan *pch = desc->pchan;
258 /* If desc aborted */
262 spin_lock_irqsave(&pch->lock, flags);
266 spin_unlock_irqrestore(&pch->lock, flags);
268 tasklet_schedule(&pch->task);
271 bool pl330_filter(struct dma_chan *chan, void *param)
275 if (chan->device->dev->driver != &pl330_driver.drv)
279 if (chan->device->dev->of_node) {
280 const __be32 *prop_value;
282 struct device_node *node;
284 prop_value = ((struct property *)param)->value;
285 phandle = be32_to_cpup(prop_value++);
286 node = of_find_node_by_phandle(phandle);
287 return ((chan->private == node) &&
288 (chan->chan_id == be32_to_cpup(prop_value)));
292 peri_id = chan->private;
293 return *peri_id == (unsigned)param;
295 EXPORT_SYMBOL(pl330_filter);
297 static int pl330_alloc_chan_resources(struct dma_chan *chan)
299 struct dma_pl330_chan *pch = to_pchan(chan);
300 struct dma_pl330_dmac *pdmac = pch->dmac;
303 spin_lock_irqsave(&pch->lock, flags);
305 chan->completed_cookie = chan->cookie = 1;
308 pch->pl330_chid = pl330_request_channel(&pdmac->pif);
309 if (!pch->pl330_chid) {
310 spin_unlock_irqrestore(&pch->lock, flags);
314 tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
316 spin_unlock_irqrestore(&pch->lock, flags);
321 static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned long arg)
323 struct dma_pl330_chan *pch = to_pchan(chan);
324 struct dma_pl330_desc *desc, *_dt;
326 struct dma_pl330_dmac *pdmac = pch->dmac;
327 struct dma_slave_config *slave_config;
331 case DMA_TERMINATE_ALL:
332 spin_lock_irqsave(&pch->lock, flags);
334 /* FLUSH the PL330 Channel thread */
335 pl330_chan_ctrl(pch->pl330_chid, PL330_OP_FLUSH);
337 /* Mark all desc done */
338 list_for_each_entry_safe(desc, _dt, &pch->work_list , node) {
340 pch->completed = desc->txd.cookie;
341 list_move_tail(&desc->node, &list);
344 list_splice_tail_init(&list, &pdmac->desc_pool);
345 spin_unlock_irqrestore(&pch->lock, flags);
347 case DMA_SLAVE_CONFIG:
348 slave_config = (struct dma_slave_config *)arg;
350 if (slave_config->direction == DMA_MEM_TO_DEV) {
351 if (slave_config->dst_addr)
352 pch->fifo_addr = slave_config->dst_addr;
353 if (slave_config->dst_addr_width)
354 pch->burst_sz = __ffs(slave_config->dst_addr_width);
355 if (slave_config->dst_maxburst)
356 pch->burst_len = slave_config->dst_maxburst;
357 } else if (slave_config->direction == DMA_DEV_TO_MEM) {
358 if (slave_config->src_addr)
359 pch->fifo_addr = slave_config->src_addr;
360 if (slave_config->src_addr_width)
361 pch->burst_sz = __ffs(slave_config->src_addr_width);
362 if (slave_config->src_maxburst)
363 pch->burst_len = slave_config->src_maxburst;
367 dev_err(pch->dmac->pif.dev, "Not supported command.\n");
374 static void pl330_free_chan_resources(struct dma_chan *chan)
376 struct dma_pl330_chan *pch = to_pchan(chan);
379 spin_lock_irqsave(&pch->lock, flags);
381 tasklet_kill(&pch->task);
383 pl330_release_channel(pch->pl330_chid);
384 pch->pl330_chid = NULL;
387 list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
389 spin_unlock_irqrestore(&pch->lock, flags);
392 static enum dma_status
393 pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
394 struct dma_tx_state *txstate)
396 struct dma_pl330_chan *pch = to_pchan(chan);
397 dma_cookie_t last_done, last_used;
400 last_done = chan->completed_cookie;
401 last_used = chan->cookie;
403 ret = dma_async_is_complete(cookie, last_done, last_used);
405 dma_set_tx_state(txstate, last_done, last_used, 0);
410 static void pl330_issue_pending(struct dma_chan *chan)
412 pl330_tasklet((unsigned long) to_pchan(chan));
416 * We returned the last one of the circular list of descriptor(s)
417 * from prep_xxx, so the argument to submit corresponds to the last
418 * descriptor of the list.
420 static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx)
422 struct dma_pl330_desc *desc, *last = to_desc(tx);
423 struct dma_pl330_chan *pch = to_pchan(tx->chan);
427 spin_lock_irqsave(&pch->lock, flags);
429 /* Assign cookies to all nodes */
430 cookie = tx->chan->cookie;
432 while (!list_empty(&last->node)) {
433 desc = list_entry(last->node.next, struct dma_pl330_desc, node);
437 desc->txd.cookie = cookie;
439 list_move_tail(&desc->node, &pch->work_list);
444 last->txd.cookie = cookie;
446 list_add_tail(&last->node, &pch->work_list);
448 tx->chan->cookie = cookie;
450 spin_unlock_irqrestore(&pch->lock, flags);
455 static inline void _init_desc(struct dma_pl330_desc *desc)
458 desc->req.x = &desc->px;
459 desc->req.token = desc;
460 desc->rqcfg.swap = SWAP_NO;
461 desc->rqcfg.privileged = 0;
462 desc->rqcfg.insnaccess = 0;
463 desc->rqcfg.scctl = SCCTRL0;
464 desc->rqcfg.dcctl = DCCTRL0;
465 desc->req.cfg = &desc->rqcfg;
466 desc->req.xfer_cb = dma_pl330_rqcb;
467 desc->txd.tx_submit = pl330_tx_submit;
469 INIT_LIST_HEAD(&desc->node);
472 /* Returns the number of descriptors added to the DMAC pool */
473 int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count)
475 struct dma_pl330_desc *desc;
482 desc = kmalloc(count * sizeof(*desc), flg);
486 spin_lock_irqsave(&pdmac->pool_lock, flags);
488 for (i = 0; i < count; i++) {
489 _init_desc(&desc[i]);
490 list_add_tail(&desc[i].node, &pdmac->desc_pool);
493 spin_unlock_irqrestore(&pdmac->pool_lock, flags);
498 static struct dma_pl330_desc *
499 pluck_desc(struct dma_pl330_dmac *pdmac)
501 struct dma_pl330_desc *desc = NULL;
507 spin_lock_irqsave(&pdmac->pool_lock, flags);
509 if (!list_empty(&pdmac->desc_pool)) {
510 desc = list_entry(pdmac->desc_pool.next,
511 struct dma_pl330_desc, node);
513 list_del_init(&desc->node);
516 desc->txd.callback = NULL;
519 spin_unlock_irqrestore(&pdmac->pool_lock, flags);
524 static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch)
526 struct dma_pl330_dmac *pdmac = pch->dmac;
527 u8 *peri_id = pch->chan.private;
528 struct dma_pl330_desc *desc;
530 /* Pluck one desc from the pool of DMAC */
531 desc = pluck_desc(pdmac);
533 /* If the DMAC pool is empty, alloc new */
535 if (!add_desc(pdmac, GFP_ATOMIC, 1))
539 desc = pluck_desc(pdmac);
541 dev_err(pch->dmac->pif.dev,
542 "%s:%d ALERT!\n", __func__, __LINE__);
547 /* Initialize the descriptor */
549 desc->txd.cookie = 0;
550 async_tx_ack(&desc->txd);
552 desc->req.peri = peri_id ? pch->chan.chan_id : 0;
554 dma_async_tx_descriptor_init(&desc->txd, &pch->chan);
559 static inline void fill_px(struct pl330_xfer *px,
560 dma_addr_t dst, dma_addr_t src, size_t len)
568 static struct dma_pl330_desc *
569 __pl330_prep_dma_memcpy(struct dma_pl330_chan *pch, dma_addr_t dst,
570 dma_addr_t src, size_t len)
572 struct dma_pl330_desc *desc = pl330_get_desc(pch);
575 dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n",
581 * Ideally we should lookout for reqs bigger than
582 * those that can be programmed with 256 bytes of
583 * MC buffer, but considering a req size is seldom
584 * going to be word-unaligned and more than 200MB,
586 * Also, should the limit is reached we'd rather
587 * have the platform increase MC buffer size than
588 * complicating this API driver.
590 fill_px(&desc->px, dst, src, len);
595 /* Call after fixing burst size */
596 static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len)
598 struct dma_pl330_chan *pch = desc->pchan;
599 struct pl330_info *pi = &pch->dmac->pif;
602 burst_len = pi->pcfg.data_bus_width / 8;
603 burst_len *= pi->pcfg.data_buf_dep;
604 burst_len >>= desc->rqcfg.brst_size;
606 /* src/dst_burst_len can't be more than 16 */
610 while (burst_len > 1) {
611 if (!(len % (burst_len << desc->rqcfg.brst_size)))
619 static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
620 struct dma_chan *chan, dma_addr_t dma_addr, size_t len,
621 size_t period_len, enum dma_transfer_direction direction)
623 struct dma_pl330_desc *desc;
624 struct dma_pl330_chan *pch = to_pchan(chan);
628 desc = pl330_get_desc(pch);
630 dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n",
637 desc->rqcfg.src_inc = 1;
638 desc->rqcfg.dst_inc = 0;
639 desc->req.rqtype = MEMTODEV;
641 dst = pch->fifo_addr;
644 desc->rqcfg.src_inc = 0;
645 desc->rqcfg.dst_inc = 1;
646 desc->req.rqtype = DEVTOMEM;
647 src = pch->fifo_addr;
651 dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n",
656 desc->rqcfg.brst_size = pch->burst_sz;
657 desc->rqcfg.brst_len = 1;
661 fill_px(&desc->px, dst, src, period_len);
666 static struct dma_async_tx_descriptor *
667 pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
668 dma_addr_t src, size_t len, unsigned long flags)
670 struct dma_pl330_desc *desc;
671 struct dma_pl330_chan *pch = to_pchan(chan);
672 struct pl330_info *pi;
675 if (unlikely(!pch || !len))
678 pi = &pch->dmac->pif;
680 desc = __pl330_prep_dma_memcpy(pch, dst, src, len);
684 desc->rqcfg.src_inc = 1;
685 desc->rqcfg.dst_inc = 1;
686 desc->req.rqtype = MEMTOMEM;
688 /* Select max possible burst size */
689 burst = pi->pcfg.data_bus_width / 8;
697 desc->rqcfg.brst_size = 0;
698 while (burst != (1 << desc->rqcfg.brst_size))
699 desc->rqcfg.brst_size++;
701 desc->rqcfg.brst_len = get_burst_len(desc, len);
703 desc->txd.flags = flags;
708 static struct dma_async_tx_descriptor *
709 pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
710 unsigned int sg_len, enum dma_transfer_direction direction,
713 struct dma_pl330_desc *first, *desc = NULL;
714 struct dma_pl330_chan *pch = to_pchan(chan);
715 struct scatterlist *sg;
720 if (unlikely(!pch || !sgl || !sg_len))
723 addr = pch->fifo_addr;
727 for_each_sg(sgl, sg, sg_len, i) {
729 desc = pl330_get_desc(pch);
731 struct dma_pl330_dmac *pdmac = pch->dmac;
733 dev_err(pch->dmac->pif.dev,
734 "%s:%d Unable to fetch desc\n",
739 spin_lock_irqsave(&pdmac->pool_lock, flags);
741 while (!list_empty(&first->node)) {
742 desc = list_entry(first->node.next,
743 struct dma_pl330_desc, node);
744 list_move_tail(&desc->node, &pdmac->desc_pool);
747 list_move_tail(&first->node, &pdmac->desc_pool);
749 spin_unlock_irqrestore(&pdmac->pool_lock, flags);
757 list_add_tail(&desc->node, &first->node);
759 if (direction == DMA_MEM_TO_DEV) {
760 desc->rqcfg.src_inc = 1;
761 desc->rqcfg.dst_inc = 0;
762 desc->req.rqtype = MEMTODEV;
764 addr, sg_dma_address(sg), sg_dma_len(sg));
766 desc->rqcfg.src_inc = 0;
767 desc->rqcfg.dst_inc = 1;
768 desc->req.rqtype = DEVTOMEM;
770 sg_dma_address(sg), addr, sg_dma_len(sg));
773 desc->rqcfg.brst_size = pch->burst_sz;
774 desc->rqcfg.brst_len = 1;
777 /* Return the last desc in the chain */
778 desc->txd.flags = flg;
782 static irqreturn_t pl330_irq_handler(int irq, void *data)
784 if (pl330_update(data))
791 pl330_probe(struct amba_device *adev, const struct amba_id *id)
793 struct dma_pl330_platdata *pdat;
794 struct dma_pl330_dmac *pdmac;
795 struct dma_pl330_chan *pch;
796 struct pl330_info *pi;
797 struct dma_device *pd;
798 struct resource *res;
802 pdat = adev->dev.platform_data;
804 /* Allocate a new DMAC and its Channels */
805 pdmac = kzalloc(sizeof(*pdmac), GFP_KERNEL);
807 dev_err(&adev->dev, "unable to allocate mem\n");
812 pi->dev = &adev->dev;
813 pi->pl330_data = NULL;
814 pi->mcbufsz = pdat ? pdat->mcbuf_sz : 0;
817 request_mem_region(res->start, resource_size(res), "dma-pl330");
819 pi->base = ioremap(res->start, resource_size(res));
825 pdmac->clk = clk_get(&adev->dev, "dma");
826 if (IS_ERR(pdmac->clk)) {
827 dev_err(&adev->dev, "Cannot get operation clock.\n");
832 amba_set_drvdata(adev, pdmac);
834 #ifndef CONFIG_PM_RUNTIME
836 clk_enable(pdmac->clk);
840 ret = request_irq(irq, pl330_irq_handler, 0,
841 dev_name(&adev->dev), pi);
849 INIT_LIST_HEAD(&pdmac->desc_pool);
850 spin_lock_init(&pdmac->pool_lock);
852 /* Create a descriptor pool of default size */
853 if (!add_desc(pdmac, GFP_KERNEL, NR_DEFAULT_DESC))
854 dev_warn(&adev->dev, "unable to allocate desc\n");
857 INIT_LIST_HEAD(&pd->channels);
859 /* Initialize channel parameters */
860 num_chan = max(pdat ? pdat->nr_valid_peri : (u8)pi->pcfg.num_peri,
861 (u8)pi->pcfg.num_chan);
862 pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
864 for (i = 0; i < num_chan; i++) {
865 pch = &pdmac->peripherals[i];
866 if (!adev->dev.of_node)
867 pch->chan.private = pdat ? &pdat->peri_id[i] : NULL;
869 pch->chan.private = adev->dev.of_node;
871 INIT_LIST_HEAD(&pch->work_list);
872 spin_lock_init(&pch->lock);
873 pch->pl330_chid = NULL;
874 pch->chan.device = pd;
877 /* Add the channel to the DMAC list */
878 list_add_tail(&pch->chan.device_node, &pd->channels);
881 pd->dev = &adev->dev;
883 pd->cap_mask = pdat->cap_mask;
885 dma_cap_set(DMA_MEMCPY, pd->cap_mask);
886 if (pi->pcfg.num_peri) {
887 dma_cap_set(DMA_SLAVE, pd->cap_mask);
888 dma_cap_set(DMA_CYCLIC, pd->cap_mask);
892 pd->device_alloc_chan_resources = pl330_alloc_chan_resources;
893 pd->device_free_chan_resources = pl330_free_chan_resources;
894 pd->device_prep_dma_memcpy = pl330_prep_dma_memcpy;
895 pd->device_prep_dma_cyclic = pl330_prep_dma_cyclic;
896 pd->device_tx_status = pl330_tx_status;
897 pd->device_prep_slave_sg = pl330_prep_slave_sg;
898 pd->device_control = pl330_control;
899 pd->device_issue_pending = pl330_issue_pending;
901 ret = dma_async_device_register(pd);
903 dev_err(&adev->dev, "unable to register DMAC\n");
908 "Loaded driver for PL330 DMAC-%d\n", adev->periphid);
910 "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n",
911 pi->pcfg.data_buf_dep,
912 pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan,
913 pi->pcfg.num_peri, pi->pcfg.num_events);
922 #ifndef CONFIG_PM_RUNTIME
923 clk_disable(pdmac->clk);
929 release_mem_region(res->start, resource_size(res));
935 static int __devexit pl330_remove(struct amba_device *adev)
937 struct dma_pl330_dmac *pdmac = amba_get_drvdata(adev);
938 struct dma_pl330_chan *pch, *_p;
939 struct pl330_info *pi;
940 struct resource *res;
946 amba_set_drvdata(adev, NULL);
949 list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels,
952 /* Remove the channel */
953 list_del(&pch->chan.device_node);
955 /* Flush the channel */
956 pl330_control(&pch->chan, DMA_TERMINATE_ALL, 0);
957 pl330_free_chan_resources(&pch->chan);
970 release_mem_region(res->start, resource_size(res));
972 #ifndef CONFIG_PM_RUNTIME
973 clk_disable(pdmac->clk);
981 static struct amba_id pl330_ids[] = {
989 MODULE_DEVICE_TABLE(amba, pl330_ids);
991 #ifdef CONFIG_PM_RUNTIME
992 static int pl330_runtime_suspend(struct device *dev)
994 struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
997 dev_err(dev, "failed to get dmac\n");
1001 clk_disable(pdmac->clk);
1006 static int pl330_runtime_resume(struct device *dev)
1008 struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
1011 dev_err(dev, "failed to get dmac\n");
1015 clk_enable(pdmac->clk);
1020 #define pl330_runtime_suspend NULL
1021 #define pl330_runtime_resume NULL
1022 #endif /* CONFIG_PM_RUNTIME */
1024 static const struct dev_pm_ops pl330_pm_ops = {
1025 .runtime_suspend = pl330_runtime_suspend,
1026 .runtime_resume = pl330_runtime_resume,
1029 static struct amba_driver pl330_driver = {
1031 .owner = THIS_MODULE,
1032 .name = "dma-pl330",
1033 .pm = &pl330_pm_ops,
1035 .id_table = pl330_ids,
1036 .probe = pl330_probe,
1037 .remove = pl330_remove,
1040 static int __init pl330_init(void)
1042 return amba_driver_register(&pl330_driver);
1044 module_init(pl330_init);
1046 static void __exit pl330_exit(void)
1048 amba_driver_unregister(&pl330_driver);
1051 module_exit(pl330_exit);
1053 MODULE_AUTHOR("Jaswinder Singh <jassi.brar@samsung.com>");
1054 MODULE_DESCRIPTION("API Driver for PL330 DMAC");
1055 MODULE_LICENSE("GPL");