aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/amba
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-01 19:41:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-01 19:41:07 -0400
commita6dc77254b3c3eb0307b372b77b861d5cd2ead08 (patch)
tree5770a808b0527eebeff43f16508ea8f03e459b58 /include/linux/amba
parent02a6ec6a24077ffda33b99cb193e8a536b90711d (diff)
parent0e52d987c0b242fe3fe4c8e9732bd663cce0e50b (diff)
Merge branch 'dmaengine' of git://git.linaro.org/people/rmk/linux-arm
Pull ARM DMA engine updates from Russell King: "This looks scary at first glance, but what it is is: - a rework of the sa11x0 DMA engine driver merged during the previous cycle, to extract a common set of helper functions for DMA engine implementations. - conversion of amba-pl08x.c to use these helper functions. - addition of OMAP DMA engine driver (using these helper functions), and conversion of some of the OMAP DMA users to use DMA engine. Nothing in the helper functions is ARM specific, so I hope that other implementations can consolidate some of their code by making use of these helpers. This has been sitting in linux-next most of the merge cycle, and has been tested by several OMAP folk. I've tested it on sa11x0 platforms, and given it my best shot on my broken platforms which have the amba-pl08x controller. The last point is the addition to feature-removal-schedule.txt, which will have a merge conflict. Between myself and TI, we're planning to remove the old TI DMA implementation next year." Fix up trivial add/add conflicts in Documentation/feature-removal-schedule.txt and drivers/dma/{Kconfig,Makefile} * 'dmaengine' of git://git.linaro.org/people/rmk/linux-arm: (53 commits) ARM: 7481/1: OMAP2+: omap2plus_defconfig: enable OMAP DMA engine ARM: 7464/1: mmc: omap_hsmmc: ensure probe returns error if DMA channel request fails Add feature removal of old OMAP private DMA implementation mtd: omap2: remove private DMA API implementation mtd: omap2: add DMA engine support spi: omap2-mcspi: remove private DMA API implementation spi: omap2-mcspi: add DMA engine support ARM: omap: remove mmc platform data dma_mask and initialization mmc: omap: remove private DMA API implementation mmc: omap: add DMA engine support mmc: omap_hsmmc: remove private DMA API implementation mmc: omap_hsmmc: add DMA engine support dmaengine: omap: add support for cyclic DMA dmaengine: omap: add support for setting fi dmaengine: omap: add support for returning residue in tx_state method dmaengine: add OMAP DMA engine driver dmaengine: sa11x0-dma: add cyclic DMA support dmaengine: sa11x0-dma: fix DMA residue support dmaengine: PL08x: ensure all descriptors are freed when channel is released dmaengine: PL08x: get rid of write only pool_ctr and free_txd locking ...
Diffstat (limited to 'include/linux/amba')
-rw-r--r--include/linux/amba/pl08x.h156
1 files changed, 8 insertions, 148 deletions
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 02549017212a..2a5f64a11b77 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -21,8 +21,9 @@
21#include <linux/dmaengine.h> 21#include <linux/dmaengine.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23 23
24struct pl08x_lli;
25struct pl08x_driver_data; 24struct pl08x_driver_data;
25struct pl08x_phy_chan;
26struct pl08x_txd;
26 27
27/* Bitmasks for selecting AHB ports for DMA transfers */ 28/* Bitmasks for selecting AHB ports for DMA transfers */
28enum { 29enum {
@@ -46,170 +47,29 @@ enum {
46 * devices with static assignments 47 * devices with static assignments
47 * @muxval: a number usually used to poke into some mux regiser to 48 * @muxval: a number usually used to poke into some mux regiser to
48 * mux in the signal to this channel 49 * mux in the signal to this channel
49 * @cctl_opt: default options for the channel control register 50 * @cctl_memcpy: options for the channel control register for memcpy
51 * *** not used for slave channels ***
50 * @addr: source/target address in physical memory for this DMA channel, 52 * @addr: source/target address in physical memory for this DMA channel,
51 * can be the address of a FIFO register for burst requests for example. 53 * can be the address of a FIFO register for burst requests for example.
52 * This can be left undefined if the PrimeCell API is used for configuring 54 * This can be left undefined if the PrimeCell API is used for configuring
53 * this. 55 * this.
54 * @circular_buffer: whether the buffer passed in is circular and
55 * shall simply be looped round round (like a record baby round
56 * round round round)
57 * @single: the device connected to this channel will request single DMA 56 * @single: the device connected to this channel will request single DMA
58 * transfers, not bursts. (Bursts are default.) 57 * transfers, not bursts. (Bursts are default.)
59 * @periph_buses: the device connected to this channel is accessible via 58 * @periph_buses: the device connected to this channel is accessible via
60 * these buses (use PL08X_AHB1 | PL08X_AHB2). 59 * these buses (use PL08X_AHB1 | PL08X_AHB2).
61 */ 60 */
62struct pl08x_channel_data { 61struct pl08x_channel_data {
63 char *bus_id; 62 const char *bus_id;
64 int min_signal; 63 int min_signal;
65 int max_signal; 64 int max_signal;
66 u32 muxval; 65 u32 muxval;
67 u32 cctl; 66 u32 cctl_memcpy;
68 dma_addr_t addr; 67 dma_addr_t addr;
69 bool circular_buffer;
70 bool single; 68 bool single;
71 u8 periph_buses; 69 u8 periph_buses;
72}; 70};
73 71
74/** 72/**
75 * Struct pl08x_bus_data - information of source or destination
76 * busses for a transfer
77 * @addr: current address
78 * @maxwidth: the maximum width of a transfer on this bus
79 * @buswidth: the width of this bus in bytes: 1, 2 or 4
80 */
81struct pl08x_bus_data {
82 dma_addr_t addr;
83 u8 maxwidth;
84 u8 buswidth;
85};
86
87/**
88 * struct pl08x_phy_chan - holder for the physical channels
89 * @id: physical index to this channel
90 * @lock: a lock to use when altering an instance of this struct
91 * @signal: the physical signal (aka channel) serving this physical channel
92 * right now
93 * @serving: the virtual channel currently being served by this physical
94 * channel
95 * @locked: channel unavailable for the system, e.g. dedicated to secure
96 * world
97 */
98struct pl08x_phy_chan {
99 unsigned int id;
100 void __iomem *base;
101 spinlock_t lock;
102 int signal;
103 struct pl08x_dma_chan *serving;
104 bool locked;
105};
106
107/**
108 * struct pl08x_sg - structure containing data per sg
109 * @src_addr: src address of sg
110 * @dst_addr: dst address of sg
111 * @len: transfer len in bytes
112 * @node: node for txd's dsg_list
113 */
114struct pl08x_sg {
115 dma_addr_t src_addr;
116 dma_addr_t dst_addr;
117 size_t len;
118 struct list_head node;
119};
120
121/**
122 * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
123 * @tx: async tx descriptor
124 * @node: node for txd list for channels
125 * @dsg_list: list of children sg's
126 * @direction: direction of transfer
127 * @llis_bus: DMA memory address (physical) start for the LLIs
128 * @llis_va: virtual memory address start for the LLIs
129 * @cctl: control reg values for current txd
130 * @ccfg: config reg values for current txd
131 */
132struct pl08x_txd {
133 struct dma_async_tx_descriptor tx;
134 struct list_head node;
135 struct list_head dsg_list;
136 enum dma_transfer_direction direction;
137 dma_addr_t llis_bus;
138 struct pl08x_lli *llis_va;
139 /* Default cctl value for LLIs */
140 u32 cctl;
141 /*
142 * Settings to be put into the physical channel when we
143 * trigger this txd. Other registers are in llis_va[0].
144 */
145 u32 ccfg;
146};
147
148/**
149 * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
150 * states
151 * @PL08X_CHAN_IDLE: the channel is idle
152 * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
153 * channel and is running a transfer on it
154 * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
155 * channel, but the transfer is currently paused
156 * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
157 * channel to become available (only pertains to memcpy channels)
158 */
159enum pl08x_dma_chan_state {
160 PL08X_CHAN_IDLE,
161 PL08X_CHAN_RUNNING,
162 PL08X_CHAN_PAUSED,
163 PL08X_CHAN_WAITING,
164};
165
166/**
167 * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
168 * @chan: wrappped abstract channel
169 * @phychan: the physical channel utilized by this channel, if there is one
170 * @phychan_hold: if non-zero, hold on to the physical channel even if we
171 * have no pending entries
172 * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
173 * @name: name of channel
174 * @cd: channel platform data
175 * @runtime_addr: address for RX/TX according to the runtime config
176 * @runtime_direction: current direction of this channel according to
177 * runtime config
178 * @pend_list: queued transactions pending on this channel
179 * @at: active transaction on this channel
180 * @lock: a lock for this channel data
181 * @host: a pointer to the host (internal use)
182 * @state: whether the channel is idle, paused, running etc
183 * @slave: whether this channel is a device (slave) or for memcpy
184 * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
185 * channels. Fill with 'true' if peripheral should be flow controller. Direction
186 * will be selected at Runtime.
187 * @waiting: a TX descriptor on this channel which is waiting for a physical
188 * channel to become available
189 */
190struct pl08x_dma_chan {
191 struct dma_chan chan;
192 struct pl08x_phy_chan *phychan;
193 int phychan_hold;
194 struct tasklet_struct tasklet;
195 char *name;
196 const struct pl08x_channel_data *cd;
197 dma_addr_t src_addr;
198 dma_addr_t dst_addr;
199 u32 src_cctl;
200 u32 dst_cctl;
201 enum dma_transfer_direction runtime_direction;
202 struct list_head pend_list;
203 struct pl08x_txd *at;
204 spinlock_t lock;
205 struct pl08x_driver_data *host;
206 enum pl08x_dma_chan_state state;
207 bool slave;
208 bool device_fc;
209 struct pl08x_txd *waiting;
210};
211
212/**
213 * struct pl08x_platform_data - the platform configuration for the PL08x 73 * struct pl08x_platform_data - the platform configuration for the PL08x
214 * PrimeCells. 74 * PrimeCells.
215 * @slave_channels: the channels defined for the different devices on the 75 * @slave_channels: the channels defined for the different devices on the
@@ -229,8 +89,8 @@ struct pl08x_platform_data {
229 const struct pl08x_channel_data *slave_channels; 89 const struct pl08x_channel_data *slave_channels;
230 unsigned int num_slave_channels; 90 unsigned int num_slave_channels;
231 struct pl08x_channel_data memcpy_channel; 91 struct pl08x_channel_data memcpy_channel;
232 int (*get_signal)(struct pl08x_dma_chan *); 92 int (*get_signal)(const struct pl08x_channel_data *);
233 void (*put_signal)(struct pl08x_dma_chan *); 93 void (*put_signal)(const struct pl08x_channel_data *, int);
234 u8 lli_buses; 94 u8 lli_buses;
235 u8 mem_buses; 95 u8 mem_buses;
236}; 96};