aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/mv_xor.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/mv_xor.h')
-rw-r--r--drivers/dma/mv_xor.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h
index c619359cb7fe..06b067f24c9b 100644
--- a/drivers/dma/mv_xor.h
+++ b/drivers/dma/mv_xor.h
@@ -29,8 +29,10 @@
29#define MV_XOR_THRESHOLD 1 29#define MV_XOR_THRESHOLD 1
30#define MV_XOR_MAX_CHANNELS 2 30#define MV_XOR_MAX_CHANNELS 2
31 31
32/* Values for the XOR_CONFIG register */
32#define XOR_OPERATION_MODE_XOR 0 33#define XOR_OPERATION_MODE_XOR 0
33#define XOR_OPERATION_MODE_MEMCPY 2 34#define XOR_OPERATION_MODE_MEMCPY 2
35#define XOR_DESCRIPTOR_SWAP BIT(14)
34 36
35#define XOR_CURR_DESC(chan) (chan->mmr_base + 0x210 + (chan->idx * 4)) 37#define XOR_CURR_DESC(chan) (chan->mmr_base + 0x210 + (chan->idx * 4))
36#define XOR_NEXT_DESC(chan) (chan->mmr_base + 0x200 + (chan->idx * 4)) 38#define XOR_NEXT_DESC(chan) (chan->mmr_base + 0x200 + (chan->idx * 4))
@@ -143,7 +145,16 @@ struct mv_xor_desc_slot {
143#endif 145#endif
144}; 146};
145 147
146/* This structure describes XOR descriptor size 64bytes */ 148/*
149 * This structure describes XOR descriptor size 64bytes. The
150 * mv_phy_src_idx() macro must be used when indexing the values of the
151 * phy_src_addr[] array. This is due to the fact that the 'descriptor
152 * swap' feature, used on big endian systems, swaps descriptors data
153 * within blocks of 8 bytes. So two consecutive values of the
154 * phy_src_addr[] array are actually swapped in big-endian, which
155 * explains the different mv_phy_src_idx() implementation.
156 */
157#if defined(__LITTLE_ENDIAN)
147struct mv_xor_desc { 158struct mv_xor_desc {
148 u32 status; /* descriptor execution status */ 159 u32 status; /* descriptor execution status */
149 u32 crc32_result; /* result of CRC-32 calculation */ 160 u32 crc32_result; /* result of CRC-32 calculation */
@@ -155,6 +166,21 @@ struct mv_xor_desc {
155 u32 reserved0; 166 u32 reserved0;
156 u32 reserved1; 167 u32 reserved1;
157}; 168};
169#define mv_phy_src_idx(src_idx) (src_idx)
170#else
171struct mv_xor_desc {
172 u32 crc32_result; /* result of CRC-32 calculation */
173 u32 status; /* descriptor execution status */
174 u32 phy_next_desc; /* next descriptor address pointer */
175 u32 desc_command; /* type of operation to be carried out */
176 u32 phy_dest_addr; /* destination block address */
177 u32 byte_count; /* size of src/dst blocks in bytes */
178 u32 phy_src_addr[8]; /* source block addresses */
179 u32 reserved1;
180 u32 reserved0;
181};
182#define mv_phy_src_idx(src_idx) (src_idx ^ 1)
183#endif
158 184
159#define to_mv_sw_desc(addr_hw_desc) \ 185#define to_mv_sw_desc(addr_hw_desc) \
160 container_of(addr_hw_desc, struct mv_xor_desc_slot, hw_desc) 186 container_of(addr_hw_desc, struct mv_xor_desc_slot, hw_desc)