aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-05-16 05:48:44 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-07-01 09:15:40 -0400
commitb23f204c8dbbed8e501442c47d7639aac21a3d84 (patch)
treec048d3475fa98eb03552ab1bfa6964b4c4c7e00f
parenta8fb688e1d0cfffe715ada2d1af33af82b647922 (diff)
dmaengine: PL08x: move private data structures into amba-pl08x.c
Move the driver private data structures into the driver itself, rather than having them exposed to everyone in a header file. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/dma/amba-pl08x.c136
-rw-r--r--include/linux/amba/pl08x.h141
2 files changed, 138 insertions, 139 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index cc08c8c01a9e..94949909e4e9 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -90,6 +90,7 @@
90#define DRIVER_NAME "pl08xdmac" 90#define DRIVER_NAME "pl08xdmac"
91 91
92static struct amba_driver pl08x_amba_driver; 92static struct amba_driver pl08x_amba_driver;
93struct pl08x_driver_data;
93 94
94/** 95/**
95 * struct vendor_data - vendor-specific config parameters for PL08x derivatives 96 * struct vendor_data - vendor-specific config parameters for PL08x derivatives
@@ -119,6 +120,141 @@ struct pl08x_lli {
119}; 120};
120 121
121/** 122/**
123 * struct pl08x_bus_data - information of source or destination
124 * busses for a transfer
125 * @addr: current address
126 * @maxwidth: the maximum width of a transfer on this bus
127 * @buswidth: the width of this bus in bytes: 1, 2 or 4
128 */
129struct pl08x_bus_data {
130 dma_addr_t addr;
131 u8 maxwidth;
132 u8 buswidth;
133};
134
135/**
136 * struct pl08x_phy_chan - holder for the physical channels
137 * @id: physical index to this channel
138 * @lock: a lock to use when altering an instance of this struct
139 * @signal: the physical signal (aka channel) serving this physical channel
140 * right now
141 * @serving: the virtual channel currently being served by this physical
142 * channel
143 */
144struct pl08x_phy_chan {
145 unsigned int id;
146 void __iomem *base;
147 spinlock_t lock;
148 int signal;
149 struct pl08x_dma_chan *serving;
150};
151
152/**
153 * struct pl08x_sg - structure containing data per sg
154 * @src_addr: src address of sg
155 * @dst_addr: dst address of sg
156 * @len: transfer len in bytes
157 * @node: node for txd's dsg_list
158 */
159struct pl08x_sg {
160 dma_addr_t src_addr;
161 dma_addr_t dst_addr;
162 size_t len;
163 struct list_head node;
164};
165
166/**
167 * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
168 * @tx: async tx descriptor
169 * @node: node for txd list for channels
170 * @dsg_list: list of children sg's
171 * @direction: direction of transfer
172 * @llis_bus: DMA memory address (physical) start for the LLIs
173 * @llis_va: virtual memory address start for the LLIs
174 * @cctl: control reg values for current txd
175 * @ccfg: config reg values for current txd
176 */
177struct pl08x_txd {
178 struct dma_async_tx_descriptor tx;
179 struct list_head node;
180 struct list_head dsg_list;
181 enum dma_transfer_direction direction;
182 dma_addr_t llis_bus;
183 struct pl08x_lli *llis_va;
184 /* Default cctl value for LLIs */
185 u32 cctl;
186 /*
187 * Settings to be put into the physical channel when we
188 * trigger this txd. Other registers are in llis_va[0].
189 */
190 u32 ccfg;
191};
192
193/**
194 * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
195 * states
196 * @PL08X_CHAN_IDLE: the channel is idle
197 * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
198 * channel and is running a transfer on it
199 * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
200 * channel, but the transfer is currently paused
201 * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
202 * channel to become available (only pertains to memcpy channels)
203 */
204enum pl08x_dma_chan_state {
205 PL08X_CHAN_IDLE,
206 PL08X_CHAN_RUNNING,
207 PL08X_CHAN_PAUSED,
208 PL08X_CHAN_WAITING,
209};
210
211/**
212 * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
213 * @chan: wrappped abstract channel
214 * @phychan: the physical channel utilized by this channel, if there is one
215 * @phychan_hold: if non-zero, hold on to the physical channel even if we
216 * have no pending entries
217 * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
218 * @name: name of channel
219 * @cd: channel platform data
220 * @runtime_addr: address for RX/TX according to the runtime config
221 * @runtime_direction: current direction of this channel according to
222 * runtime config
223 * @pend_list: queued transactions pending on this channel
224 * @at: active transaction on this channel
225 * @lock: a lock for this channel data
226 * @host: a pointer to the host (internal use)
227 * @state: whether the channel is idle, paused, running etc
228 * @slave: whether this channel is a device (slave) or for memcpy
229 * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
230 * channels. Fill with 'true' if peripheral should be flow controller. Direction
231 * will be selected at Runtime.
232 * @waiting: a TX descriptor on this channel which is waiting for a physical
233 * channel to become available
234 */
235struct pl08x_dma_chan {
236 struct dma_chan chan;
237 struct pl08x_phy_chan *phychan;
238 int phychan_hold;
239 struct tasklet_struct tasklet;
240 char *name;
241 const struct pl08x_channel_data *cd;
242 dma_addr_t src_addr;
243 dma_addr_t dst_addr;
244 u32 src_cctl;
245 u32 dst_cctl;
246 enum dma_transfer_direction runtime_direction;
247 struct list_head pend_list;
248 struct pl08x_txd *at;
249 spinlock_t lock;
250 struct pl08x_driver_data *host;
251 enum pl08x_dma_chan_state state;
252 bool slave;
253 bool device_fc;
254 struct pl08x_txd *waiting;
255};
256
257/**
122 * struct pl08x_driver_data - the local state holder for the PL08x 258 * struct pl08x_driver_data - the local state holder for the PL08x
123 * @slave: slave engine for this instance 259 * @slave: slave engine for this instance
124 * @memcpy: memcpy engine for this instance 260 * @memcpy: memcpy engine for this instance
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 88765a62c8f2..48d02bf66ec9 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 {
@@ -68,144 +69,6 @@ struct pl08x_channel_data {
68}; 69};
69 70
70/** 71/**
71 * Struct pl08x_bus_data - information of source or destination
72 * busses for a transfer
73 * @addr: current address
74 * @maxwidth: the maximum width of a transfer on this bus
75 * @buswidth: the width of this bus in bytes: 1, 2 or 4
76 */
77struct pl08x_bus_data {
78 dma_addr_t addr;
79 u8 maxwidth;
80 u8 buswidth;
81};
82
83/**
84 * struct pl08x_phy_chan - holder for the physical channels
85 * @id: physical index to this channel
86 * @lock: a lock to use when altering an instance of this struct
87 * @signal: the physical signal (aka channel) serving this physical channel
88 * right now
89 * @serving: the virtual channel currently being served by this physical
90 * channel
91 * @locked: channel unavailable for the system, e.g. dedicated to secure
92 * world
93 */
94struct pl08x_phy_chan {
95 unsigned int id;
96 void __iomem *base;
97 spinlock_t lock;
98 int signal;
99 struct pl08x_dma_chan *serving;
100 bool locked;
101};
102
103/**
104 * struct pl08x_sg - structure containing data per sg
105 * @src_addr: src address of sg
106 * @dst_addr: dst address of sg
107 * @len: transfer len in bytes
108 * @node: node for txd's dsg_list
109 */
110struct pl08x_sg {
111 dma_addr_t src_addr;
112 dma_addr_t dst_addr;
113 size_t len;
114 struct list_head node;
115};
116
117/**
118 * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
119 * @tx: async tx descriptor
120 * @node: node for txd list for channels
121 * @dsg_list: list of children sg's
122 * @direction: direction of transfer
123 * @llis_bus: DMA memory address (physical) start for the LLIs
124 * @llis_va: virtual memory address start for the LLIs
125 * @cctl: control reg values for current txd
126 * @ccfg: config reg values for current txd
127 */
128struct pl08x_txd {
129 struct dma_async_tx_descriptor tx;
130 struct list_head node;
131 struct list_head dsg_list;
132 enum dma_transfer_direction direction;
133 dma_addr_t llis_bus;
134 struct pl08x_lli *llis_va;
135 /* Default cctl value for LLIs */
136 u32 cctl;
137 /*
138 * Settings to be put into the physical channel when we
139 * trigger this txd. Other registers are in llis_va[0].
140 */
141 u32 ccfg;
142};
143
144/**
145 * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
146 * states
147 * @PL08X_CHAN_IDLE: the channel is idle
148 * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
149 * channel and is running a transfer on it
150 * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
151 * channel, but the transfer is currently paused
152 * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
153 * channel to become available (only pertains to memcpy channels)
154 */
155enum pl08x_dma_chan_state {
156 PL08X_CHAN_IDLE,
157 PL08X_CHAN_RUNNING,
158 PL08X_CHAN_PAUSED,
159 PL08X_CHAN_WAITING,
160};
161
162/**
163 * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
164 * @chan: wrappped abstract channel
165 * @phychan: the physical channel utilized by this channel, if there is one
166 * @phychan_hold: if non-zero, hold on to the physical channel even if we
167 * have no pending entries
168 * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
169 * @name: name of channel
170 * @cd: channel platform data
171 * @runtime_addr: address for RX/TX according to the runtime config
172 * @runtime_direction: current direction of this channel according to
173 * runtime config
174 * @pend_list: queued transactions pending on this channel
175 * @at: active transaction on this channel
176 * @lock: a lock for this channel data
177 * @host: a pointer to the host (internal use)
178 * @state: whether the channel is idle, paused, running etc
179 * @slave: whether this channel is a device (slave) or for memcpy
180 * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
181 * channels. Fill with 'true' if peripheral should be flow controller. Direction
182 * will be selected at Runtime.
183 * @waiting: a TX descriptor on this channel which is waiting for a physical
184 * channel to become available
185 */
186struct pl08x_dma_chan {
187 struct dma_chan chan;
188 struct pl08x_phy_chan *phychan;
189 int phychan_hold;
190 struct tasklet_struct tasklet;
191 char *name;
192 const struct pl08x_channel_data *cd;
193 dma_addr_t src_addr;
194 dma_addr_t dst_addr;
195 u32 src_cctl;
196 u32 dst_cctl;
197 enum dma_transfer_direction runtime_direction;
198 struct list_head pend_list;
199 struct pl08x_txd *at;
200 spinlock_t lock;
201 struct pl08x_driver_data *host;
202 enum pl08x_dma_chan_state state;
203 bool slave;
204 bool device_fc;
205 struct pl08x_txd *waiting;
206};
207
208/**
209 * struct pl08x_platform_data - the platform configuration for the PL08x 72 * struct pl08x_platform_data - the platform configuration for the PL08x
210 * PrimeCells. 73 * PrimeCells.
211 * @slave_channels: the channels defined for the different devices on the 74 * @slave_channels: the channels defined for the different devices on the