Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1428562imm; Thu, 6 Sep 2018 23:27:04 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY29gJLdeIANYqP8EZkr5zRjjTkw+UKkAfx9qJUOeLNwhOgBSL4Tn9dkrT2GZCY5/NuHSrP X-Received: by 2002:a63:881:: with SMTP id 123-v6mr6662107pgi.244.1536301624384; Thu, 06 Sep 2018 23:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536301624; cv=none; d=google.com; s=arc-20160816; b=mESWuJZh8IYHkSchI8Nm14G+WLDvZcyesJS1MniM21My3pB6aigHXokKoY/3NTQJNT abQs6BGN1C7iR3bwq+Yb2tzFjQlCW9ozn8v+19VELHQQG1fTMdty9UQqLyTFk3YWdlhi W7tcV38tDNpDLDvWUA6SrX9No82KexWVtIVBhyy1rwYhDLL0O+e7iR0lpD8k9ZZbjRdh 9pcgoZGVlpJ1abrxnl5eskkGGBbUWk7E2mYHsN7UcMUvPQ2AR26fMduFIcyRsRo4foEy G6yfq8p4kkt/ktHer4sUG3EuLqsdyqw+AFBCnGTrsWLw92ze+/M7HhcY/Xv/b0GWJUp1 xxnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FEMoKkzJKGEd2pan1RZSHub8CW5+hNLYSGu4iHTdeb8=; b=fTp3zhHeQv/e9Lh96V4XtdJ4UdcmPsDSEWNFqOKLb4fYDI60P2LOQZ9LqqgI8pKPOS iDi80WoFZ0p+kqQiHB3qXbimRr97Br8JhyU/3h3pT+I7k+sZ2T9e67+H8R96nECpo+ao KCiToWJtc5kC7XbuNbtEXZ2cZsabUMGAiPfoqo+cfUF+g44W5d92Iy4+ndbT3KnHx94W kyAs+SW/pfe6HJwnuiFBZ+b0+OlwQ/YHBKDpNjONddKXb7hGPJu8pJ1FCHvwViporSgu Qq+cN3GJ885PNqZ/KLcmIj57K7N0vdVDB0j9AeFAk10hKhh23Edjy+SmiSk1JQL/a7qY K1OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c3492NB2; 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 x188-v6si7504776pfx.19.2018.09.06.23.26.49; Thu, 06 Sep 2018 23:27:04 -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=c3492NB2; 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 S1727671AbeIGLEw (ORCPT + 99 others); Fri, 7 Sep 2018 07:04:52 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:40538 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727611AbeIGLEv (ORCPT ); Fri, 7 Sep 2018 07:04:51 -0400 Received: by mail-wm0-f65.google.com with SMTP id 207-v6so13324587wme.5; Thu, 06 Sep 2018 23:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FEMoKkzJKGEd2pan1RZSHub8CW5+hNLYSGu4iHTdeb8=; b=c3492NB2dogE6/5bD94zfn6zPBy1doJZTICG1U6YQS7B8WMUfLbtPiOaZg7t8TWuQm y5bVoDJlhlOlrEmibMwiHXyNSslerqA2t0kAtgIFA9iYFWEXvxwta2hmLb/iUGMCBWP7 oRO3FYLWkobIGF08qPOB4Y1j3idWSiJ8fwCADuuGvTMoBs18cUWO2hP6Zm1Wb/yiLsVZ KuogfekYAHwTgt0lmpDp6CEKU0M1IM3Xb6SZ86qCwG300Yr9tImzb0TrrxOsRgkvXSjf G1reKJ10lX+u9U7hIlMFHFXpZcVMmyiBEsM8CYDtXPwioa84VfUfLL/fk0+jQQjcP3vu xjYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FEMoKkzJKGEd2pan1RZSHub8CW5+hNLYSGu4iHTdeb8=; b=e1M0ihYbRfjA7K9BqWHCjnhYs9Rp0aOEkcxomQT1VoZSXXKqmxNu7rynFI0MND5+MP SZJw2CrByxoyc/TuqLtW/cx1g45WQALRb6NkutGhG+5D6eDrb5G+ahUj+z5et7YNQGrf TCVkUI7Po95Q5qRv/MP87lFReDpR8tJIIjCQxg2pm0U3vy0MQzNAsYS8zrMh62RhE9Ht 9mx0Y0vDdS9894Qt+ULrIuFdOGO96ubRvvbfrKfHluzqUahytfPZ2k8r02upOHvP6M/P gbesluyMdC3g48p20HJEiFJKJCJNZXLY+2Ggpty85VcYpTO+zNPXk6FQFioiniNxbY4L iRyQ== X-Gm-Message-State: APzg51CQauKZWrTVFyN7Za+cO7N8ICg2LBRdSAvxM5nPsVSGhUXp94BY rMUk2GhumFxbiag1Q+IgaFs= X-Received: by 2002:a1c:2e11:: with SMTP id u17-v6mr4134805wmu.102.1536301526621; Thu, 06 Sep 2018 23:25:26 -0700 (PDT) Received: from NewMoon.iit.local ([90.147.180.254]) by smtp.gmail.com with ESMTPSA id w10-v6sm8387233wrp.31.2018.09.06.23.25.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 23:25:25 -0700 (PDT) From: Andrea Merello To: vkoul@kernel.org, dan.j.williams@intel.com, michal.simek@xilinx.com, appana.durga.rao@xilinx.com, dmaengine@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, radhey.shyam.pandey@xilinx.com, Andrea Merello Subject: [PATCH v5 7/7] dmaengine: xilinx_dma: Drop SG support for VDMA IP Date: Fri, 7 Sep 2018 08:25:02 +0200 Message-Id: <20180907062502.8241-7-andrea.merello@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907062502.8241-1-andrea.merello@gmail.com> References: <20180907062502.8241-1-andrea.merello@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org xilinx_vdma_start_transfer() is used only for VDMA IP, still it contains conditional code on has_sg variable. has_sg is set only whenever the HW does support SG mode, that is never true for VDMA IP. This patch drops the never-taken branches. Signed-off-by: Andrea Merello --- Changes in V4: introduced this patch in series Changes in v5: None --- drivers/dma/xilinx/xilinx_dma.c | 84 +++++++++++++-------------------- 1 file changed, 32 insertions(+), 52 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 78d0f2f8225e..07ceadef0a00 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -1093,6 +1093,8 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) struct xilinx_dma_tx_descriptor *desc, *tail_desc; u32 reg, j; struct xilinx_vdma_tx_segment *tail_segment; + struct xilinx_vdma_tx_segment *segment, *last = NULL; + int i = 0; /* This function was invoked with lock held */ if (chan->err) @@ -1112,14 +1114,6 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) tail_segment = list_last_entry(&tail_desc->segments, struct xilinx_vdma_tx_segment, node); - /* - * If hardware is idle, then all descriptors on the running lists are - * done, start new transfers - */ - if (chan->has_sg) - dma_ctrl_write(chan, XILINX_DMA_REG_CURDESC, - desc->async_tx.phys); - /* Configure the hardware using info in the config structure */ reg = dma_ctrl_read(chan, XILINX_DMA_REG_DMACR); @@ -1128,15 +1122,11 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) else reg &= ~XILINX_DMA_DMACR_FRAMECNT_EN; - /* - * With SG, start with circular mode, so that BDs can be fetched. - * In direct register mode, if not parking, enable circular mode - */ - if (chan->has_sg || !config->park) - reg |= XILINX_DMA_DMACR_CIRC_EN; - + /* If not parking, enable circular mode */ if (config->park) reg &= ~XILINX_DMA_DMACR_CIRC_EN; + else + reg |= XILINX_DMA_DMACR_CIRC_EN; dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg); @@ -1158,48 +1148,38 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) return; /* Start the transfer */ - if (chan->has_sg) { - dma_ctrl_write(chan, XILINX_DMA_REG_TAILDESC, - tail_segment->phys); - list_splice_tail_init(&chan->pending_list, &chan->active_list); - chan->desc_pendingcount = 0; - } else { - struct xilinx_vdma_tx_segment *segment, *last = NULL; - int i = 0; - - if (chan->desc_submitcount < chan->num_frms) - i = chan->desc_submitcount; - - list_for_each_entry(segment, &desc->segments, node) { - if (chan->ext_addr) - vdma_desc_write_64(chan, - XILINX_VDMA_REG_START_ADDRESS_64(i++), - segment->hw.buf_addr, - segment->hw.buf_addr_msb); - else - vdma_desc_write(chan, + if (chan->desc_submitcount < chan->num_frms) + i = chan->desc_submitcount; + + list_for_each_entry(segment, &desc->segments, node) { + if (chan->ext_addr) + vdma_desc_write_64(chan, + XILINX_VDMA_REG_START_ADDRESS_64(i++), + segment->hw.buf_addr, + segment->hw.buf_addr_msb); + else + vdma_desc_write(chan, XILINX_VDMA_REG_START_ADDRESS(i++), segment->hw.buf_addr); - last = segment; - } - - if (!last) - return; + last = segment; + } - /* HW expects these parameters to be same for one transaction */ - vdma_desc_write(chan, XILINX_DMA_REG_HSIZE, last->hw.hsize); - vdma_desc_write(chan, XILINX_DMA_REG_FRMDLY_STRIDE, - last->hw.stride); - vdma_desc_write(chan, XILINX_DMA_REG_VSIZE, last->hw.vsize); + if (!last) + return; - chan->desc_submitcount++; - chan->desc_pendingcount--; - list_del(&desc->node); - list_add_tail(&desc->node, &chan->active_list); - if (chan->desc_submitcount == chan->num_frms) - chan->desc_submitcount = 0; - } + /* HW expects these parameters to be same for one transaction */ + vdma_desc_write(chan, XILINX_DMA_REG_HSIZE, last->hw.hsize); + vdma_desc_write(chan, XILINX_DMA_REG_FRMDLY_STRIDE, + last->hw.stride); + vdma_desc_write(chan, XILINX_DMA_REG_VSIZE, last->hw.vsize); + + chan->desc_submitcount++; + chan->desc_pendingcount--; + list_del(&desc->node); + list_add_tail(&desc->node, &chan->active_list); + if (chan->desc_submitcount == chan->num_frms) + chan->desc_submitcount = 0; chan->idle = false; } -- 2.17.1