Re: [PATCH] dmaengine: imx-sdma: Add device to device support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi vinod

On Tue, Jul 07, 2015 at 09:50:57AM +0530, Vinod Koul wrote:
> On Tue, Jun 23, 2015 at 04:42:54PM +0800, Shengjiu Wang wrote:
> > +static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac)
> > +{
> > +	struct sdma_engine *sdma = sdmac->sdma;
> > +
> > +	int lwml = sdmac->watermark_level & 0xff;
> > +	int hwml = (sdmac->watermark_level >> 16) & 0xff;
> > +
> > +	if (sdmac->event_id0 > 31) {
> > +		sdmac->event_mask[0] |= 0;
> > +		__set_bit(28, &sdmac->watermark_level);
> why not use set_bit(), you are modifying driver memory
Original driver all use the __set_bit. do you think we need to change
all the __set_bit to set_bit? And from the header file "arch/arm/include/asm
/bitops.h", the set_bit is same as __set_bit.
> 
> 
> > +		sdmac->event_mask[1] |=
> > +				BIT(sdmac->event_id0 % 32);
> and then why not use set_bit() here too?
> 
> > +	} else {
> > +		sdmac->event_mask[0] |= 0;
> > +		sdmac->event_mask[1] |=
> > +				BIT(sdmac->event_id0 % 32);
> > +	}
> > +	if (sdmac->event_id1 > 31) {
> > +		sdmac->event_mask[1] |= 0;
> > +		__set_bit(29, &sdmac->watermark_level);
> > +		sdmac->event_mask[0] |=
> > +			BIT(sdmac->event_id1 % 32);
> > +	} else {
> > +		sdmac->event_mask[1] |= 0;
> > +		sdmac->event_mask[0] |=
> > +			BIT(sdmac->event_id1 % 32);
> > +	}
> pattern for eventidX is repeated, also in that we can make generic macro to
> handle and reduce code size
I will change this.
> 
> > +
> > +	/*
> > +	 * If LWML(src_maxburst) > HWML(dst_maxburst), we need
> > +	 * swap LWML and HWML of INFO(A.3.2.5.1), also need swap
> > +	 * r0(event_mask[1]) and r1(event_mask[0]).
> > +	 */
> > +	if (lwml > hwml) {
> > +		sdmac->watermark_level &= ~0xff00ff;
> Magic number?
> 
> >  static int sdma_config_channel(struct dma_chan *chan)
> >  {
> >  	struct sdma_channel *sdmac = to_sdma_chan(chan);
> > @@ -869,6 +945,12 @@ static int sdma_config_channel(struct dma_chan *chan)
> >  		sdma_event_enable(sdmac, sdmac->event_id0);
> >  	}
> >  
> > +	if (sdmac->event_id1) {
> > +		if (sdmac->event_id1 >= sdmac->sdma->drvdata->num_events)
> > +			return -EINVAL;
> > +		sdma_event_enable(sdmac, sdmac->event_id1);
> > +	}
> > +
> >  	switch (sdmac->peripheral_type) {
> >  	case IMX_DMATYPE_DSP:
> >  		sdma_config_ownership(sdmac, false, true, true);
> > @@ -887,19 +969,21 @@ static int sdma_config_channel(struct dma_chan *chan)
> >  			(sdmac->peripheral_type != IMX_DMATYPE_DSP)) {
> >  		/* Handle multiple event channels differently */
> >  		if (sdmac->event_id1) {
> > -			sdmac->event_mask[1] = BIT(sdmac->event_id1 % 32);
> > -			if (sdmac->event_id1 > 31)
> > -				__set_bit(31, &sdmac->watermark_level);
> > -			sdmac->event_mask[0] = BIT(sdmac->event_id0 % 32);
> > -			if (sdmac->event_id0 > 31)
> > -				__set_bit(30, &sdmac->watermark_level);
> > -		} else {
> > +			if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP ||
> > +			    sdmac->peripheral_type == IMX_DMATYPE_ASRC)
> > +				sdma_set_watermarklevel_for_p2p(sdmac);
> > +		} else
> >  			__set_bit(sdmac->event_id0, sdmac->event_mask);
> > -		}
> > +
> >  		/* Watermark Level */
> >  		sdmac->watermark_level |= sdmac->watermark_level;
> >  		/* Address */
> > -		sdmac->shp_addr = sdmac->per_address;
> > +		if (sdmac->direction == DMA_DEV_TO_DEV) {
> Okay the direction is depreciated, so can you store both source and
> destination and use them based on direction in prepare()
> 
> Also I see driver is not doing this, so while at it, can you fix this is
> current code as well
> 
which prepare() do you mean? sdma_prep_dma_cyclic, sdma_prep_slave_sg?

> -- 
> ~Vinod
> 


best regards
wang shengjiu
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux