0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _PPC440SPE_ADMA_H
0009 #define _PPC440SPE_ADMA_H
0010
0011 #include <linux/types.h>
0012 #include "dma.h"
0013 #include "xor.h"
0014
0015 #define to_ppc440spe_adma_chan(chan) \
0016 container_of(chan, struct ppc440spe_adma_chan, common)
0017 #define to_ppc440spe_adma_device(dev) \
0018 container_of(dev, struct ppc440spe_adma_device, common)
0019 #define tx_to_ppc440spe_adma_slot(tx) \
0020 container_of(tx, struct ppc440spe_adma_desc_slot, async_tx)
0021
0022
0023 #define PPC440SPE_DEFAULT_POLY 0x4d
0024
0025 #define PPC440SPE_ADMA_ENGINES_NUM (XOR_ENGINES_NUM + DMA_ENGINES_NUM)
0026
0027 #define PPC440SPE_ADMA_WATCHDOG_MSEC 3
0028 #define PPC440SPE_ADMA_THRESHOLD 1
0029
0030 #define PPC440SPE_DMA0_ID 0
0031 #define PPC440SPE_DMA1_ID 1
0032 #define PPC440SPE_XOR_ID 2
0033
0034 #define PPC440SPE_ADMA_DMA_MAX_BYTE_COUNT 0xFFFFFFUL
0035
0036 #define PPC440SPE_ADMA_XOR_MAX_BYTE_COUNT (1 << 31)
0037 #define PPC440SPE_ADMA_ZERO_SUM_MAX_BYTE_COUNT PPC440SPE_ADMA_XOR_MAX_BYTE_COUNT
0038
0039 #define PPC440SPE_RXOR_RUN 0
0040
0041 #define MQ0_CF2H_RXOR_BS_MASK 0x1FF
0042
0043 #undef ADMA_LL_DEBUG
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 struct ppc440spe_adma_device {
0060 struct device *dev;
0061 struct dma_regs __iomem *dma_reg;
0062 struct xor_regs __iomem *xor_reg;
0063 struct i2o_regs __iomem *i2o_reg;
0064 int id;
0065 void *dma_desc_pool_virt;
0066 dma_addr_t dma_desc_pool;
0067 size_t pool_size;
0068 int irq;
0069 int err_irq;
0070 struct dma_device common;
0071 };
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 struct ppc440spe_adma_chan {
0091 spinlock_t lock;
0092 struct ppc440spe_adma_device *device;
0093 struct list_head chain;
0094 struct dma_chan common;
0095 struct list_head all_slots;
0096 struct ppc440spe_adma_desc_slot *last_used;
0097 int pending;
0098 int slots_allocated;
0099 int hw_chain_inited;
0100 struct tasklet_struct irq_tasklet;
0101 u8 needs_unmap;
0102 struct page *pdest_page;
0103 struct page *qdest_page;
0104 dma_addr_t pdest;
0105 dma_addr_t qdest;
0106 };
0107
0108 struct ppc440spe_rxor {
0109 u32 addrl;
0110 u32 addrh;
0111 int len;
0112 int xor_count;
0113 int addr_count;
0114 int desc_count;
0115 int state;
0116 };
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 struct ppc440spe_adma_desc_slot {
0144 dma_addr_t phys;
0145 struct ppc440spe_adma_desc_slot *group_head;
0146 struct ppc440spe_adma_desc_slot *hw_next;
0147 struct dma_async_tx_descriptor async_tx;
0148 struct list_head slot_node;
0149 struct list_head chain_node;
0150 struct list_head group_list;
0151 unsigned int unmap_len;
0152 void *hw_desc;
0153 u16 stride;
0154 u16 idx;
0155 u16 slot_cnt;
0156 u8 src_cnt;
0157 u8 dst_cnt;
0158 u8 slots_per_op;
0159 u8 descs_per_op;
0160 unsigned long flags;
0161 unsigned long reverse_flags[8];
0162
0163 #define PPC440SPE_DESC_INT 0
0164 #define PPC440SPE_ZERO_P 1
0165 #define PPC440SPE_ZERO_Q 2
0166 #define PPC440SPE_COHERENT 3
0167
0168 #define PPC440SPE_DESC_WXOR 4
0169 #define PPC440SPE_DESC_RXOR 5
0170
0171 #define PPC440SPE_DESC_RXOR123 8
0172 #define PPC440SPE_DESC_RXOR124 9
0173 #define PPC440SPE_DESC_RXOR125 10
0174 #define PPC440SPE_DESC_RXOR12 11
0175 #define PPC440SPE_DESC_RXOR_REV 12
0176
0177 #define PPC440SPE_DESC_PCHECK 13
0178 #define PPC440SPE_DESC_QCHECK 14
0179
0180 #define PPC440SPE_DESC_RXOR_MSK 0x3
0181
0182 struct ppc440spe_rxor rxor_cursor;
0183
0184 union {
0185 u32 *xor_check_result;
0186 u32 *crc32_result;
0187 };
0188 };
0189
0190 #endif