From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars-Peter Clausen Subject: Re: [PATCH 2/2] dmaengine: Add support for the Analog Devices AXI-DMAC DMA controller Date: Wed, 19 Aug 2015 18:55:34 +0200 Message-ID: <55D4B506.9010707@metafoo.de> References: <1438076286-21164-1-git-send-email-lars@metafoo.de> <1438076286-21164-2-git-send-email-lars@metafoo.de> <20150819163203.GF13546@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20150819163203.GF13546@localhost> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Vinod Koul Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org On 08/19/2015 06:32 PM, Vinod Koul wrote: > On Tue, Jul 28, 2015 at 11:38:06AM +0200, Lars-Peter Clausen wrote: >> + active = axi_dmac_active_desc(chan); >> + if (!active) >> + return; >> + >> + if (active->cyclic) { >> + vchan_cyclic_callback(&active->vdesc); >> + } else { >> + while (active && > do you need to check this, you did that few lines back? It gets overwritten in the loop. [...] > >> +static struct dma_async_tx_descriptor *axi_dmac_prep_slave_sg( >> + struct dma_chan *c, struct scatterlist *sgl, >> + unsigned int sg_len, enum dma_transfer_direction direction, >> + unsigned long flags, void *context) >> +{ >> + struct axi_dmac_chan *chan = to_axi_dmac_chan(c); >> + struct axi_dmac_desc *desc; >> + struct scatterlist *sg; >> + unsigned int i; >> + >> + if (direction != chan->direction) > > are the channels unidirectional yes. > >> + return NULL; >> + >> + desc = axi_dmac_alloc_desc(sg_len); >> + if (!desc) >> + return NULL; >> + >> + for_each_sg(sgl, sg, sg_len, i) { >> + if (!axi_dmac_check_addr(chan, sg_dma_address(sg)) || >> + !axi_dmac_check_len(chan, sg_dma_len(sg))) { >> + kfree(desc); >> + return NULL; >> + } >> + >> + if (direction == DMA_DEV_TO_MEM) >> + desc->sg[i].dest_addr = sg_dma_address(sg); >> + else >> + desc->sg[i].src_addr = sg_dma_address(sg); > where is device side programming ? in the start_transfer() function. > >> + >> + if (axi_dmac_dest_is_mem(chan) && axi_dmac_src_is_mem(chan)) >> + chan->direction = DMA_MEM_TO_MEM; >> + else if (!axi_dmac_dest_is_mem(chan) && axi_dmac_src_is_mem(chan)) >> + chan->direction = DMA_MEM_TO_DEV; >> + else if (axi_dmac_dest_is_mem(chan) && !axi_dmac_src_is_mem(chan)) >> + chan->direction = DMA_DEV_TO_MEM; >> + else >> + chan->direction = DMA_DEV_TO_DEV; > > ok this seems to answer my other question but is this something we are > specifying in SW or capability of a channel? That's a capability of the hardware. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html