Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp398622imm; Thu, 27 Sep 2018 23:54:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61iFFNRzARo5aKztDOmtF5JgSHzKMFB/U9qiDtpGhk7Ag6ppPvWOV/KmYdYGHBfBuV7X+OM X-Received: by 2002:a62:fcd8:: with SMTP id e207-v6mr14996551pfh.132.1538117658078; Thu, 27 Sep 2018 23:54:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538117658; cv=none; d=google.com; s=arc-20160816; b=AFcqgEuH4bSUW+GJouw4jnIlgNovjWoWnGFfkJGt1fJHwOZ2SzApOQp+JBlJWlN5oj qqZLYIDu3dXtJuhJEIM8WkcDYn3BwrEKPYY74wLguDUDWec7ufpVZcS2dW8Zs8Yg9pgy OJy9CGi+peWia4bNgBIfkVhrWfcYMzvO2qcr8A8l3SPdIhto0J/bw68gGNZ5G7a22+sz P9P8jzu+RhbbQeinTklRwekwZnr14LC3+jI2ypB3tYhlmnLMLPo/U0ldafoWyOf2P32J JhnrcP5Bldenw99InE9lzBWKl4pQQwC+dBr8KoGHieQ9X7LhIRUVOPTDrqCxt9fIyD/P lu/w== 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 :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=G24O8/iVoiurdwsx3tCMQSoGwc+c9qa/sgdkgEZrNVU=; b=bl8reqQCoSgAq/VSlSXBHqWIzEqaY4Vy2culNVVZaKH78pTkGBDcu86u5t8BqobHqb otCsg2ynPaVtX5TTxCvu8juI1vG/aoyqTm0A95USL7U7///TnC4xMWr8X9wwTizhpYzy C6Ge8DGusvwQ9e2Ld5SX2zuBndQS4EZD2MJqLtk7ZOcSzPo3/Dg5IEIhbcHArF5OQsBS rhdfCFjNZ2ovLHT3H5n+vAQWPzgi4bNz18+NhC5e4hN364DvgAGi53B8EVmhy/DwNJP4 B6GJ3LQhQ6jAOBbp+oQEnrdtctsE/KYqHD8IYAWcj6oP6aPDVpkrSRbhxXss1co+cVVX lJUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tTrfGVQZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8-v6si3975897pgh.418.2018.09.27.23.54.01; Thu, 27 Sep 2018 23:54:18 -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=@gmail.com header.s=20161025 header.b=tTrfGVQZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728977AbeI1NPm (ORCPT + 99 others); Fri, 28 Sep 2018 09:15:42 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38397 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728813AbeI1NPl (ORCPT ); Fri, 28 Sep 2018 09:15:41 -0400 Received: by mail-wm1-f68.google.com with SMTP id z16-v6so1030175wmi.3; Thu, 27 Sep 2018 23:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=G24O8/iVoiurdwsx3tCMQSoGwc+c9qa/sgdkgEZrNVU=; b=tTrfGVQZFd64wwG7/qRE8kqB/m44KpP8641p43EXmqx0N3egn3B0LiEuAgM2Ss4V83 A8NLm8Q2goHJc9w9e6nvcuI5cWnHzn/0YdIPme5HAjbyqdbZzH6nkxIQJBeJUhu67oPq wLF/stX5XTR8KKFoKvjZ+1vPdJ7gV1AHFsurQGwP7pOJHbCLxyUWxd9ICcrB+IFw8hBR i+6zuzq8b1YH886/hHqWilSpKCwikU4XJeOoBclRUu6RWGPMmGPRPwpbXy2Yc8LmqilD 13VhKdgv4TG3540h3qsnY2rJS5MyX3V9Pw6zEBxRdcKQ8YlhxmGw4A+0FDxoEk4IjRCi 6wTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=G24O8/iVoiurdwsx3tCMQSoGwc+c9qa/sgdkgEZrNVU=; b=FCfn8weBmJVpssOvOH0AK04Fj046kXiUFD3i6fuz2ttWlqtsjQIZAn1+C9t6sjH9cz tHceZLJwMwFixv21Nza/HrETJKe2T4flJjiwVNvrg7h9mO29G1Qx0h55BqLWlxTsjTLq AsJw0uVAYcTGvhpw/0o6NpRDl+5Olxs4kCL5cBkrmAOrHoNcT8bvfwBHNECJmURJ6rfO FQvwFDxsX7twRw2Y37L2e3NDClDMgAKwMkCAoz9ibQNSukeFrvC8lHRpZiMSbk+fzl53 736C3Ce2fd5DdB/b1byKuHOErm/R+09DkZG3rD7FEqYbWoyG2YU2f3UrAFawCRQ2GeuF wsCA== X-Gm-Message-State: ABuFfohR73IjxXkloJShQ3TpZFQeJsZYdkpklghiGKDWSIHGJ9UeSXHM Nq2W8EhMOC0JPRyDCz1JMlyz8Rs6NWm3n759d6s= X-Received: by 2002:a1c:a90:: with SMTP id 138-v6mr683576wmk.49.1538117603884; Thu, 27 Sep 2018 23:53:23 -0700 (PDT) MIME-Version: 1.0 References: <20180907062502.8241-1-andrea.merello@gmail.com> <20180907062502.8241-4-andrea.merello@gmail.com> <20180918162508.GD2613@vkoul-mobl> In-Reply-To: <20180918162508.GD2613@vkoul-mobl> Reply-To: andrea.merello@gmail.com From: Andrea Merello Date: Fri, 28 Sep 2018 08:53:11 +0200 Message-ID: Subject: Re: [PATCH v5 4/7] dmaengine: xilinx_dma: program hardware supported buffer length To: Vinod Cc: dan.j.williams@intel.com, michal.simek@xilinx.com, appana.durga.rao@xilinx.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel , Rob Herring , Mark Rutland , devicetree , Radhey Shyam Pandey 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 Tue, Sep 18, 2018 at 6:25 PM Vinod wrote: > > On 07-09-18, 08:24, Andrea Merello wrote: > > From: Radhey Shyam Pandey > > > > AXI-DMA IP supports configurable (c_sg_length_width) buffer length > > register width, hence read buffer length (xlnx,sg-length-width) DT > > property and ensure that driver doesn't program buffer length > > exceeding the supported limit. For VDMA and CDMA there is no change. > > > > Cc: Rob Herring > > Cc: Mark Rutland > > Cc: devicetree@vger.kernel.org > > Signed-off-by: Radhey Shyam Pandey > > Signed-off-by: Michal Simek > > Signed-off-by: Andrea Merello [rebase, reword] > > --- > > Changes in v2: > > - drop original patch and replace with the one in Xilinx tree > > Changes in v3: > > - cc DT maintainers/ML > > Changes in v4: > > - upper bound for the property should be 26, not 23 > > - add warn for width > 23 as per xilinx original patch > > - rework due to changes introduced in 1/6 > > Changes in v5: > > None > > --- > > drivers/dma/xilinx/xilinx_dma.c | 36 +++++++++++++++++++++++++-------- > > 1 file changed, 28 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c > > index aaa6de8a70e4..b17f24e4ec35 100644 > > --- a/drivers/dma/xilinx/xilinx_dma.c > > +++ b/drivers/dma/xilinx/xilinx_dma.c > > @@ -158,7 +158,9 @@ > > #define XILINX_DMA_REG_BTT 0x28 > > > > /* AXI DMA Specific Masks/Bit fields */ > > -#define XILINX_DMA_MAX_TRANS_LEN GENMASK(22, 0) > > +#define XILINX_DMA_MAX_TRANS_LEN_MIN 8 > > +#define XILINX_DMA_MAX_TRANS_LEN_MAX 23 > > +#define XILINX_DMA_V2_MAX_TRANS_LEN_MAX 26 > > #define XILINX_DMA_CR_COALESCE_MAX GENMASK(23, 16) > > #define XILINX_DMA_CR_CYCLIC_BD_EN_MASK BIT(4) > > #define XILINX_DMA_CR_COALESCE_SHIFT 16 > > @@ -418,6 +420,7 @@ struct xilinx_dma_config { > > * @rxs_clk: DMA s2mm stream clock > > * @nr_channels: Number of channels DMA device supports > > * @chan_id: DMA channel identifier > > + * @max_buffer_len: Max buffer length > > */ > > struct xilinx_dma_device { > > void __iomem *regs; > > @@ -437,6 +440,7 @@ struct xilinx_dma_device { > > struct clk *rxs_clk; > > u32 nr_channels; > > u32 chan_id; > > + u32 max_buffer_len; > > }; > > > > /* Macros */ > > @@ -964,7 +968,7 @@ static int xilinx_dma_calc_copysize(struct xilinx_dma_chan *chan, > > int size, int done) > > { > > size_t copy = min_t(size_t, size - done, > > - XILINX_DMA_MAX_TRANS_LEN); > > + chan->xdev->max_buffer_len); > > hmm why not add max_buffer_len in patch 1 again, and then use default > len as XILINX_DMA_MAX_TRANS_LEN and add multiple lengths here :) Sorry, I'm not getting your point. Could you please elaborate the "add multiple lengths here" thing ? > - > ~Vinod