From patchwork Fri Aug 5 02:53:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9264755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F13FF6048B for ; Fri, 5 Aug 2016 02:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6425283FB for ; Fri, 5 Aug 2016 02:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAFBC28425; Fri, 5 Aug 2016 02:58:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id E6835283FB for ; Fri, 5 Aug 2016 02:58:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bVVL6-0005x3-BQ; Fri, 05 Aug 2016 02:58:24 +0000 Received: from lucky1.263xmail.com ([211.157.147.130]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bVVKP-0005eO-00; Fri, 05 Aug 2016 02:57:42 +0000 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.236]) by lucky1.263xmail.com (Postfix) with SMTP id 37D561EE662; Fri, 5 Aug 2016 10:57:17 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id BCE63334D; Fri, 5 Aug 2016 10:57:11 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: vinod.koul@intel.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 22063BK7BAB; Fri, 05 Aug 2016 10:57:17 +0800 (CST) From: Shawn Lin To: Vinod Koul Subject: [PATCH 2/3] dmaengine: pl330: enable burst mode by parsing dt Date: Fri, 5 Aug 2016 10:53:21 +0800 Message-Id: <1470365602-32586-3-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1470365602-32586-1-git-send-email-shawn.lin@rock-chips.com> References: <1470365602-32586-1-git-send-email-shawn.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160804_195741_425917_02B07030 X-CRM114-Status: GOOD ( 11.52 ) 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: devicetree@vger.kernel.org, Xing Zheng , Huibin Hong , Shawn Lin , briannorris@chromium.org, dianders@chromium.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Rob Herring , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently pl330 use single mode defaultly. But burst mode can improve efficiency of memory accessing. We couldn't enable it by defalut in case of breaking any Socs which don't support it. With burst mode supported, we could see the improvement significantly when tesing SPI transfer etc. default single mode [ 88.292550] spi write 65536*1 cost 32402us speed:2022KB/S After applied with burst mode(len 16) [ 17.625296] spi write 65536*1 cost 17830us speed:3675KB/S Cc: Huibin Hong Cc: Xing Zheng Signed-off-by: Shawn Lin Tested-by: Xing Zheng --- drivers/dma/pl330.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 4fc3ffb..a09bf22 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -491,6 +491,8 @@ struct pl330_dmac { /* Peripheral channels connected to this DMAC */ unsigned int num_peripherals; struct dma_pl330_chan *peripherals; /* keep at end */ + /* set peripherals request type according to soc config */ + enum pl330_cond peripherals_req_type; int quirks; }; @@ -1156,12 +1158,7 @@ static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run, int cyc) { int off = 0; - enum pl330_cond cond; - - if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) - cond = BURST; - else - cond = SINGLE; + enum pl330_cond cond = pl330->peripherals_req_type; while (cyc--) { off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); @@ -1181,12 +1178,7 @@ static inline int _ldst_memtodev(struct pl330_dmac *pl330, const struct _xfer_spec *pxs, int cyc) { int off = 0; - enum pl330_cond cond; - - if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) - cond = BURST; - else - cond = SINGLE; + enum pl330_cond cond = pl330->peripherals_req_type; while (cyc--) { off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); @@ -2597,7 +2589,12 @@ 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; + + if (pl330->peripherals_req_type == BURST) + desc->rqcfg.brst_len = pch->burst_len; + else + desc->rqcfg.brst_len = 1; + desc->bytes_requested = period_len; fill_px(&desc->px, dst, src, period_len); @@ -2742,7 +2739,12 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, } desc->rqcfg.brst_size = pch->burst_sz; - desc->rqcfg.brst_len = 1; + + if (pch->dmac->peripherals_req_type == BURST) + desc->rqcfg.brst_len = pch->burst_len; + else + desc->rqcfg.brst_len = 1; + desc->rqtype = direction; desc->bytes_requested = sg_dma_len(sg); } @@ -2836,6 +2838,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pl330->mcbufsz = pdat ? pdat->mcbuf_sz : 0; + if (of_find_property(np, "arm,pl330-periph-burst", NULL)) + pl330->peripherals_req_type = BURST; + else + pl330->peripherals_req_type = SINGLE; + /* get quirk */ for (i = 0; i < ARRAY_SIZE(of_quirks); i++) if (of_property_read_bool(np, of_quirks[i].quirk))