20 #include <linux/types.h>
22 #include <mach/hardware.h>
25 #define ADMA_ACCR(chan) (chan->mmr_base + 0x0)
26 #define ADMA_ACSR(chan) (chan->mmr_base + 0x4)
27 #define ADMA_ADAR(chan) (chan->mmr_base + 0x8)
28 #define ADMA_IIPCR(chan) (chan->mmr_base + 0x18)
29 #define ADMA_IIPAR(chan) (chan->mmr_base + 0x1c)
30 #define ADMA_IIPUAR(chan) (chan->mmr_base + 0x20)
31 #define ADMA_ANDAR(chan) (chan->mmr_base + 0x24)
32 #define ADMA_ADCR(chan) (chan->mmr_base + 0x28)
33 #define ADMA_CARMD(chan) (chan->mmr_base + 0x2c)
34 #define ADMA_ABCR(chan) (chan->mmr_base + 0x30)
35 #define ADMA_DLADR(chan) (chan->mmr_base + 0x34)
36 #define ADMA_DUADR(chan) (chan->mmr_base + 0x38)
37 #define ADMA_SLAR(src, chan) (chan->mmr_base + (0x3c + (src << 3)))
38 #define ADMA_SUAR(src, chan) (chan->mmr_base + (0x40 + (src << 3)))
148 static inline int iop_adma_get_max_xor(
void)
153 #define iop_adma_get_max_pq iop_adma_get_max_xor
166 #define ADMA_STATUS_BUSY (1 << 13)
168 static inline char iop_chan_is_busy(
struct iop_adma_chan *chan)
182 #define iop_desc_is_aligned(x, y) 1
185 iop_chan_memcpy_slot_count(
size_t len,
int *slots_per_op)
191 #define iop_chan_interrupt_slot_count(s, c) iop_chan_memcpy_slot_count(0, s)
194 iop_chan_memset_slot_count(
size_t len,
int *slots_per_op)
201 iop_chan_xor_slot_count(
size_t len,
int src_cnt,
int *slots_per_op)
203 static const char slot_count_table[] = { 1, 2, 2, 2,
208 *slots_per_op = slot_count_table[src_cnt - 1];
209 return *slots_per_op;
212 #define ADMA_MAX_BYTE_COUNT (16 * 1024 * 1024)
213 #define IOP_ADMA_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
214 #define IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
215 #define IOP_ADMA_XOR_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
216 #define IOP_ADMA_PQ_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
217 #define iop_chan_zero_sum_slot_count(l, s, o) iop_chan_xor_slot_count(l, s, o)
218 #define iop_chan_pq_slot_count iop_chan_xor_slot_count
219 #define iop_chan_pq_zero_sum_slot_count iop_chan_xor_slot_count
247 return hw_desc->
src[src_idx].src_addr;
266 u_desc_ctrl.value = 0;
267 u_desc_ctrl.field.xfer_dir = 3;
282 u_desc_ctrl.value = 0;
283 u_desc_ctrl.field.xfer_dir = 3;
284 u_desc_ctrl.field.block_fill_en = 1;
301 u_desc_ctrl.value = 0;
302 u_desc_ctrl.field.src_select = src_cnt - 1;
303 u_desc_ctrl.field.xfer_dir = 3;
309 #define iop_desc_init_null_xor(d, s, i) iop_desc_init_xor(d, s, i)
322 u_desc_ctrl.value = 0;
324 u_desc_ctrl.field.xfer_dir = 3;
325 u_desc_ctrl.field.zero_result = 1;
326 u_desc_ctrl.field.status_write_back_en = 1;
344 u_desc_ctrl.value = 0;
345 u_desc_ctrl.field.src_select = src_cnt - 1;
346 u_desc_ctrl.field.xfer_dir = 3;
347 u_desc_ctrl.field.pq_xfer_en = 1;
362 return u_desc_ctrl.field.pq_xfer_en;
375 u_desc_ctrl.value = 0;
376 u_desc_ctrl.field.src_select = src_cnt - 1;
377 u_desc_ctrl.field.xfer_dir = 3;
378 u_desc_ctrl.field.zero_result = 1;
379 u_desc_ctrl.field.status_write_back_en = 1;
380 u_desc_ctrl.field.pq_xfer_en = 1;
413 iter->byte_count = len;
418 #define iop_desc_set_pq_zero_sum_byte_count iop_desc_set_zero_sum_byte_count
443 hw_desc->
src[0].src_addr =
addr;
444 hw_desc->
src[0].upper_src_addr = 0;
456 iter->src[src_idx].src_addr =
addr;
457 iter->src[src_idx].upper_src_addr = 0;
458 slot_cnt -= slots_per_op;
477 src = &iter->src[src_idx];
481 slot_cnt -= slots_per_op;
493 iop_desc_init_memcpy(desc, 1);
494 iop_desc_set_byte_count(desc, chan, 0);
495 iop_desc_set_dest_addr(desc, chan, 0);
496 iop_desc_set_memcpy_src_addr(desc, 0);
499 #define iop_desc_set_zero_sum_src_addr iop_desc_set_xor_src_addr
500 #define iop_desc_set_pq_zero_sum_src_addr iop_desc_set_pq_src_addr
506 iop_desc_set_xor_src_addr(desc, pq_idx, src[pq_idx]);
507 iop_desc_set_xor_src_addr(desc, pq_idx+1, src[pq_idx+1]);
554 static inline void iop_chan_append(
struct iop_adma_chan *chan)
568 static inline void iop_chan_disable(
struct iop_adma_chan *chan)
571 adma_chan_ctrl &= ~0x1;
575 static inline void iop_chan_enable(
struct iop_adma_chan *chan)
580 adma_chan_ctrl |= 0x1;
584 static inline void iop_adma_device_clear_eot_status(
struct iop_adma_chan *chan)
591 static inline void iop_adma_device_clear_eoc_status(
struct iop_adma_chan *chan)
598 static inline void iop_adma_device_clear_err_status(
struct iop_adma_chan *chan)
601 status &= (1 << 9) | (1 << 5) | (1 << 4) | (1 << 3);
606 iop_is_err_int_parity(
unsigned long status,
struct iop_adma_chan *chan)
612 iop_is_err_mcu_abort(
unsigned long status,
struct iop_adma_chan *chan)
618 iop_is_err_int_tabort(
unsigned long status,
struct iop_adma_chan *chan)
624 iop_is_err_int_mabort(
unsigned long status,
struct iop_adma_chan *chan)
630 iop_is_err_pci_tabort(
unsigned long status,
struct iop_adma_chan *chan)
636 iop_is_err_pci_mabort(
unsigned long status,
struct iop_adma_chan *chan)
642 iop_is_err_split_tx(
unsigned long status,
struct iop_adma_chan *chan)