From patchwork Tue Aug 30 13:59:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 74987 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp2164698qga; Tue, 30 Aug 2016 07:02:00 -0700 (PDT) X-Received: by 10.66.242.166 with SMTP id wr6mr6459256pac.147.1472565720515; Tue, 30 Aug 2016 07:02:00 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id f17si45308273pag.32.2016.08.30.07.02.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2016 07:02:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org 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 1bejam-0001Uj-6H; Tue, 30 Aug 2016 14:00:44 +0000 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1beja7-0008SB-KD for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2016 14:00:07 +0000 Received: by mail-lf0-x233.google.com with SMTP id l89so14436304lfi.1 for ; Tue, 30 Aug 2016 06:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IoSAuf8yU64OcrWTIlIxx3dJdLcni9ytvoPvIuco4lM=; b=WknAOd9s7MTaFE9mFaR63tJliY918ndpXdKjFEiUKBp/rdT1f15w+JjdIW3rBjIwJw Mtc89qqEmNyqmwW+tVQaekBrkCzhXvN4xNcZS/npPd47gW9RoWzE87ea5kQiB95/23L4 KrsdXEkxELwuoB0IZZC40w8OZO7hUmYjGSlwc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IoSAuf8yU64OcrWTIlIxx3dJdLcni9ytvoPvIuco4lM=; b=lTSdydvK/lbGoDuejpCo/jQG954/2vVgoZ88lUQtxi6SviejgzKweEu+QGuI69q01Q RVEQiyds1XBvzPW7JtgoAgdwimBiesSLRAaTi5KOj8omxc60ieW5nKLvoSiBlHEGhAcq MLrwI/BpNYgjx+9z55Zi5AnNNH2rDyId0V3kd+VuViwj4jK0aIl6DTAFtzrp/aSE/1rW V/fzlelu2cPfmu93nJqq/vmVrr2a+gQZBe5csHiJsITR5S48Ro3ktWBsEwNvhwxrdqwo Iho42fIZR2qX84zXCOs4hudUcTrwWeL33Z7+nx7togIBQoZtveoPJVKjWGLF0kCBJe7j 7zGw== X-Gm-Message-State: AE9vXwM5qwei/e2bBhFdKDMxaBkI6IyLeEJRKLOnZPYyjg1yqjyF/LcxGjpI0a+cDXc4MU/R X-Received: by 10.25.213.20 with SMTP id m20mr1230588lfg.61.1472565581336; Tue, 30 Aug 2016 06:59:41 -0700 (PDT) Received: from linuslaptop.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h22sm7573086lji.21.2016.08.30.06.59.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2016 06:59:40 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] ARM: integrator: read counter using syscon/regmap Date: Tue, 30 Aug 2016 15:59:29 +0200 Message-Id: <1472565569-11414-3-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472565569-11414-1-git-send-email-linus.walleij@linaro.org> References: <1472565569-11414-1-git-send-email-linus.walleij@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160830_070003_922083_F78E7518 X-CRM114-Status: GOOD ( 17.70 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:233 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Linus Walleij , Russell King , Arnd Bergmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Look up the core module base address from the device tree and register a sched_clock() using the regmap to the core module on the Integrator/CP. MFD_SYSCON is selected by the arch so it is always available. This further makes it possible to remove one more static map. Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/integrator_cp.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 8db029fa6052..772a7cf2010e 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include @@ -23,12 +25,15 @@ #include "cm.h" #include "common.h" +/* Base address to the core module header */ +static struct regmap *cm_map; /* Base address to the CP controller */ static void __iomem *intcp_con_base; +#define CM_COUNTER_OFFSET 0x28 + /* * Logical Physical - * f1000000 10000000 Core module registers * f1400000 14000000 Interrupt controller * f1600000 16000000 UART 0 * fca00000 ca000000 SIC @@ -36,11 +41,6 @@ static void __iomem *intcp_con_base; static struct map_desc intcp_io_desc[] __initdata __maybe_unused = { { - .virtual = IO_ADDRESS(INTEGRATOR_HDR_BASE), - .pfn = __phys_to_pfn(INTEGRATOR_HDR_BASE), - .length = SZ_4K, - .type = MT_DEVICE - }, { .virtual = IO_ADDRESS(INTEGRATOR_IC_BASE), .pfn = __phys_to_pfn(INTEGRATOR_IC_BASE), .length = SZ_4K, @@ -84,15 +84,20 @@ static struct mmci_platform_data mmc_data = { .gpio_cd = -1, }; -#define REFCOUNTER (__io_address(INTEGRATOR_HDR_BASE) + 0x28) - static u64 notrace intcp_read_sched_clock(void) { - return readl(REFCOUNTER); + unsigned int val; + + /* MMIO so discard return code */ + regmap_read(cm_map, CM_COUNTER_OFFSET, &val); + return val; } static void __init intcp_init_early(void) { + cm_map = syscon_regmap_lookup_by_compatible("arm,core-module-integrator"); + if (IS_ERR(cm_map)) + return; sched_clock_register(intcp_read_sched_clock, 32, 24000000); }