public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Martin Sperl <kernel@martin.sperl.org>
Cc: dmaengine@vger.kernel.org,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	linux-rpi-kernel <linux-rpi-kernel@lists.infradead.org>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	jonathan@raspberrypi.org, dan.j.williams@intel.com,
	"Eric Anholt" <eric@anholt.net>,
	"Stephen Warren" <swarren@wwwdotorg.org>,
	"Lee Jones" <lee@kernel.org>
Subject: Re: [RESEND][PATCH v2] dmaengine: bcm2835: Add slave dma support
Date: Fri, 18 Dec 2015 11:35:26 +0530	[thread overview]
Message-ID: <20151218060526.GW1854@localhost> (raw)
In-Reply-To: <BEF09E4E-291F-4802-9DDE-BF9E4612FAC0@martin.sperl.org>

On Thu, Dec 17, 2015 at 07:11:48PM +0100, Martin Sperl wrote:

> +
> +			/* Setup addresses */
> +			if (d->dir == DMA_DEV_TO_MEM) {
> +				control_block->info = BCM2835_DMA_D_INC |
> +						      BCM2835_DMA_D_WIDTH |
> +						      BCM2835_DMA_S_DREQ;
> +				control_block->src = dev_addr;
> +				control_block->dst = addr + (dma_addr_t)j;
> +			} else {
> +				control_block->info = BCM2835_DMA_S_INC |
> +						      BCM2835_DMA_S_WIDTH |
> +						      BCM2835_DMA_D_DREQ;
> +				control_block->src = addr + (dma_addr_t)j;
> +				control_block->dst = dev_addr;
> +			}
> +
> +			/* Common part */
> +			control_block->info |=
> +				BCM2835_DMA_WAITS(BCM2835_DMA_WAIT_CYCLES);
> +			control_block->info |= BCM2835_DMA_WAIT_RESP;
> +
> +			/* Enable */
> +			if (i == sg_len - 1 && len - j <= max_size)
> +				control_block->info |= BCM2835_DMA_INT_EN;
> +
> +			/* Setup synchronization */
> +			if (sync_type)
> +				control_block->info |= sync_type;
> +
> +			/* Setup DREQ channel */
> +			if (c->dreq)
> +				control_block->info |=
> +					BCM2835_DMA_PER_MAP(c->dreq);
> +
> +			/* Length of a frame */
> +			control_block->length = min(len - j, max_size);
> +			d->size += control_block->length;
> +
> +			if (i < sg_len - 1 || len - j > max_size) {
> +				/* Next block is the next frame. */
> +				control_block->next =
> +					d->control_block_base_phys +
> +					sizeof(struct bcm2835_dma_cb) *
> +					(i + split_cnt + 1);
> +			} else {
> +				/* Next block is empty. */
> +				control_block->next = 0;
> +			}
> +
> +			if (len - j > max_size)
> +				split_cnt++;

Most of this part is common with the cyclic and seems copy paste. Can we
use common routine to do common work please

-- 
~Vinod

  reply	other threads:[~2015-12-18  6:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 18:11 [RESEND][PATCH v2] dmaengine: bcm2835: Add slave dma support Martin Sperl
2015-12-18  6:05 ` Vinod Koul [this message]
2015-12-18  7:27   ` Martin Sperl
2015-12-18  8:03     ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151218060526.GW1854@localhost \
    --to=vinod.koul@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=eric@anholt.net \
    --cc=jonathan@raspberrypi.org \
    --cc=kernel@martin.sperl.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=noralf@tronnes.org \
    --cc=swarren@wwwdotorg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox