|
@@ -481,3 +481,167 @@ iop_desc_set_pq_src_addr(struct iop_adma_desc_slot *desc, int src_idx,
|
|
|
slot_cnt -= slots_per_op;
|
|
|
if (slot_cnt) {
|
|
|
i += slots_per_op;
|
|
|
+ addr += IOP_ADMA_PQ_MAX_BYTE_COUNT;
|
|
|
+ }
|
|
|
+ } while (slot_cnt);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void
|
|
|
+iop_desc_init_interrupt(struct iop_adma_desc_slot *desc,
|
|
|
+ struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ iop_desc_init_memcpy(desc, 1);
|
|
|
+ iop_desc_set_byte_count(desc, chan, 0);
|
|
|
+ iop_desc_set_dest_addr(desc, chan, 0);
|
|
|
+ iop_desc_set_memcpy_src_addr(desc, 0);
|
|
|
+}
|
|
|
+
|
|
|
+#define iop_desc_set_zero_sum_src_addr iop_desc_set_xor_src_addr
|
|
|
+#define iop_desc_set_pq_zero_sum_src_addr iop_desc_set_pq_src_addr
|
|
|
+
|
|
|
+static inline void
|
|
|
+iop_desc_set_pq_zero_sum_addr(struct iop_adma_desc_slot *desc, int pq_idx,
|
|
|
+ dma_addr_t *src)
|
|
|
+{
|
|
|
+ iop_desc_set_xor_src_addr(desc, pq_idx, src[pq_idx]);
|
|
|
+ iop_desc_set_xor_src_addr(desc, pq_idx+1, src[pq_idx+1]);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_desc_set_next_desc(struct iop_adma_desc_slot *desc,
|
|
|
+ u32 next_desc_addr)
|
|
|
+{
|
|
|
+ struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
|
|
|
+
|
|
|
+ iop_paranoia(hw_desc->next_desc);
|
|
|
+ hw_desc->next_desc = next_desc_addr;
|
|
|
+}
|
|
|
+
|
|
|
+static inline u32 iop_desc_get_next_desc(struct iop_adma_desc_slot *desc)
|
|
|
+{
|
|
|
+ struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
|
|
|
+ return hw_desc->next_desc;
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_desc_clear_next_desc(struct iop_adma_desc_slot *desc)
|
|
|
+{
|
|
|
+ struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
|
|
|
+ hw_desc->next_desc = 0;
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
|
|
|
+ u32 val)
|
|
|
+{
|
|
|
+ struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
|
|
|
+ hw_desc->block_fill_data = val;
|
|
|
+}
|
|
|
+
|
|
|
+static inline enum sum_check_flags
|
|
|
+iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
|
|
|
+{
|
|
|
+ struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
|
|
|
+ struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
|
|
|
+ struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field;
|
|
|
+ enum sum_check_flags flags;
|
|
|
+
|
|
|
+ BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result));
|
|
|
+
|
|
|
+ flags = byte_count.zero_result_err_q << SUM_CHECK_Q;
|
|
|
+ flags |= byte_count.zero_result_err << SUM_CHECK_P;
|
|
|
+
|
|
|
+ return flags;
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_chan_append(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ u32 adma_accr;
|
|
|
+
|
|
|
+ adma_accr = __raw_readl(ADMA_ACCR(chan));
|
|
|
+ adma_accr |= 0x2;
|
|
|
+ __raw_writel(adma_accr, ADMA_ACCR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline u32 iop_chan_get_status(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return __raw_readl(ADMA_ACSR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_chan_disable(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ u32 adma_chan_ctrl = __raw_readl(ADMA_ACCR(chan));
|
|
|
+ adma_chan_ctrl &= ~0x1;
|
|
|
+ __raw_writel(adma_chan_ctrl, ADMA_ACCR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_chan_enable(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ u32 adma_chan_ctrl;
|
|
|
+
|
|
|
+ adma_chan_ctrl = __raw_readl(ADMA_ACCR(chan));
|
|
|
+ adma_chan_ctrl |= 0x1;
|
|
|
+ __raw_writel(adma_chan_ctrl, ADMA_ACCR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_adma_device_clear_eot_status(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ u32 status = __raw_readl(ADMA_ACSR(chan));
|
|
|
+ status &= (1 << 12);
|
|
|
+ __raw_writel(status, ADMA_ACSR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_adma_device_clear_eoc_status(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ u32 status = __raw_readl(ADMA_ACSR(chan));
|
|
|
+ status &= (1 << 11);
|
|
|
+ __raw_writel(status, ADMA_ACSR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline void iop_adma_device_clear_err_status(struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ u32 status = __raw_readl(ADMA_ACSR(chan));
|
|
|
+ status &= (1 << 9) | (1 << 5) | (1 << 4) | (1 << 3);
|
|
|
+ __raw_writel(status, ADMA_ACSR(chan));
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_int_parity(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return test_bit(9, &status);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_mcu_abort(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return test_bit(5, &status);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_int_tabort(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return test_bit(4, &status);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_int_mabort(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return test_bit(3, &status);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_pci_tabort(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_pci_mabort(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static inline int
|
|
|
+iop_is_err_split_tx(unsigned long status, struct iop_adma_chan *chan)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+#endif /* _ADMA_H */
|