Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp687451imm; Fri, 11 May 2018 04:59:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrBSPcPAMb74H4WaZK5XmhSncKarnxe+gQkg8EVyFCnJdmgpaQvfosTSdin80oOGUA4S2UN X-Received: by 2002:a65:61a6:: with SMTP id i6-v6mr4207059pgv.88.1526039961067; Fri, 11 May 2018 04:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526039961; cv=none; d=google.com; s=arc-20160816; b=lIO8bQWOTKF8dKnfToZ79hMgb0b9+EmdN1x3a/US37/mEVqs2OAzAYt6zvTJKPEzWc UaDfODt2lXAUfHtDeRuligjoEhg/dlICEodmvt/Vg3Jjhvpeah2ozAoSP0IflGTOiYxO ckosENMkTKAS16uVgvfClaZTfnoUxtoa5W5yWrCbO0HLO7ZBujEUL+uzxwU34uYdaPOB Iq57spAG7gxoTAOMxJXJe4F6AZun1B+G1Zul3MH6aHgpUfLJ+RHBP9Gu00UO5X19TEbk gaIiELmcGpAuF4IFWH8H65+FmbnbknSulfhf3DoOzcNmLbwd3wh4o0MZQweLCC4JMGlP ztoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=SeR9K7QmBcWqLQZWxGTEaFT7piGiRZeYjiBKvSEury8=; b=tnMDa5Qim3JWlN8fKU6pc+BMXhDFjN+TKQA3zWlQUmvjkEIJY6jqdaRuwdhIgfD1B7 Xobcq80EJB8JHZICct6oPYP00yjR4GLjHzoqguJBOp7O95TGjYT9UOMHJqPsXy6OtSap iLTTObzclgYfrl3OREfo9NB2XWLmgyhjqr7HCvWrYwqmS+t49VaWFpWj+C71ssVmscvM nH9zq+RItUAuzEgvFT+B5PFCraOpdCFjx/SW9q6GEACbM/gBBn5QuehOwjaZ/vzCRpCZ eUlXro0Tqo9cboc9dtPYriHakqtZDI/TES6jv80AJVJ3i+eIi3yZFD+pu9UWi4fUXnax d8AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dAsL940x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6-v6si3026969pfb.25.2018.05.11.04.59.06; Fri, 11 May 2018 04:59:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dAsL940x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752835AbeEKL6m (ORCPT + 99 others); Fri, 11 May 2018 07:58:42 -0400 Received: from mail-ot0-f174.google.com ([74.125.82.174]:43209 "EHLO mail-ot0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752272AbeEKL6k (ORCPT ); Fri, 11 May 2018 07:58:40 -0400 Received: by mail-ot0-f174.google.com with SMTP id y10-v6so5907257otg.10 for ; Fri, 11 May 2018 04:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SeR9K7QmBcWqLQZWxGTEaFT7piGiRZeYjiBKvSEury8=; b=dAsL940x7KA0i+pOn3d4+LIhPXXqDf6ZLjRCYkfD15Gw7IboCM1GdEMtNMrN3Bi5UD pIbb/LezmgoQ4M30ZfbsMFii8stZeha81N1ybgzwszUQi7CMYhKMnSSznyD7s8DpJooa 3BzQnCNOI7GXpxOuGSK+lOEOg81nhsImHciOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SeR9K7QmBcWqLQZWxGTEaFT7piGiRZeYjiBKvSEury8=; b=n/q40BSMVkGxJ8LyqOUd7RJscrBuBhrIw0gKS4OAlZ3iedfphxTs0/bEX9KdUdBeKE M4NjUzGJVBonY2PwIXsKn53btogK+f/0RjID2EwlyReYQF4b1CGRd4RIZomB6TmQ1S3+ nK3JcBBPjLLpcIcHT0nngy34j7MslJhLtDtsFlUEuiNhI8rwnbcMOEEsFXRhGp0EnytR QP8Oij8M12J7pMwplRGO+jj+qU6bL+aVU26YKoMBFXaNzG2WpzN+M0bnOQ3qc7VnBgF6 UPihY2uylowAAPaky8j+V+Ji9X/LaW80cPPk9ypdnoO3+EdN5lEy6aGXO4DR+x2Yi0VK ixIw== X-Gm-Message-State: ALKqPwfelvAA+jmV9Afyqot2F59yJziSQxCUY161e+AN6UXg67TboSmG QWCByL0nGZCI4kCA7cdLC4Z4RWw9erLjGXAR4hFlUQ== X-Received: by 2002:a9d:7103:: with SMTP id n3-v6mr3540271otj.40.1526039920296; Fri, 11 May 2018 04:58:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2d77:0:0:0:0:0 with HTTP; Fri, 11 May 2018 04:58:39 -0700 (PDT) In-Reply-To: <20180511115306.GC30118@vkoul-mobl> References: <67447aabb8e4e051ff39b814a0e169e6a91bb66e.1525863923.git.baolin.wang@linaro.org> <20180511112225.GA30118@vkoul-mobl> <20180511115306.GC30118@vkoul-mobl> From: Baolin Wang Date: Fri, 11 May 2018 19:58:39 +0800 Message-ID: Subject: Re: [PATCH v2 2/2] dmaengine: sprd: Add Spreadtrum DMA configuration To: Vinod Koul Cc: Dan Williams , Eric Long , Mark Brown , Lars-Peter Clausen , dmaengine@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11 May 2018 at 19:53, Vinod Koul wrote: > On 11-05-18, 19:44, Baolin Wang wrote: >> Hi Vinod, >> >> On 11 May 2018 at 19:22, Vinod Koul wrote: >> > On 09-05-18, 19:12, Baolin Wang wrote: >> > >> >> +/* >> >> + * struct sprd_dma_config - DMA configuration structure >> >> + * @cfg: dma slave channel runtime config >> >> + * @src_addr: the source physical address >> >> + * @dst_addr: the destination physical address >> >> + * @block_len: specify one block transfer length >> >> + * @transcation_len: specify one transcation transfer length >> >> + * @src_step: source transfer step >> >> + * @dst_step: destination transfer step >> >> + * @wrap_ptr: wrap pointer address, once the transfer address reaches the >> >> + * 'wrap_ptr', the next transfer address will jump to the 'wrap_to' address. >> >> + * @wrap_to: wrap jump to address >> >> + * @req_mode: specify the DMA request mode >> >> + * @int_mode: specify the DMA interrupt type >> >> + */ >> >> +struct sprd_dma_config { >> >> + struct dma_slave_config cfg; >> >> + phys_addr_t src_addr; >> >> + phys_addr_t dst_addr; >> > >> > these are already in cfg so why duplicate, same for few more here. >> >> We save them in 'struct sprd_dma_config' as one parameter for >> sprd_dma_config(), otherwise we need add 2 more parameters (src and >> dst) for sprd_dma_config(). > > I am not sure I follow... > > I meant you can use sprd_dma_config.cfg->src_addr/dst_addr and remove src_addr & > dst_addr in the sprd_dma_config. It duplicate.. But we can not set values if dir == DMA_MEM_TO_DEV, since they represent the device address, right? sprd_dma_config.cfg->src_addr = sg_dma_address(sg); > > Same for few more params... > >> >> + if (!is_slave_direction(dir) || sglen > 1) >> >> + return NULL; >> >> + >> >> + sdesc = kzalloc(sizeof(*sdesc), GFP_NOWAIT); >> >> + if (!sdesc) >> >> + return NULL; >> >> + >> >> + for_each_sg(sgl, sg, sglen, i) { >> >> + if (dir == DMA_MEM_TO_DEV) { >> >> + slave_cfg->src_addr = sg_dma_address(sg); >> >> + slave_cfg->dst_addr = slave_cfg->cfg.dst_addr; >> >> + slave_cfg->src_step = >> >> + sprd_dma_get_step(slave_cfg->cfg.src_addr_width); >> >> + slave_cfg->dst_step = SPRD_DMA_NONE_STEP; >> >> + } else { >> >> + slave_cfg->src_addr = slave_cfg->cfg.src_addr; >> >> + slave_cfg->dst_addr = sg_dma_address(sg); >> >> + slave_cfg->src_step = SPRD_DMA_NONE_STEP; >> >> + slave_cfg->dst_step = >> >> + sprd_dma_get_step(slave_cfg->cfg.dst_addr_width); >> > >> > use a helper for filling this and passing right values for each case? >> >> We need pass many values to this helper, but will try. Thanks. > > I think 5 and that may help to look it better :) OK. -- Baolin.wang Best Regards