From patchwork Fri Apr 14 14:35:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 9681349 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 9145560386 for ; Fri, 14 Apr 2017 14:36:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 808E02862D for ; Fri, 14 Apr 2017 14:36:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7254E286B6; Fri, 14 Apr 2017 14:36:11 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E6CE2862D for ; Fri, 14 Apr 2017 14:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=nVU8oWWtaKYHbP6vDRqy3BRyI0LkMNwnfbAEzQqurx0=; b=XXCNO3FvTRVY6sb23IeeNTYK8p JEK5wC4Mgi5/KgCh63WssOktRs/EsMtbsdRJsqkxcDtd/rwuTXVy7OzN18ZPfF7MzA4c+s7SFSO4l E1yo3wDteMu/DjFgYo2C1qxMxX5NPj8waerq6UC9obrxlRv+zCoUt4kp+qsyKAZfV3cLdwRLeoJIV YqO1e7wh9j/j0PrS1dB5Cufu1JXxnkmtjZE/67oWtWTLE/oJTVEyRzDSeSItr6FfHV9XckJsurCgw YkrXfnqC0MDxri8bbQarY2vH5Cv3uWDNpgBtAdUp5KEPq1Lqcrk6gFsBHVciRzXGQ6PQD2FM7LHp8 34YBuNog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cz2KX-0007YT-92; Fri, 14 Apr 2017 14:36:09 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cz2KT-0007Wc-8f for linux-rockchip@lists.infradead.org; Fri, 14 Apr 2017 14:36:07 +0000 Received: by mail-lf0-x242.google.com with SMTP id r36so10248865lfi.0 for ; Fri, 14 Apr 2017 07:35:46 -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=8kQ0Kn0KhEMB7qFXqayxAeGS6InpZtnTNcdOh//YcYo=; b=asZDqhy56oOxq1iejXo2TNX2fhIL5IaUh9QzG1pLlbXfoH5BKvybnpGam1SFmVmJdk 0m5PhvKukavx5VVCITSEU26QOMWjaxuzSvIVwL+lMFS3VMcB7roXhAG6K6nplrjkkVV9 zAFS1LQKovoK3oFZ4dzskP8EC1GbUfWloklEJuCzgn3zhpIldjr+a9Cz3kuThJeTcEgq xku/iv4a5CglIrOCj7uJx81alcDnp3MfwGEZmTNdZibsWx6Ne5Y7c5qaib4GCiod5V7S OyqjTASDAVRKvmStLi/HXgPLtRretZ3pIfmQPvMcbuW0tTLrvmFDdRsK/Y3SAQkCcPOJ rbXA== 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=8kQ0Kn0KhEMB7qFXqayxAeGS6InpZtnTNcdOh//YcYo=; b=unEBFxJdJnS8ujaTtArAL2FcQA+kyd2pjd7V0f1cYQkphU9akIt94atOAn+RTN1wPg aFBtAQaVuUEle0jarNfv9OQ9AZUb0EdsFSatW9Yu7JJ2UNdNxoRTbWU42CZ/sm3QeFmI MrTiRruoMnDDHdcYYGuYPh2/cnmreDDy1CGIGY6EZQpu04ZpcHsuHGeE3CLK5hoR2Qk0 T7r3XM/QxNNWWpoRpeN0+7WRvnUSxtocviC/IT0wILR47kdXCWfXYibZxNCCni5ZOZSR Nx2/JolQFxyczBfKBDEp3IgiLkefdvYb9pG70eHPPf4isNg7WzDoJmsxfbX9FhXkUsxe j2Rg== X-Gm-Message-State: AN3rC/4XfVpcRiLzoT7WppGXdumrWAXhATAP/71H0kul6ZX7XsIzx0uV jDcBUWZpca6pEQ== X-Received: by 10.25.168.15 with SMTP id r15mr2762852lfe.70.1492180544815; Fri, 14 Apr 2017 07:35:44 -0700 (PDT) Received: from ubuntu.lintech.local ([185.35.119.87]) by smtp.gmail.com with ESMTPSA id e124sm419315lfg.8.2017.04.14.07.35.43 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Apr 2017 07:35:44 -0700 (PDT) From: Alexander Kochetkov To: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, hhb@rock-chips.com, shawn.lin@rock-chips.com, caesar.wang@rock-chips.com, sugar.zhang@rock-chips.com, ulysses.huang@rock-chips.com Subject: [PATCH 2/2] dmaengine: pl330: don't emit code for one iteration loop Date: Fri, 14 Apr 2017 17:35:30 +0300 Message-Id: <1492180531-1780-3-git-send-email-al.kochet@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1492180531-1780-1-git-send-email-al.kochet@gmail.com> References: <1492180531-1780-1-git-send-email-al.kochet@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170414_073605_490820_101FE567 X-CRM114-Status: GOOD ( 10.36 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Kochetkov 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 The patch remove one iteration outer loop in the _loop(). Removing loop saves 4 bytes of MicroCode buffer. This savings make sense for free-running cyclic transfer implementation. DMALP_0 0 ... DMALPENDA_0 bjmpto_9 Signed-off-by: Alexander Kochetkov --- drivers/dma/pl330.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 56a2377..6126dde 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1268,7 +1268,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], lpend.bjump = 0; szlpend = _emit_LPEND(1, buf, &lpend); - if (lcnt0) { + if (lcnt0 > 1) { szlp *= 2; szlpend *= 2; } @@ -1284,7 +1284,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], off = 0; - if (lcnt0) { + if (lcnt0 > 1) { off += _emit_LP(dry_run, &buf[off], 0, lcnt0); ljmp0 = off; } @@ -1300,7 +1300,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], lpend.bjump = off - ljmp1; off += _emit_LPEND(dry_run, &buf[off], &lpend); - if (lcnt0) { + if (lcnt0 > 1) { lpend.cond = ALWAYS; lpend.forever = false; lpend.loop = 0; @@ -1309,7 +1309,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], } *bursts = lcnt1 * cyc; - if (lcnt0) + if (lcnt0 > 1) *bursts *= lcnt0; return off;