Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752893AbbLRH14 (ORCPT ); Fri, 18 Dec 2015 02:27:56 -0500 Received: from 212-186-180-163.dynamic.surfer.at ([212.186.180.163]:39863 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727AbbLRH1z convert rfc822-to-8bit (ORCPT ); Fri, 18 Dec 2015 02:27:55 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: [RESEND][PATCH v2] dmaengine: bcm2835: Add slave dma support From: Martin Sperl In-Reply-To: <20151218060526.GW1854@localhost> Date: Fri, 18 Dec 2015 08:27:52 +0100 Cc: dmaengine@vger.kernel.org, Linux Kernel Mailing List , linux-rpi-kernel , =?utf-8?Q?Noralf_Tr=C3=B8nnes?= , jonathan@raspberrypi.org, dan.j.williams@intel.com, Eric Anholt , Stephen Warren , Lee Jones Content-Transfer-Encoding: 8BIT Message-Id: <54C5C021-6733-412D-8E2C-0118F786465F@martin.sperl.org> References: <20151218060526.GW1854@localhost> To: Vinod Koul X-Mailer: Apple Mail (2.2104) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2428 Lines: 72 > On 18.12.2015, at 07:05, Vinod Koul wrote: > > 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 I agree - can have a look - the big question is: how would I document the individual changes by Gellert Weisz and myself correctly? * just a single patch with an attribution tag (which?) or just a commit message? * Patchset with 2 patches: the original by Gellert Weisz (this) plus the modification to consolidate the code above? Thanks, Martin-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/