From patchwork Wed Mar 21 12:58:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 888813 X-Patchwork-Delegate: alexey.brodkin@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 405qpB0bfTz9s0w for ; Thu, 22 Mar 2018 00:07:13 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8A737C21EA7; Wed, 21 Mar 2018 13:01:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 997C8C21DAF; Wed, 21 Mar 2018 12:59:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 20CB8C21DAF; Wed, 21 Mar 2018 12:59:30 +0000 (UTC) Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by lists.denx.de (Postfix) with ESMTPS id 8AF0AC21E88 for ; Wed, 21 Mar 2018 12:59:26 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 428F310C0F1F for ; Wed, 21 Mar 2018 05:59:25 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 2BEEC3357; Wed, 21 Mar 2018 05:59:25 -0700 (PDT) Received: from paltsev-e7480.internal.synopsys.com (unknown [10.121.8.67]) by mailhost.synopsys.com (Postfix) with ESMTP id DE2BE334E; Wed, 21 Mar 2018 05:59:23 -0700 (PDT) From: Eugeniy Paltsev To: uboot-snps-arc@synopsys.com Date: Wed, 21 Mar 2018 15:58:55 +0300 Message-Id: <20180321125905.14897-11-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180321125905.14897-1-Eugeniy.Paltsev@synopsys.com> References: <20180321125905.14897-1-Eugeniy.Paltsev@synopsys.com> Cc: u-boot@lists.denx.de, Alexey Brodkin , Eugeniy Paltsev Subject: [U-Boot] [PATCH v2 10/20] ARC: cache: move slc status check into slc_entire_op and slc_rgn_op X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" As of today we check slc status before each call of __slc_rgn_op or __slc_entire_op. So move status check into __slc_rgn_op and __slc_entire_op. As we need to check status before *each* function call and we slc_entire_op and slc_rgn_op functions from different places we add this check directly into slc entire/line functions instead of their callers to avoid code duplication. Signed-off-by: Eugeniy Paltsev --- arch/arc/lib/cache.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c index 354dbc600e..f147674ae8 100644 --- a/arch/arc/lib/cache.c +++ b/arch/arc/lib/cache.c @@ -141,6 +141,9 @@ static void __slc_entire_op(const int op) { unsigned int ctrl; + if (!slc_exists) + return; + ctrl = read_aux_reg(ARC_AUX_SLC_CTRL); if (!(op & OP_FLUSH)) /* i.e. OP_INV */ @@ -179,6 +182,9 @@ static void __slc_rgn_op(unsigned long paddr, unsigned long sz, const int op) unsigned int ctrl; unsigned long end; + if (!slc_exists) + return; + /* * The Region Flush operation is specified by CTRL.RGN_OP[11..9] * - b'000 (default) is Flush, @@ -366,7 +372,7 @@ void invalidate_icache_all(void) { __ic_entire_invalidate(); - if (is_isa_arcv2() && slc_exists) + if (is_isa_arcv2()) __slc_entire_op(OP_INV); } @@ -487,7 +493,7 @@ void invalidate_dcache_range(unsigned long start, unsigned long end) if (!is_isa_arcv2() || !ioc_exists) __dc_line_op(start, end - start, OP_INV); - if (is_isa_arcv2() && slc_exists && !ioc_exists) + if (is_isa_arcv2() && !ioc_exists) __slc_rgn_op(start, end - start, OP_INV); } @@ -504,7 +510,7 @@ void flush_dcache_range(unsigned long start, unsigned long end) if (!is_isa_arcv2() || !ioc_exists) __dc_line_op(start, end - start, OP_FLUSH); - if (is_isa_arcv2() && slc_exists && !ioc_exists) + if (is_isa_arcv2() && !ioc_exists) __slc_rgn_op(start, end - start, OP_FLUSH); } @@ -523,7 +529,7 @@ void flush_n_invalidate_dcache_all(void) { __dc_entire_op(OP_FLUSH_N_INV); - if (is_isa_arcv2() && slc_exists) + if (is_isa_arcv2()) __slc_entire_op(OP_FLUSH_N_INV); } @@ -531,6 +537,6 @@ void flush_dcache_all(void) { __dc_entire_op(OP_FLUSH); - if (is_isa_arcv2() && slc_exists) + if (is_isa_arcv2()) __slc_entire_op(OP_FLUSH); }