Lines Matching full:sg

139 	struct axi_dmac_sg sg[] __counted_by(num_sgs);
232 struct axi_dmac_sg *sg; in axi_dmac_start_transfer() local
251 sg = &desc->sg[desc->num_submitted]; in axi_dmac_start_transfer()
254 if (sg->hw->id != AXI_DMAC_SG_UNUSED) { in axi_dmac_start_transfer()
255 sg->schedule_when_free = true; in axi_dmac_start_transfer()
272 sg->hw->id = axi_dmac_read(dmac, AXI_DMAC_REG_TRANSFER_ID); in axi_dmac_start_transfer()
276 axi_dmac_write(dmac, AXI_DMAC_REG_DEST_ADDRESS, sg->hw->dest_addr); in axi_dmac_start_transfer()
277 axi_dmac_write(dmac, AXI_DMAC_REG_DEST_STRIDE, sg->hw->dst_stride); in axi_dmac_start_transfer()
281 axi_dmac_write(dmac, AXI_DMAC_REG_SRC_ADDRESS, sg->hw->src_addr); in axi_dmac_start_transfer()
282 axi_dmac_write(dmac, AXI_DMAC_REG_SRC_STRIDE, sg->hw->src_stride); in axi_dmac_start_transfer()
292 desc->sg[desc->num_sgs - 1].hw->flags &= ~AXI_DMAC_HW_FLAG_IRQ; in axi_dmac_start_transfer()
301 axi_dmac_write(dmac, AXI_DMAC_REG_SG_ADDRESS, (u32)sg->hw_phys); in axi_dmac_start_transfer()
303 (u64)sg->hw_phys >> 32); in axi_dmac_start_transfer()
305 axi_dmac_write(dmac, AXI_DMAC_REG_X_LENGTH, sg->hw->x_len); in axi_dmac_start_transfer()
306 axi_dmac_write(dmac, AXI_DMAC_REG_Y_LENGTH, sg->hw->y_len); in axi_dmac_start_transfer()
319 struct axi_dmac_sg *sg) in axi_dmac_total_sg_bytes() argument
322 return (sg->hw->x_len + 1) * (sg->hw->y_len + 1); in axi_dmac_total_sg_bytes()
324 return (sg->hw->x_len + 1); in axi_dmac_total_sg_bytes()
331 struct axi_dmac_sg *sg; in axi_dmac_dequeue_partial_xfers() local
342 sg = &desc->sg[i]; in axi_dmac_dequeue_partial_xfers()
343 if (sg->hw->id == AXI_DMAC_SG_UNUSED) in axi_dmac_dequeue_partial_xfers()
345 if (sg->hw->id == id) { in axi_dmac_dequeue_partial_xfers()
347 sg->partial_len = len; in axi_dmac_dequeue_partial_xfers()
378 struct axi_dmac_sg *sg; in axi_dmac_compute_residue() local
392 sg = &active->sg[i]; in axi_dmac_compute_residue()
393 total = axi_dmac_total_sg_bytes(chan, sg); in axi_dmac_compute_residue()
394 rslt->residue += (total - sg->partial_len); in axi_dmac_compute_residue()
402 struct axi_dmac_sg *sg; in axi_dmac_transfer_done() local
424 sg = &active->sg[active->num_completed]; in axi_dmac_transfer_done()
425 if (sg->hw->id == AXI_DMAC_SG_UNUSED) /* Not yet submitted */ in axi_dmac_transfer_done()
427 if (!(BIT(sg->hw->id) & completed_transfers)) in axi_dmac_transfer_done()
430 sg->hw->id = AXI_DMAC_SG_UNUSED; in axi_dmac_transfer_done()
431 if (sg->schedule_when_free) { in axi_dmac_transfer_done()
432 sg->schedule_when_free = false; in axi_dmac_transfer_done()
436 if (sg->partial_len) in axi_dmac_transfer_done()
443 sg->partial_len) { in axi_dmac_transfer_done()
540 desc = kzalloc(struct_size(desc, sg, num_sgs), GFP_NOWAIT); in axi_dmac_alloc_desc()
554 desc->sg[i].hw = &hws[i]; in axi_dmac_alloc_desc()
555 desc->sg[i].hw_phys = hw_phys + i * sizeof(*hws); in axi_dmac_alloc_desc()
565 desc->sg[num_sgs - 1].hw->flags = AXI_DMAC_HW_FLAG_LAST | AXI_DMAC_HW_FLAG_IRQ; in axi_dmac_alloc_desc()
574 struct axi_dmac_hw_desc *hw = desc->sg[0].hw; in axi_dmac_free_desc()
575 dma_addr_t hw_phys = desc->sg[0].hw_phys; in axi_dmac_free_desc()
585 struct axi_dmac_sg *sg) in axi_dmac_fill_linear_sg() argument
598 for (len = period_len; len > segment_size; sg++) { in axi_dmac_fill_linear_sg()
600 sg->hw->dest_addr = addr; in axi_dmac_fill_linear_sg()
602 sg->hw->src_addr = addr; in axi_dmac_fill_linear_sg()
603 sg->hw->x_len = segment_size - 1; in axi_dmac_fill_linear_sg()
604 sg->hw->y_len = 0; in axi_dmac_fill_linear_sg()
605 sg->hw->flags = 0; in axi_dmac_fill_linear_sg()
611 sg->hw->dest_addr = addr; in axi_dmac_fill_linear_sg()
613 sg->hw->src_addr = addr; in axi_dmac_fill_linear_sg()
614 sg->hw->x_len = len - 1; in axi_dmac_fill_linear_sg()
615 sg->hw->y_len = 0; in axi_dmac_fill_linear_sg()
616 sg++; in axi_dmac_fill_linear_sg()
620 return sg; in axi_dmac_fill_linear_sg()
644 dsg = desc->sg; in axi_dmac_prep_peripheral_dma_vec()
670 struct scatterlist *sg; in axi_dmac_prep_slave_sg() local
678 for_each_sg(sgl, sg, sg_len, i) in axi_dmac_prep_slave_sg()
679 num_sgs += DIV_ROUND_UP(sg_dma_len(sg), chan->max_length); in axi_dmac_prep_slave_sg()
685 dsg = desc->sg; in axi_dmac_prep_slave_sg()
687 for_each_sg(sgl, sg, sg_len, i) { in axi_dmac_prep_slave_sg()
688 if (!axi_dmac_check_addr(chan, sg_dma_address(sg)) || in axi_dmac_prep_slave_sg()
689 !axi_dmac_check_len(chan, sg_dma_len(sg))) { in axi_dmac_prep_slave_sg()
694 dsg = axi_dmac_fill_linear_sg(chan, direction, sg_dma_address(sg), 1, in axi_dmac_prep_slave_sg()
695 sg_dma_len(sg), dsg); in axi_dmac_prep_slave_sg()
731 desc->sg[num_sgs - 1].hw->next_sg_addr = desc->sg[0].hw_phys; in axi_dmac_prep_dma_cyclic()
732 desc->sg[num_sgs - 1].hw->flags &= ~AXI_DMAC_HW_FLAG_LAST; in axi_dmac_prep_dma_cyclic()
735 period_len, desc->sg); in axi_dmac_prep_dma_cyclic()
790 desc->sg[0].hw->src_addr = xt->src_start; in axi_dmac_prep_interleaved()
791 desc->sg[0].hw->src_stride = xt->sgl[0].size + src_icg; in axi_dmac_prep_interleaved()
795 desc->sg[0].hw->dest_addr = xt->dst_start; in axi_dmac_prep_interleaved()
796 desc->sg[0].hw->dst_stride = xt->sgl[0].size + dst_icg; in axi_dmac_prep_interleaved()
800 desc->sg[0].hw->x_len = xt->sgl[0].size - 1; in axi_dmac_prep_interleaved()
801 desc->sg[0].hw->y_len = xt->numf - 1; in axi_dmac_prep_interleaved()
803 desc->sg[0].hw->x_len = xt->sgl[0].size * xt->numf - 1; in axi_dmac_prep_interleaved()
804 desc->sg[0].hw->y_len = 0; in axi_dmac_prep_interleaved()