Lines Matching full:fdma
10 static int __fdma_db_add(struct fdma *fdma, int dcb_idx, int db_idx, u64 status, in __fdma_db_add() argument
11 int (*cb)(struct fdma *fdma, int dcb_idx, in __fdma_db_add() argument
14 struct fdma_db *db = fdma_db_get(fdma, dcb_idx, db_idx); in __fdma_db_add()
18 return cb(fdma, dcb_idx, db_idx, &db->dataptr); in __fdma_db_add()
22 int fdma_db_add(struct fdma *fdma, int dcb_idx, int db_idx, u64 status) in fdma_db_add() argument
24 return __fdma_db_add(fdma, in fdma_db_add()
28 fdma->ops.dataptr_cb); in fdma_db_add()
32 int __fdma_dcb_add(struct fdma *fdma, int dcb_idx, u64 info, u64 status, in __fdma_dcb_add() argument
33 int (*dcb_cb)(struct fdma *fdma, int dcb_idx, u64 *nextptr), in __fdma_dcb_add() argument
34 int (*db_cb)(struct fdma *fdma, int dcb_idx, int db_idx, in __fdma_dcb_add() argument
37 struct fdma_dcb *dcb = fdma_dcb_get(fdma, dcb_idx); in __fdma_dcb_add()
40 for (i = 0; i < fdma->n_dbs; i++) { in __fdma_dcb_add()
41 err = __fdma_db_add(fdma, dcb_idx, i, status, db_cb); in __fdma_dcb_add()
46 err = dcb_cb(fdma, dcb_idx, &fdma->last_dcb->nextptr); in __fdma_dcb_add()
50 fdma->last_dcb = dcb; in __fdma_dcb_add()
60 int fdma_dcb_add(struct fdma *fdma, int dcb_idx, u64 info, u64 status) in fdma_dcb_add() argument
62 return __fdma_dcb_add(fdma, in fdma_dcb_add()
65 fdma->ops.nextptr_cb, in fdma_dcb_add()
66 fdma->ops.dataptr_cb); in fdma_dcb_add()
71 int fdma_dcbs_init(struct fdma *fdma, u64 info, u64 status) in fdma_dcbs_init() argument
75 fdma->last_dcb = fdma->dcbs; in fdma_dcbs_init()
76 fdma->db_index = 0; in fdma_dcbs_init()
77 fdma->dcb_index = 0; in fdma_dcbs_init()
79 for (i = 0; i < fdma->n_dcbs; i++) { in fdma_dcbs_init()
80 err = fdma_dcb_add(fdma, i, info, status); in fdma_dcbs_init()
89 /* Allocate coherent DMA memory for FDMA. */
90 int fdma_alloc_coherent(struct device *dev, struct fdma *fdma) in fdma_alloc_coherent() argument
92 fdma->dcbs = dma_alloc_coherent(dev, in fdma_alloc_coherent()
93 fdma->size, in fdma_alloc_coherent()
94 &fdma->dma, in fdma_alloc_coherent()
96 if (!fdma->dcbs) in fdma_alloc_coherent()
103 /* Allocate physical memory for FDMA. */
104 int fdma_alloc_phys(struct fdma *fdma) in fdma_alloc_phys() argument
106 fdma->dcbs = kzalloc(fdma->size, GFP_KERNEL); in fdma_alloc_phys()
107 if (!fdma->dcbs) in fdma_alloc_phys()
110 fdma->dma = virt_to_phys(fdma->dcbs); in fdma_alloc_phys()
117 void fdma_free_coherent(struct device *dev, struct fdma *fdma) in fdma_free_coherent() argument
119 dma_free_coherent(dev, fdma->size, fdma->dcbs, fdma->dma); in fdma_free_coherent()
124 void fdma_free_phys(struct fdma *fdma) in fdma_free_phys() argument
126 kfree(fdma->dcbs); in fdma_free_phys()
130 /* Get the size of the FDMA memory */
131 u32 fdma_get_size(struct fdma *fdma) in fdma_get_size() argument
133 return ALIGN(sizeof(struct fdma_dcb) * fdma->n_dcbs, PAGE_SIZE); in fdma_get_size()
137 /* Get the size of the FDMA memory. This function is only applicable if the
140 u32 fdma_get_size_contiguous(struct fdma *fdma) in fdma_get_size_contiguous() argument
142 return ALIGN(fdma->n_dcbs * sizeof(struct fdma_dcb) + in fdma_get_size_contiguous()
143 fdma->n_dcbs * fdma->n_dbs * fdma->db_size, in fdma_get_size_contiguous()