From patchwork Fri Jan 22 11:06:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 8088941 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1790FBEEE5 for ; Fri, 22 Jan 2016 11:08:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6E322038A for ; Fri, 22 Jan 2016 11:08:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9BD22039E for ; Fri, 22 Jan 2016 11:08:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aMZZi-0001Sf-9n; Fri, 22 Jan 2016 11:08:18 +0000 Received: from mail-pa0-f68.google.com ([209.85.220.68]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aMZZW-0001MH-Hi for linux-rockchip@lists.infradead.org; Fri, 22 Jan 2016 11:08:08 +0000 Received: by mail-pa0-f68.google.com with SMTP id pv5so3046358pac.0 for ; Fri, 22 Jan 2016 03:07:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z+CU9NNOz7d59KSkdIIib+P3yUHIDiUq7SB7SBSp0HU=; b=cQI9TG6y8hEeQABryQHRJnI2XsuiEno6mxyxOqOa3jjVQI5IOpVBjjVUm8AOThrUqf lG7qyqEwfRI85TKIpQpS86S4KN4G6agns36LUYEoiJst5goxuQgWGXXAUic0A1aVNlAA 7yG0dPRpUbJeJyDpPoakH8DfOFuDO/BitGMZ3VlQiHOiJQvOJGIsQ61eFUahkscAEejW 8NrPyUqRa+wrX5MukSkmpMQ16N6mRak6dYSi6IattnQqQjInGfeFr+RHTPw5dGNAGSIc pjBFOSIorgmnt27qsuybLcFoOUXn7JtUv4QVVeS1dk1+rLjq9xoVz6Rw96WGQuh3we7C lt2w== X-Gm-Message-State: AG10YORUrWkFQ+qKzsfdtXNrT1R0FW355CKN97fNq7jsSoyg0t++y4X8DdpZ48Si0wHrCQ== X-Received: by 10.67.14.136 with SMTP id fg8mr2667878pad.105.1453460865752; Fri, 22 Jan 2016 03:07:45 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id v2sm8931895pfi.93.2016.01.22.03.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Jan 2016 03:07:44 -0800 (PST) From: Caesar Wang To: Heiko Stuebner , Vinod Koul Subject: [PATCH v7 1/9] dmaengine: pl330: support burst mode for dev-to-mem and mem-to-dev transmit Date: Fri, 22 Jan 2016 19:06:44 +0800 Message-Id: <1453460812-8498-2-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453460812-8498-1-git-send-email-wxt@rock-chips.com> References: <1453460812-8498-1-git-send-email-wxt@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160122_030806_630380_587CE3E1 X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Addy Ke , dmaengine@vger.kernel.org, Boojin Kim , shawn.lin@rock-chips.com, dianders@chromium.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Olof Johansson , Dan Williams , Sonny Rao , Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Boojin Kim This patch adds to support burst mode for dev-to-mem and mem-to-dev transmit. Signed-off-by: Boojin Kim Signed-off-by: Addy Ke Signed-off-by: Shawn Lin cc: Heiko Stuebner cc: Doug Anderson cc: Olof Johansson Reviewed-by: Sonny Rao Signed-off-by: Caesar Wang --- Changes in v7: - As vinod comments, fix the subsystem name. Changes in v6: None Changes in v5: - add Mark's tag for spi changes - remove unnecessary whitespace change - use switch statement for i2s quirk Changes in v4: - remove spi & i2s dts changes and query quirk from dmaengine API suggeseted by Mark. - fix typo - Add dmaengine_get_quirk hook and implement it for pl330 Changes in v3: - add Sunny's tag - add more rockchip drivers' changes in this patchset Changes in v2: - amend the author - reorder the patches suggested by Doug - add Reviewed-by: Doug Anderson for rk3288.dtsi patch and arm-pl330.txt patch Changes in v1: - rename broken-no-flushp to "arm,pl330-broken-no-flushp" suggested by Krzysztof. - add From original author. - remove Sunny's tag drivers/dma/pl330.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 17ee758..7cdf8d4 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1141,10 +1141,13 @@ static inline int _ldst_devtomem(unsigned dry_run, u8 buf[], const struct _xfer_spec *pxs, int cyc) { int off = 0; + enum pl330_cond cond; + + cond = (pxs->desc->rqcfg.brst_len == 1) ? SINGLE : BURST; while (cyc--) { - off += _emit_WFP(dry_run, &buf[off], SINGLE, pxs->desc->peri); - off += _emit_LDP(dry_run, &buf[off], SINGLE, pxs->desc->peri); + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); + off += _emit_LDP(dry_run, &buf[off], cond, pxs->desc->peri); off += _emit_ST(dry_run, &buf[off], ALWAYS); off += _emit_FLUSHP(dry_run, &buf[off], pxs->desc->peri); } @@ -1156,11 +1159,14 @@ static inline int _ldst_memtodev(unsigned dry_run, u8 buf[], const struct _xfer_spec *pxs, int cyc) { int off = 0; + enum pl330_cond cond; + + cond = (pxs->desc->rqcfg.brst_len == 1) ? SINGLE : BURST; while (cyc--) { - off += _emit_WFP(dry_run, &buf[off], SINGLE, pxs->desc->peri); + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); off += _emit_LD(dry_run, &buf[off], ALWAYS); - off += _emit_STP(dry_run, &buf[off], SINGLE, pxs->desc->peri); + off += _emit_STP(dry_run, &buf[off], cond, pxs->desc->peri); off += _emit_FLUSHP(dry_run, &buf[off], pxs->desc->peri); } @@ -1199,7 +1205,7 @@ static inline int _loop(unsigned dry_run, u8 buf[], struct _arg_LPEND lpend; if (*bursts == 1) - return _bursts(dry_run, buf, pxs, 1); + return _bursts(pl330, dry_run, buf, pxs, 1); /* Max iterations possible in DMALP is 256 */ if (*bursts >= 256*256) { @@ -2560,7 +2566,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( desc->rqtype = direction; desc->rqcfg.brst_size = pch->burst_sz; - desc->rqcfg.brst_len = 1; + desc->rqcfg.brst_len = pch->burst_len; desc->bytes_requested = period_len; fill_px(&desc->px, dst, src, period_len); @@ -2705,7 +2711,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, } desc->rqcfg.brst_size = pch->burst_sz; - desc->rqcfg.brst_len = 1; + desc->rqcfg.brst_len = pch->burst_len; desc->rqtype = direction; desc->bytes_requested = sg_dma_len(sg); }