diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2009-11-19 13:49:17 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-11-20 01:45:19 -0500 |
commit | 61f135b92f4758bc4d4767cd0a5d2da954e27f14 (patch) | |
tree | 388fdc08150e2f8fcb2859f70ca67cdd86616f36 /drivers/dma/coh901318_lli.h | |
parent | b419148e567728f6af0c3b01965c1cc141e3e13a (diff) |
Add COH 901 318 DMA block driver v5
This patch adds support for the ST-Ericsson COH 901 318 DMA block,
found in the U300 series platforms. It registers a DMA slave for
device I/O and also a memcpy slave for memcpy.
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/coh901318_lli.h')
-rw-r--r-- | drivers/dma/coh901318_lli.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/drivers/dma/coh901318_lli.h b/drivers/dma/coh901318_lli.h new file mode 100644 index 000000000000..7bf713b79c6b --- /dev/null +++ b/drivers/dma/coh901318_lli.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * driver/dma/coh901318_lli.h | ||
3 | * | ||
4 | * Copyright (C) 2007-2009 ST-Ericsson | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | * Support functions for handling lli for coh901318 | ||
7 | * Author: Per Friden <per.friden@stericsson.com> | ||
8 | */ | ||
9 | |||
10 | #ifndef COH901318_LLI_H | ||
11 | #define COH901318_LLI_H | ||
12 | |||
13 | #include <mach/coh901318.h> | ||
14 | |||
15 | struct device; | ||
16 | |||
17 | struct coh901318_pool { | ||
18 | spinlock_t lock; | ||
19 | struct dma_pool *dmapool; | ||
20 | struct device *dev; | ||
21 | |||
22 | #ifdef CONFIG_DEBUG_FS | ||
23 | int debugfs_pool_counter; | ||
24 | #endif | ||
25 | }; | ||
26 | |||
27 | struct device; | ||
28 | /** | ||
29 | * coh901318_pool_create() - Creates an dma pool for lli:s | ||
30 | * @pool: pool handle | ||
31 | * @dev: dma device | ||
32 | * @lli_nbr: number of lli:s in the pool | ||
33 | * @algin: adress alignemtn of lli:s | ||
34 | * returns 0 on success otherwise none zero | ||
35 | */ | ||
36 | int coh901318_pool_create(struct coh901318_pool *pool, | ||
37 | struct device *dev, | ||
38 | size_t lli_nbr, size_t align); | ||
39 | |||
40 | /** | ||
41 | * coh901318_pool_destroy() - Destroys the dma pool | ||
42 | * @pool: pool handle | ||
43 | * returns 0 on success otherwise none zero | ||
44 | */ | ||
45 | int coh901318_pool_destroy(struct coh901318_pool *pool); | ||
46 | |||
47 | /** | ||
48 | * coh901318_lli_alloc() - Allocates a linked list | ||
49 | * | ||
50 | * @pool: pool handle | ||
51 | * @len: length to list | ||
52 | * return: none NULL if success otherwise NULL | ||
53 | */ | ||
54 | struct coh901318_lli * | ||
55 | coh901318_lli_alloc(struct coh901318_pool *pool, | ||
56 | unsigned int len); | ||
57 | |||
58 | /** | ||
59 | * coh901318_lli_free() - Returns the linked list items to the pool | ||
60 | * @pool: pool handle | ||
61 | * @lli: reference to lli pointer to be freed | ||
62 | */ | ||
63 | void coh901318_lli_free(struct coh901318_pool *pool, | ||
64 | struct coh901318_lli **lli); | ||
65 | |||
66 | /** | ||
67 | * coh901318_lli_fill_memcpy() - Prepares the lli:s for dma memcpy | ||
68 | * @pool: pool handle | ||
69 | * @lli: allocated lli | ||
70 | * @src: src address | ||
71 | * @size: transfer size | ||
72 | * @dst: destination address | ||
73 | * @ctrl_chained: ctrl for chained lli | ||
74 | * @ctrl_last: ctrl for the last lli | ||
75 | * returns number of CPU interrupts for the lli, negative on error. | ||
76 | */ | ||
77 | int | ||
78 | coh901318_lli_fill_memcpy(struct coh901318_pool *pool, | ||
79 | struct coh901318_lli *lli, | ||
80 | dma_addr_t src, unsigned int size, | ||
81 | dma_addr_t dst, u32 ctrl_chained, u32 ctrl_last); | ||
82 | |||
83 | /** | ||
84 | * coh901318_lli_fill_single() - Prepares the lli:s for dma single transfer | ||
85 | * @pool: pool handle | ||
86 | * @lli: allocated lli | ||
87 | * @buf: transfer buffer | ||
88 | * @size: transfer size | ||
89 | * @dev_addr: address of periphal | ||
90 | * @ctrl_chained: ctrl for chained lli | ||
91 | * @ctrl_last: ctrl for the last lli | ||
92 | * @dir: direction of transfer (to or from device) | ||
93 | * returns number of CPU interrupts for the lli, negative on error. | ||
94 | */ | ||
95 | int | ||
96 | coh901318_lli_fill_single(struct coh901318_pool *pool, | ||
97 | struct coh901318_lli *lli, | ||
98 | dma_addr_t buf, unsigned int size, | ||
99 | dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_last, | ||
100 | enum dma_data_direction dir); | ||
101 | |||
102 | /** | ||
103 | * coh901318_lli_fill_single() - Prepares the lli:s for dma scatter list transfer | ||
104 | * @pool: pool handle | ||
105 | * @lli: allocated lli | ||
106 | * @sg: scatter gather list | ||
107 | * @nents: number of entries in sg | ||
108 | * @dev_addr: address of periphal | ||
109 | * @ctrl_chained: ctrl for chained lli | ||
110 | * @ctrl: ctrl of middle lli | ||
111 | * @ctrl_last: ctrl for the last lli | ||
112 | * @dir: direction of transfer (to or from device) | ||
113 | * @ctrl_irq_mask: ctrl mask for CPU interrupt | ||
114 | * returns number of CPU interrupts for the lli, negative on error. | ||
115 | */ | ||
116 | int | ||
117 | coh901318_lli_fill_sg(struct coh901318_pool *pool, | ||
118 | struct coh901318_lli *lli, | ||
119 | struct scatterlist *sg, unsigned int nents, | ||
120 | dma_addr_t dev_addr, u32 ctrl_chained, | ||
121 | u32 ctrl, u32 ctrl_last, | ||
122 | enum dma_data_direction dir, u32 ctrl_irq_mask); | ||
123 | |||
124 | #endif /* COH901318_LLI_H */ | ||