aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dw/regs.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/dw/regs.h')
-rw-r--r--drivers/dma/dw/regs.h56
1 files changed, 36 insertions, 20 deletions
diff --git a/drivers/dma/dw/regs.h b/drivers/dma/dw/regs.h
index 0a50c18d85b8..4b7bd7834046 100644
--- a/drivers/dma/dw/regs.h
+++ b/drivers/dma/dw/regs.h
@@ -114,10 +114,6 @@ struct dw_dma_regs {
114#define dma_writel_native writel 114#define dma_writel_native writel
115#endif 115#endif
116 116
117/* To access the registers in early stage of probe */
118#define dma_read_byaddr(addr, name) \
119 dma_readl_native((addr) + offsetof(struct dw_dma_regs, name))
120
121/* Bitfields in DW_PARAMS */ 117/* Bitfields in DW_PARAMS */
122#define DW_PARAMS_NR_CHAN 8 /* number of channels */ 118#define DW_PARAMS_NR_CHAN 8 /* number of channels */
123#define DW_PARAMS_NR_MASTER 11 /* number of AHB masters */ 119#define DW_PARAMS_NR_MASTER 11 /* number of AHB masters */
@@ -143,6 +139,10 @@ enum dw_dma_msize {
143 DW_DMA_MSIZE_256, 139 DW_DMA_MSIZE_256,
144}; 140};
145 141
142/* Bitfields in LLP */
143#define DWC_LLP_LMS(x) ((x) & 3) /* list master select */
144#define DWC_LLP_LOC(x) ((x) & ~3) /* next lli */
145
146/* Bitfields in CTL_LO */ 146/* Bitfields in CTL_LO */
147#define DWC_CTLL_INT_EN (1 << 0) /* irqs enabled? */ 147#define DWC_CTLL_INT_EN (1 << 0) /* irqs enabled? */
148#define DWC_CTLL_DST_WIDTH(n) ((n)<<1) /* bytes per element */ 148#define DWC_CTLL_DST_WIDTH(n) ((n)<<1) /* bytes per element */
@@ -216,6 +216,8 @@ enum dw_dma_msize {
216enum dw_dmac_flags { 216enum dw_dmac_flags {
217 DW_DMA_IS_CYCLIC = 0, 217 DW_DMA_IS_CYCLIC = 0,
218 DW_DMA_IS_SOFT_LLP = 1, 218 DW_DMA_IS_SOFT_LLP = 1,
219 DW_DMA_IS_PAUSED = 2,
220 DW_DMA_IS_INITIALIZED = 3,
219}; 221};
220 222
221struct dw_dma_chan { 223struct dw_dma_chan {
@@ -224,8 +226,6 @@ struct dw_dma_chan {
224 u8 mask; 226 u8 mask;
225 u8 priority; 227 u8 priority;
226 enum dma_transfer_direction direction; 228 enum dma_transfer_direction direction;
227 bool paused;
228 bool initialized;
229 229
230 /* software emulation of the LLP transfers */ 230 /* software emulation of the LLP transfers */
231 struct list_head *tx_node_active; 231 struct list_head *tx_node_active;
@@ -236,8 +236,6 @@ struct dw_dma_chan {
236 unsigned long flags; 236 unsigned long flags;
237 struct list_head active_list; 237 struct list_head active_list;
238 struct list_head queue; 238 struct list_head queue;
239 struct list_head free_list;
240 u32 residue;
241 struct dw_cyclic_desc *cdesc; 239 struct dw_cyclic_desc *cdesc;
242 240
243 unsigned int descs_allocated; 241 unsigned int descs_allocated;
@@ -249,8 +247,8 @@ struct dw_dma_chan {
249 /* custom slave configuration */ 247 /* custom slave configuration */
250 u8 src_id; 248 u8 src_id;
251 u8 dst_id; 249 u8 dst_id;
252 u8 src_master; 250 u8 m_master;
253 u8 dst_master; 251 u8 p_master;
254 252
255 /* configuration passed via .device_config */ 253 /* configuration passed via .device_config */
256 struct dma_slave_config dma_sconfig; 254 struct dma_slave_config dma_sconfig;
@@ -283,9 +281,8 @@ struct dw_dma {
283 u8 all_chan_mask; 281 u8 all_chan_mask;
284 u8 in_use; 282 u8 in_use;
285 283
286 /* hardware configuration */ 284 /* platform data */
287 unsigned char nr_masters; 285 struct dw_dma_platform_data *pdata;
288 unsigned char data_width[DW_DMA_MAX_NR_MASTERS];
289}; 286};
290 287
291static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw) 288static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
@@ -308,32 +305,51 @@ static inline struct dw_dma *to_dw_dma(struct dma_device *ddev)
308 return container_of(ddev, struct dw_dma, dma); 305 return container_of(ddev, struct dw_dma, dma);
309} 306}
310 307
308#ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
309typedef __be32 __dw32;
310#else
311typedef __le32 __dw32;
312#endif
313
311/* LLI == Linked List Item; a.k.a. DMA block descriptor */ 314/* LLI == Linked List Item; a.k.a. DMA block descriptor */
312struct dw_lli { 315struct dw_lli {
313 /* values that are not changed by hardware */ 316 /* values that are not changed by hardware */
314 u32 sar; 317 __dw32 sar;
315 u32 dar; 318 __dw32 dar;
316 u32 llp; /* chain to next lli */ 319 __dw32 llp; /* chain to next lli */
317 u32 ctllo; 320 __dw32 ctllo;
318 /* values that may get written back: */ 321 /* values that may get written back: */
319 u32 ctlhi; 322 __dw32 ctlhi;
320 /* sstat and dstat can snapshot peripheral register state. 323 /* sstat and dstat can snapshot peripheral register state.
321 * silicon config may discard either or both... 324 * silicon config may discard either or both...
322 */ 325 */
323 u32 sstat; 326 __dw32 sstat;
324 u32 dstat; 327 __dw32 dstat;
325}; 328};
326 329
327struct dw_desc { 330struct dw_desc {
328 /* FIRST values the hardware uses */ 331 /* FIRST values the hardware uses */
329 struct dw_lli lli; 332 struct dw_lli lli;
330 333
334#ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
335#define lli_set(d, reg, v) ((d)->lli.reg |= cpu_to_be32(v))
336#define lli_clear(d, reg, v) ((d)->lli.reg &= ~cpu_to_be32(v))
337#define lli_read(d, reg) be32_to_cpu((d)->lli.reg)
338#define lli_write(d, reg, v) ((d)->lli.reg = cpu_to_be32(v))
339#else
340#define lli_set(d, reg, v) ((d)->lli.reg |= cpu_to_le32(v))
341#define lli_clear(d, reg, v) ((d)->lli.reg &= ~cpu_to_le32(v))
342#define lli_read(d, reg) le32_to_cpu((d)->lli.reg)
343#define lli_write(d, reg, v) ((d)->lli.reg = cpu_to_le32(v))
344#endif
345
331 /* THEN values for driver housekeeping */ 346 /* THEN values for driver housekeeping */
332 struct list_head desc_node; 347 struct list_head desc_node;
333 struct list_head tx_list; 348 struct list_head tx_list;
334 struct dma_async_tx_descriptor txd; 349 struct dma_async_tx_descriptor txd;
335 size_t len; 350 size_t len;
336 size_t total_len; 351 size_t total_len;
352 u32 residue;
337}; 353};
338 354
339#define to_dw_desc(h) list_entry(h, struct dw_desc, desc_node) 355#define to_dw_desc(h) list_entry(h, struct dw_desc, desc_node)