From patchwork Mon Jan 30 17:13:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 92887 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1539275qgi; Mon, 30 Jan 2017 09:16:19 -0800 (PST) X-Received: by 10.84.231.9 with SMTP id f9mr33462950plk.28.1485796578976; Mon, 30 Jan 2017 09:16:18 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si8918151pgf.369.2017.01.30.09.16.18; Mon, 30 Jan 2017 09:16:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbdA3RPq (ORCPT + 25 others); Mon, 30 Jan 2017 12:15:46 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:19811 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751545AbdA3ROy (ORCPT ); Mon, 30 Jan 2017 12:14:54 -0500 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-11.nifty.com with ESMTP id v0UHDCDx019894; Tue, 31 Jan 2017 02:13:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com v0UHDCDx019894 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1485796396; bh=1D3st0tBmotyI8jWRd/8sGj2aTp5doMc4EpVq452MK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UD4QMZtwUmKshAkEu7Au1iE6XEruFCmRW+SgQd2zy0xQxXqLY1UUhX0FuE2eHp3z+ 9qNZ+lmeF6tuh0fPZnRDRkImOel5U7rvcTVRRE9qJPzAwhb4/ZTPKR28xWyDLvguV2 69Sbm1EnQpWyQcne8wMrznqcoba6qejygYgG9yemC8jKppLC0rjzidljyBCNjj4ZFH ISnu/LXOQgrqHcLThVOeGYAa0a99/0w1dWBWguD8dSiANxxe+ZZ6pMzTlTeKY+NVyp QN0CKYMZjm9RThxh9uJBuG5IeVLwY3WNpNpO7jsQMq+zIQacfBhutCQSsCUoquYMBv IMudSqF2v6hxg== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org Cc: Masahiro Yamada , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] ARM: cache-uniphier: clean up active way setup code Date: Tue, 31 Jan 2017 02:13:05 +0900 Message-Id: <1485796385-22000-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485796385-22000-1-git-send-email-yamada.masahiro@socionext.com> References: <1485796385-22000-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now, the active way setup function is called with a fixed value zero for the second argument. The code can be simpler. Signed-off-by: Masahiro Yamada --- KernelVersion: 4.10-rc1 arch/arm/mm/cache-uniphier.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/arch/arm/mm/cache-uniphier.c b/arch/arm/mm/cache-uniphier.c index dfe97b4..f57b080 100644 --- a/arch/arm/mm/cache-uniphier.c +++ b/arch/arm/mm/cache-uniphier.c @@ -15,6 +15,7 @@ #define pr_fmt(fmt) "uniphier: " fmt +#include #include #include #include @@ -71,8 +72,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 +83,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 +233,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 +302,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); } } @@ -382,8 +377,8 @@ static int __init __uniphier_cache_init(struct device_node *np, goto err; } - data->way_present_mask = - ((u32)1 << cache_size / data->nsets / data->line_size) - 1; + data->way_mask = GENMASK(cache_size / data->nsets / data->line_size - 1, + 0); data->ctrl_base = of_iomap(np, 0); if (!data->ctrl_base) {