diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2009-07-22 14:04:45 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-07-23 02:15:33 -0400 |
commit | 808347f6a31792079e345ec865e9cfcb6e8ae6b2 (patch) | |
tree | 05fe2e32712d84ec5dc7553033432712313f6ba2 /drivers/dma/at_hdmac_regs.h | |
parent | dc78baa2b90b289590911b40b6800f77d0dc935a (diff) |
dmaengine: at_hdmac: add DMA slave transfers
This patch for at_hdmac adds the slave transfers capability to the Atmel DMA
controller available on some AT91 SOCs. This allow peripheral to memory and
memory to peripheral transfers with hardware handshaking.
Slave structure for controller specific information is passed through channel
private data. This at_dma_slave structure is defined in at_hdmac.h header file
and relative hardware definition are moved to this file from at_hdmac_regs.h.
Doing this we allow the channel configuration from platform definition code.
This work is intensively based on dw_dmac and several slave implementations.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/at_hdmac_regs.h')
-rw-r--r-- | drivers/dma/at_hdmac_regs.h | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h index ad2d4f402bf7..4c972afc49ec 100644 --- a/drivers/dma/at_hdmac_regs.h +++ b/drivers/dma/at_hdmac_regs.h | |||
@@ -87,29 +87,14 @@ | |||
87 | /* Bitfields in CTRLA */ | 87 | /* Bitfields in CTRLA */ |
88 | #define ATC_BTSIZE_MAX 0xFFFFUL /* Maximum Buffer Transfer Size */ | 88 | #define ATC_BTSIZE_MAX 0xFFFFUL /* Maximum Buffer Transfer Size */ |
89 | #define ATC_BTSIZE(x) (ATC_BTSIZE_MAX & (x)) /* Buffer Transfer Size */ | 89 | #define ATC_BTSIZE(x) (ATC_BTSIZE_MAX & (x)) /* Buffer Transfer Size */ |
90 | #define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */ | 90 | /* Chunck Tranfer size definitions are in at_hdmac.h */ |
91 | #define ATC_SCSIZE_1 (0x0 << 16) | ||
92 | #define ATC_SCSIZE_4 (0x1 << 16) | ||
93 | #define ATC_SCSIZE_8 (0x2 << 16) | ||
94 | #define ATC_SCSIZE_16 (0x3 << 16) | ||
95 | #define ATC_SCSIZE_32 (0x4 << 16) | ||
96 | #define ATC_SCSIZE_64 (0x5 << 16) | ||
97 | #define ATC_SCSIZE_128 (0x6 << 16) | ||
98 | #define ATC_SCSIZE_256 (0x7 << 16) | ||
99 | #define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */ | ||
100 | #define ATC_DCSIZE_1 (0x0 << 20) | ||
101 | #define ATC_DCSIZE_4 (0x1 << 20) | ||
102 | #define ATC_DCSIZE_8 (0x2 << 20) | ||
103 | #define ATC_DCSIZE_16 (0x3 << 20) | ||
104 | #define ATC_DCSIZE_32 (0x4 << 20) | ||
105 | #define ATC_DCSIZE_64 (0x5 << 20) | ||
106 | #define ATC_DCSIZE_128 (0x6 << 20) | ||
107 | #define ATC_DCSIZE_256 (0x7 << 20) | ||
108 | #define ATC_SRC_WIDTH_MASK (0x3 << 24) /* Source Single Transfer Size */ | 91 | #define ATC_SRC_WIDTH_MASK (0x3 << 24) /* Source Single Transfer Size */ |
92 | #define ATC_SRC_WIDTH(x) ((x) << 24) | ||
109 | #define ATC_SRC_WIDTH_BYTE (0x0 << 24) | 93 | #define ATC_SRC_WIDTH_BYTE (0x0 << 24) |
110 | #define ATC_SRC_WIDTH_HALFWORD (0x1 << 24) | 94 | #define ATC_SRC_WIDTH_HALFWORD (0x1 << 24) |
111 | #define ATC_SRC_WIDTH_WORD (0x2 << 24) | 95 | #define ATC_SRC_WIDTH_WORD (0x2 << 24) |
112 | #define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */ | 96 | #define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */ |
97 | #define ATC_DST_WIDTH(x) ((x) << 28) | ||
113 | #define ATC_DST_WIDTH_BYTE (0x0 << 28) | 98 | #define ATC_DST_WIDTH_BYTE (0x0 << 28) |
114 | #define ATC_DST_WIDTH_HALFWORD (0x1 << 28) | 99 | #define ATC_DST_WIDTH_HALFWORD (0x1 << 28) |
115 | #define ATC_DST_WIDTH_WORD (0x2 << 28) | 100 | #define ATC_DST_WIDTH_WORD (0x2 << 28) |
@@ -129,7 +114,8 @@ | |||
129 | #define ATC_FC_PER2PER (0x3 << 21) /* Periph-to-Periph (DMA) */ | 114 | #define ATC_FC_PER2PER (0x3 << 21) /* Periph-to-Periph (DMA) */ |
130 | #define ATC_FC_PER2MEM_PER (0x4 << 21) /* Periph-to-Mem (Peripheral) */ | 115 | #define ATC_FC_PER2MEM_PER (0x4 << 21) /* Periph-to-Mem (Peripheral) */ |
131 | #define ATC_FC_MEM2PER_PER (0x5 << 21) /* Mem-to-Periph (Peripheral) */ | 116 | #define ATC_FC_MEM2PER_PER (0x5 << 21) /* Mem-to-Periph (Peripheral) */ |
132 | #define ATC_FC_PER2PER_PER (0x6 << 21) /* Periph-to-Periph (Src Peripheral) */ | 117 | #define ATC_FC_PER2PER_SRCPER (0x6 << 21) /* Periph-to-Periph (Src Peripheral) */ |
118 | #define ATC_FC_PER2PER_DSTPER (0x7 << 21) /* Periph-to-Periph (Dst Peripheral) */ | ||
133 | #define ATC_SRC_ADDR_MODE_MASK (0x3 << 24) | 119 | #define ATC_SRC_ADDR_MODE_MASK (0x3 << 24) |
134 | #define ATC_SRC_ADDR_MODE_INCR (0x0 << 24) /* Incrementing Mode */ | 120 | #define ATC_SRC_ADDR_MODE_INCR (0x0 << 24) /* Incrementing Mode */ |
135 | #define ATC_SRC_ADDR_MODE_DECR (0x1 << 24) /* Decrementing Mode */ | 121 | #define ATC_SRC_ADDR_MODE_DECR (0x1 << 24) /* Decrementing Mode */ |
@@ -142,27 +128,7 @@ | |||
142 | #define ATC_AUTO (0x1 << 31) /* Auto multiple buffer tx enable */ | 128 | #define ATC_AUTO (0x1 << 31) /* Auto multiple buffer tx enable */ |
143 | 129 | ||
144 | /* Bitfields in CFG */ | 130 | /* Bitfields in CFG */ |
145 | #define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */ | 131 | /* are in at_hdmac.h */ |
146 | #define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */ | ||
147 | #define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */ | ||
148 | #define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */ | ||
149 | #define ATC_SRC_H2SEL_SW (0x0 << 9) | ||
150 | #define ATC_SRC_H2SEL_HW (0x1 << 9) | ||
151 | #define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */ | ||
152 | #define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */ | ||
153 | #define ATC_DST_H2SEL_SW (0x0 << 13) | ||
154 | #define ATC_DST_H2SEL_HW (0x1 << 13) | ||
155 | #define ATC_SOD (0x1 << 16) /* Stop On Done */ | ||
156 | #define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */ | ||
157 | #define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */ | ||
158 | #define ATC_LOCK_IF_L (0x1 << 22) /* Master Interface Arbiter Lock */ | ||
159 | #define ATC_LOCK_IF_L_CHUNK (0x0 << 22) | ||
160 | #define ATC_LOCK_IF_L_BUFFER (0x1 << 22) | ||
161 | #define ATC_AHB_PROT_MASK (0x7 << 24) /* AHB Protection */ | ||
162 | #define ATC_FIFOCFG_MASK (0x3 << 28) /* FIFO Request Configuration */ | ||
163 | #define ATC_FIFOCFG_LARGESTBURST (0x0 << 28) | ||
164 | #define ATC_FIFOCFG_HALFFIFO (0x1 << 28) | ||
165 | #define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28) | ||
166 | 132 | ||
167 | /* Bitfields in SPIP */ | 133 | /* Bitfields in SPIP */ |
168 | #define ATC_SPIP_HOLE(x) (0xFFFFU & (x)) | 134 | #define ATC_SPIP_HOLE(x) (0xFFFFU & (x)) |
@@ -316,11 +282,12 @@ static void vdbg_dump_regs(struct at_dma_chan *atchan) | |||
316 | dma_readl(atdma, CHSR)); | 282 | dma_readl(atdma, CHSR)); |
317 | 283 | ||
318 | dev_err(chan2dev(&atchan->chan_common), | 284 | dev_err(chan2dev(&atchan->chan_common), |
319 | " channel: s0x%x d0x%x ctrl0x%x:0x%x l0x%x\n", | 285 | " channel: s0x%x d0x%x ctrl0x%x:0x%x cfg0x%x l0x%x\n", |
320 | channel_readl(atchan, SADDR), | 286 | channel_readl(atchan, SADDR), |
321 | channel_readl(atchan, DADDR), | 287 | channel_readl(atchan, DADDR), |
322 | channel_readl(atchan, CTRLA), | 288 | channel_readl(atchan, CTRLA), |
323 | channel_readl(atchan, CTRLB), | 289 | channel_readl(atchan, CTRLB), |
290 | channel_readl(atchan, CFG), | ||
324 | channel_readl(atchan, DSCR)); | 291 | channel_readl(atchan, DSCR)); |
325 | } | 292 | } |
326 | #else | 293 | #else |