From patchwork Sun Oct 7 14:14:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 148335 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2592022lji; Sun, 7 Oct 2018 07:15:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV63XyxVb8olCd0YZg08xUP7eZqMBcGgWg90o+46lSWrptTPzrJFyFNtc0FiBqajbkmMZkHRy X-Received: by 2002:a17:902:d88b:: with SMTP id b11-v6mr19903085plz.136.1538921747186; Sun, 07 Oct 2018 07:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538921747; cv=none; d=google.com; s=arc-20160816; b=IOM4ICedm0AZHzj41cbUsMn3PA0h6066iYheu3on5zr08JI/7vgVYT6LytG+Dx2xw/ o3dqU9NyvzrBIgEIthTejq31thCUJdKdS47rgfVUZp6rps4td/bgf07SGUxAOkVGpUDE af/ZRvCUQnl74CZ4aWlq0iI+8huZfk1Lsh0CI/sdxzF8jmch0deLjE7o4lEocEMx5fJa ROTT9WQF1xrVDFuaU+Bk5cTbd3sykZxPsfNtGbs3ZFs64I+2BNX2fSbmXyQ3pCNQN7Wv 7fzGt27kO5b9Nc7noU+PKBCHJ36u7MG+v4aA4LAcrkXIg1nidcT5Kxr2xHN1pVH3ngvu v83w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=r2rOkEC9eLG7pxDSrsqnnfe0p67zYumOnOfiXEObXjs=; b=pW1wn8usKC/PJfadW/S/KeKpOO0g9nP8qN1fn9IimHGR4tpwnPuVLIltbRx8An4Y8s Wz+wcIVt64G4rVv9L+lJIklW4BzClRIqMKSH8Y57Vba3gAUcKz4hEI09Me5/0Zttl0sQ wu6Vez9zgDwo44uxxfRS4cFgn8g0DYA0Ilbwrnk30BvSlYyGHrAV9y0Xb70/uM4HHYoU jJNEpzUOKiVbVnrAd0yr5hciFzAR3bsCdiFcXKGOE9BiXtSozaSPkeHLZWL0Y61ebzSO nBx8CMUUPGH3sOJ7LLobwk2G1UewDO10Dm3/gkEwNAeqdaB8YOjsaLPDQP+S8l4pKIOJ bezQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WonUMm4t; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a186-v6si14186102pge.55.2018.10.07.07.15.46; Sun, 07 Oct 2018 07:15:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dmaengine-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=@kernel.org header.s=default header.b=WonUMm4t; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726616AbeJGVXG (ORCPT + 3 others); Sun, 7 Oct 2018 17:23:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:45064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbeJGVXG (ORCPT ); Sun, 7 Oct 2018 17:23:06 -0400 Received: from localhost.localdomain (unknown [171.76.113.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5471720882; Sun, 7 Oct 2018 14:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1538921743; bh=i0DubeJCdcYDNZp1q56kXC1nwHtbG76lXUpkV7Ha6/c=; h=From:To:Cc:Subject:Date:From; b=WonUMm4tbiMHlDYI3WpBQFIFVi0K2ePAC1XGE/EQ3uzdvRIjW7BDB7+tT1clGL14E BFDrhM4MuThpoiZv/naJCVMgVxNe402fcYzegKge+jcsqvomQH/n/hMaHhzXzS7UcW M2qWfr7ZeW7Gvnxzc95hlOPp2fU9g90G4O22LZvs= From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul , Angelo Dureghello , Krzysztof Kozlowski Subject: [PATCH v2] dmaengine: fsl-edma: remove dma_slave_config direction usage Date: Sun, 7 Oct 2018 19:44:57 +0530 Message-Id: <20181007141457.1137-1-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org dma_slave_config direction was marked as deprecated quite some time back, remove the usage from this driver so that the field can be removed Signed-off-by: Vinod Koul --- CC: Angelo Dureghello CC: Krzysztof Kozlowski Angelo, Krzysztof, I have rebased this against the latest fsl-edma changes, can you please verify this and let me know, thnx drivers/dma/fsl-edma-common.c | 74 +++++++++++++++++++++++++------------------ drivers/dma/fsl-edma-common.h | 12 ++----- include/linux/dmaengine.h | 1 - 3 files changed, 46 insertions(+), 41 deletions(-) -- 2.14.4 Tested-by: Angelo Dureghello diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 8ba80f4b6f55..8876c4c1bb2c 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -178,19 +178,7 @@ int fsl_edma_slave_config(struct dma_chan *chan, { struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); - fsl_chan->fsc.dir = cfg->direction; - if (cfg->direction == DMA_DEV_TO_MEM) { - fsl_chan->fsc.dev_addr = cfg->src_addr; - fsl_chan->fsc.addr_width = cfg->src_addr_width; - fsl_chan->fsc.burst = cfg->src_maxburst; - fsl_chan->fsc.attr = fsl_edma_get_tcd_attr(cfg->src_addr_width); - } else if (cfg->direction == DMA_MEM_TO_DEV) { - fsl_chan->fsc.dev_addr = cfg->dst_addr; - fsl_chan->fsc.addr_width = cfg->dst_addr_width; - fsl_chan->fsc.burst = cfg->dst_maxburst; - fsl_chan->fsc.attr = fsl_edma_get_tcd_attr(cfg->dst_addr_width); - } else - return -EINVAL; + memcpy(&fsl_chan->cfg, cfg, sizeof(*cfg)); return 0; } @@ -202,7 +190,7 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan, struct fsl_edma_desc *edesc = fsl_chan->edesc; struct edma_regs *regs = &fsl_chan->edma->regs; u32 ch = fsl_chan->vchan.chan.chan_id; - enum dma_transfer_direction dir = fsl_chan->fsc.dir; + enum dma_transfer_direction dir = edesc->dirn; dma_addr_t cur_addr, dma_addr; size_t len, size; int i; @@ -387,7 +375,7 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( u32 src_addr, dst_addr, last_sg, nbytes; u16 soff, doff, iter; - if (!is_slave_direction(fsl_chan->fsc.dir)) + if (!is_slave_direction(direction)) return NULL; sg_len = buf_len / period_len; @@ -395,9 +383,21 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( if (!fsl_desc) return NULL; fsl_desc->iscyclic = true; + fsl_desc->dirn = direction; dma_buf_next = dma_addr; - nbytes = fsl_chan->fsc.addr_width * fsl_chan->fsc.burst; + if (direction == DMA_MEM_TO_DEV) { + fsl_chan->attr = + fsl_edma_get_tcd_attr(fsl_chan->cfg.dst_addr_width); + nbytes = fsl_chan->cfg.dst_addr_width * + fsl_chan->cfg.dst_maxburst; + } else { + fsl_chan->attr = + fsl_edma_get_tcd_attr(fsl_chan->cfg.src_addr_width); + nbytes = fsl_chan->cfg.src_addr_width * + fsl_chan->cfg.src_maxburst; + } + iter = period_len / nbytes; for (i = 0; i < sg_len; i++) { @@ -407,20 +407,20 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic( /* get next sg's physical address */ last_sg = fsl_desc->tcd[(i + 1) % sg_len].ptcd; - if (fsl_chan->fsc.dir == DMA_MEM_TO_DEV) { + if (direction == DMA_MEM_TO_DEV) { src_addr = dma_buf_next; - dst_addr = fsl_chan->fsc.dev_addr; - soff = fsl_chan->fsc.addr_width; + dst_addr = fsl_chan->cfg.dst_addr; + soff = fsl_chan->cfg.dst_addr_width; doff = 0; } else { - src_addr = fsl_chan->fsc.dev_addr; + src_addr = fsl_chan->cfg.src_addr; dst_addr = dma_buf_next; soff = 0; - doff = fsl_chan->fsc.addr_width; + doff = fsl_chan->cfg.src_addr_width; } fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, dst_addr, - fsl_chan->fsc.attr, soff, nbytes, 0, iter, + fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, true, false, true); dma_buf_next += period_len; } @@ -441,42 +441,54 @@ struct dma_async_tx_descriptor *fsl_edma_prep_slave_sg( u16 soff, doff, iter; int i; - if (!is_slave_direction(fsl_chan->fsc.dir)) + if (!is_slave_direction(direction)) return NULL; fsl_desc = fsl_edma_alloc_desc(fsl_chan, sg_len); if (!fsl_desc) return NULL; fsl_desc->iscyclic = false; + fsl_desc->dirn = direction; + + if (direction == DMA_MEM_TO_DEV) { + fsl_chan->attr = + fsl_edma_get_tcd_attr(fsl_chan->cfg.dst_addr_width); + nbytes = fsl_chan->cfg.dst_addr_width * + fsl_chan->cfg.dst_maxburst; + } else { + fsl_chan->attr = + fsl_edma_get_tcd_attr(fsl_chan->cfg.src_addr_width); + nbytes = fsl_chan->cfg.src_addr_width * + fsl_chan->cfg.src_maxburst; + } - nbytes = fsl_chan->fsc.addr_width * fsl_chan->fsc.burst; for_each_sg(sgl, sg, sg_len, i) { /* get next sg's physical address */ last_sg = fsl_desc->tcd[(i + 1) % sg_len].ptcd; - if (fsl_chan->fsc.dir == DMA_MEM_TO_DEV) { + if (direction == DMA_MEM_TO_DEV) { src_addr = sg_dma_address(sg); - dst_addr = fsl_chan->fsc.dev_addr; - soff = fsl_chan->fsc.addr_width; + dst_addr = fsl_chan->cfg.dst_addr; + soff = fsl_chan->cfg.dst_addr_width; doff = 0; } else { - src_addr = fsl_chan->fsc.dev_addr; + src_addr = fsl_chan->cfg.src_addr; dst_addr = sg_dma_address(sg); soff = 0; - doff = fsl_chan->fsc.addr_width; + doff = fsl_chan->cfg.src_addr_width; } iter = sg_dma_len(sg) / nbytes; if (i < sg_len - 1) { last_sg = fsl_desc->tcd[(i + 1)].ptcd; fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, - dst_addr, fsl_chan->fsc.attr, soff, + dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, false, false, true); } else { last_sg = 0; fsl_edma_fill_tcd(fsl_desc->tcd[i].vtcd, src_addr, - dst_addr, fsl_chan->fsc.attr, soff, + dst_addr, fsl_chan->attr, soff, nbytes, 0, iter, iter, doff, last_sg, true, true, false); } diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index a6f5b99ee95f..8917e8865959 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -109,14 +109,6 @@ struct fsl_edma_sw_tcd { struct fsl_edma_hw_tcd *vtcd; }; -struct fsl_edma_slave_config { - enum dma_transfer_direction dir; - enum dma_slave_buswidth addr_width; - u32 dev_addr; - u32 burst; - u32 attr; -}; - struct fsl_edma_chan { struct virt_dma_chan vchan; enum dma_status status; @@ -125,7 +117,8 @@ struct fsl_edma_chan { u32 slave_id; struct fsl_edma_engine *edma; struct fsl_edma_desc *edesc; - struct fsl_edma_slave_config fsc; + struct dma_slave_config cfg; + u32 attr; struct dma_pool *tcd_pool; }; @@ -133,6 +126,7 @@ struct fsl_edma_desc { struct virt_dma_desc vdesc; struct fsl_edma_chan *echan; bool iscyclic; + enum dma_transfer_direction dirn; unsigned int n_tcds; struct fsl_edma_sw_tcd tcd[]; }; diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index d49ec5c31944..f158eaae0ef6 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -365,7 +365,6 @@ enum dma_slave_buswidth { * data, then prefer to do that. */ struct dma_slave_config { - enum dma_transfer_direction direction; phys_addr_t src_addr; phys_addr_t dst_addr; enum dma_slave_buswidth src_addr_width;