Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1693874

Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver

From Vinod Koul <vinod.koul@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver
Date 2017-07-21 19:20 +0200
Message-ID <u5JKN-7DO-3@gated-at.bofh.it> (permalink)
References (1 earlier) <u0e4W-4gf-29@gated-at.bofh.it> <u5B0R-1Xy-3@gated-at.bofh.it> <u5CzF-34w-35@gated-at.bofh.it> <u5CT0-3b5-21@gated-at.bofh.it> <u5DvI-3Ew-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 21, 2017 at 10:32:49AM +0000, Pierre Yves MORDRET wrote:
> >>>> +static int stm32_mdma_set_xfer_param(struct stm32_mdma_chan *chan,
> >>>> +				     enum dma_transfer_direction direction,
> >>>> +				     u32 *mdma_ccr, u32 *mdma_ctcr,
> >>>> +				     u32 *mdma_ctbr, u32 buf_len)
> >>>> +{
> >>>> +	struct stm32_mdma_device *dmadev = stm32_mdma_get_dev(chan);
> >>>> +	struct stm32_mdma_chan_config *chan_config = &chan->chan_config;
> >>>> +	enum dma_slave_buswidth src_addr_width, dst_addr_width;
> >>>> +	phys_addr_t src_addr, dst_addr;
> >>>> +	int src_bus_width, dst_bus_width;
> >>>> +	u32 src_maxburst, dst_maxburst, src_best_burst, dst_best_burst;
> >>>> +	u32 ccr, ctcr, ctbr, tlen;
> >>>> +
> >>>> +	src_addr_width = chan->dma_config.src_addr_width;
> >>>> +	dst_addr_width = chan->dma_config.dst_addr_width;
> >>>> +	src_maxburst = chan->dma_config.src_maxburst;
> >>>> +	dst_maxburst = chan->dma_config.dst_maxburst;
> >>>> +	src_addr = chan->dma_config.src_addr;
> >>>> +	dst_addr = chan->dma_config.dst_addr;
> >>>
> >>> this doesn't seem right to me, only the periphral address would come from
> >>> slave_config, the memory address is passed as an arg to transfer..
> >>>
> >>> ...
> >>>
> >>
> >> Correct. But these locals are managed in the case statement below. if direction
> >> is Mem2Dev only dst_addr(Peripheral) is considered. In the other way around with
> >> Dev2Mem direction only src_addr(Peripheral) is considered.
> >> However to disambiguate I can move src_addr & dst_addr affectation in the
> >> corresponding case statement if you'd like.
> > 
> > But below you are over writing both, so in effect this is wasted cycles..
> > anyway latter one is more clear, so lets remove from here.
> > 
> 
> Sorry I don't follow ... or miss something
> For instance if direction is Mem2Dev ..._xfer_param is going to configure 
> Destination Bus width and Addr given by slave_config. ..._setup_xfer in its turn 
> will configure source given as parameter.
> Don't the see the over-writing

ah re-looking at it, yes you are right.

The above two assignments threw me off, I should have read it properly.

But I think calculating for src and dstn always might not be optimal as you
would use one only, so should these be moved to respective case where they
are used...

-- 
~Vinod

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-21 10:00 +0200
  Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-21 11:40 +0200
    Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-21 12:00 +0200
      Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-21 12:40 +0200
        Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-21 19:20 +0200
          Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-24 11:40 +0200
            Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-26 07:00 +0200

csiph-web