From patchwork Fri Nov 4 11:43:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9412555 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 9804660722 for ; Fri, 4 Nov 2016 11:43:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 878F52ADC3 for ; Fri, 4 Nov 2016 11:43:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C5E92ADC8; Fri, 4 Nov 2016 11:43:40 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 891DB2ADC3 for ; Fri, 4 Nov 2016 11:43:39 +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 1c2csz-0007oL-Li; Fri, 04 Nov 2016 11:42:17 +0000 Received: from conuserg-12.nifty.com ([210.131.2.79]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c2csT-0007hT-Dw for linux-arm-kernel@lists.infradead.org; Fri, 04 Nov 2016 11:41:47 +0000 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id uA4Bf7HB017322; Fri, 4 Nov 2016 20:41:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com uA4Bf7HB017322 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1478259669; bh=eBl5d+7uX8RS9KMo0IdNProvZ054eOpJK6upmrg7RmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGYFZeSnifwAF5tYtGBugUAwOpL9NatTQpu5cAObGlJnzmCcw8QmyJaFF470lRVDL l04PLzRuzFZxC6WdMm1gM/HxHX6WhSb8VcLd0TUJDfOUQjq+gPaQZEfNIlB0ymm7YH goVJb2Iw9dbjDH1qloQWAe+a0K4fzBG15Rci36ReFoXFp8i2ol8+cHmWNscAdTvjuB FNThHjRAt/ojxSDGaP45neDEA+OjG2tOoQn4tFx5sGf+f7yS3W8zp+WMdMR3JKWUgu e+1ZgACWirUBav3ILqHFO1SVRbpn1dAy1knzgit3uXpScITiLanxMWpEOTswkkrXox xodSP7LKBAwOQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] ARM: cache-uniphier: clean up active way setup code Date: Fri, 4 Nov 2016 20:43:36 +0900 Message-Id: <1478259816-24965-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1478259816-24965-1-git-send-email-yamada.masahiro@socionext.com> References: <1478259816-24965-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161104_044145_893409_340FAC5B X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Russell King , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now, the active way setup function is called with a fixed value zero for the second argument only when enabling the outer-cache. The code can be simpler. Signed-off-by: Masahiro Yamada --- arch/arm/mm/cache-uniphier.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/arm/mm/cache-uniphier.c b/arch/arm/mm/cache-uniphier.c index c71ab7c..58ba2bd 100644 --- a/arch/arm/mm/cache-uniphier.c +++ b/arch/arm/mm/cache-uniphier.c @@ -71,8 +71,7 @@ * @ctrl_base: virtual base address of control registers * @rev_base: virtual base address of revision registers * @op_base: virtual base address of operation registers - * @way_present_mask: each bit specifies if the way is present - * @way_locked_mask: each bit specifies if the way is locked + * @way_mask: each bit specifies if the way is present * @nsets: number of associativity sets * @line_size: line size in bytes * @range_op_max_size: max size that can be handled by a single range operation @@ -83,8 +82,7 @@ struct uniphier_cache_data { void __iomem *rev_base; void __iomem *op_base; void __iomem *way_ctrl_base; - u32 way_present_mask; - u32 way_locked_mask; + u32 way_mask; u32 nsets; u32 line_size; u32 range_op_max_size; @@ -234,17 +232,13 @@ static void __uniphier_cache_enable(struct uniphier_cache_data *data, bool on) writel_relaxed(val, data->ctrl_base + UNIPHIER_SSCC); } -static void __init __uniphier_cache_set_locked_ways( - struct uniphier_cache_data *data, - u32 way_mask) +static void __init __uniphier_cache_set_active_ways( + struct uniphier_cache_data *data) { unsigned int cpu; - data->way_locked_mask = way_mask & data->way_present_mask; - for_each_possible_cpu(cpu) - writel_relaxed(~data->way_locked_mask & data->way_present_mask, - data->way_ctrl_base + 4 * cpu); + writel_relaxed(data->way_mask, data->way_ctrl_base + 4 * cpu); } static void uniphier_cache_maint_range(unsigned long start, unsigned long end, @@ -307,7 +301,7 @@ static void __init uniphier_cache_enable(void) list_for_each_entry(data, &uniphier_cache_list, list) { __uniphier_cache_enable(data, true); - __uniphier_cache_set_locked_ways(data, 0); + __uniphier_cache_set_active_ways(data); } } @@ -381,7 +375,7 @@ static int __init __uniphier_cache_init(struct device_node *np, data->line_size = line_size; data->nsets = nsets; - data->way_present_mask = ((u32)1 << cache_size / nsets / line_size) - 1; + data->way_mask = GENMASK(cache_size / nsets / line_size - 1, 0); data->ctrl_base = of_iomap(np, 0); if (!data->ctrl_base) {