From patchwork Tue Feb 11 17:10:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 3628541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A9C33BF418 for ; Tue, 11 Feb 2014 17:16:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4CDD20203 for ; Tue, 11 Feb 2014 17:16:44 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4507E2010E for ; Tue, 11 Feb 2014 17:16:43 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDGwn-0004mB-HN; Tue, 11 Feb 2014 17:16:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDGrv-0002S6-9T; Tue, 11 Feb 2014 17:11:35 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDGrR-0002Oa-Ny for linux-arm-kernel@lists.infradead.org; Tue, 11 Feb 2014 17:11:06 +0000 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.45]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 343E81401AF; Tue, 11 Feb 2014 11:10:47 -0600 (CST) From: Pawel Moll To: arm@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/12] clocksource: Sched clock source for Versatile Express Date: Tue, 11 Feb 2014 17:10:28 +0000 Message-Id: <1392138636-29240-5-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392138636-29240-1-git-send-email-pawel.moll@arm.com> References: <1392138636-29240-1-git-send-email-pawel.moll@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140211_121105_911986_D2394488 X-CRM114-Status: GOOD ( 15.03 ) X-Spam-Score: -2.5 (--) Cc: Thomas Gleixner , Daniel Lezcano , Pawel Moll X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a trival sched clock source using free running, 24MHz clocked counter present in the ARM Ltd. Versatile Express platform's System Registers block. This code replaces the call in the VE machine code. Cc: Daniel Lezcano Cc: Thomas Gleixner Signed-off-by: Pawel Moll Reviewed-by: Linus Walleij --- arch/arm/mach-vexpress/v2m.c | 2 -- drivers/clocksource/Kconfig | 9 +++++++++ drivers/clocksource/Makefile | 1 + drivers/clocksource/vexpress.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 drivers/clocksource/vexpress.c diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 90f04c9..d8a9fd7 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -418,8 +418,6 @@ void __init v2m_dt_init_early(void) pr_warning("vexpress: DT HBI (%x) is not matching " "hardware (%x)!\n", dt_hbi, hbi); } - - versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000); } diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index cd6950f..9799744 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -140,3 +140,12 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config CLKSRC_VEXPRESS + bool + depends on MFD_VEXPRESS_SYSREG + depends on GENERIC_SCHED_CLOCK + select CLKSRC_OF + default y + help + Simple provider of sched clock on ARM Versatile Express platform. diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index c7ca50a..1051a23 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -37,3 +37,4 @@ obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o +obj-$(CONFIG_CLKSRC_VEXPRESS) += vexpress.o diff --git a/drivers/clocksource/vexpress.c b/drivers/clocksource/vexpress.c new file mode 100644 index 0000000..55b8ab4 --- /dev/null +++ b/drivers/clocksource/vexpress.c @@ -0,0 +1,40 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Copyright (C) 2013 ARM Limited + */ + +#include +#include +#include +#include + +#define SYS_24MHZ 0x05c + +static void __iomem *vexpress_sys_24mhz; + +static u32 notrace vexpress_sys_24mhz_read(void) +{ + return readl(vexpress_sys_24mhz); +} + +static void __init vexpress_sched_clock_init(struct device_node *node) +{ + void __iomem *base = of_iomap(node, 0); + + if (!base) + return; + + vexpress_sys_24mhz = base + SYS_24MHZ; + + setup_sched_clock(vexpress_sys_24mhz_read, 32, 24000000); +} +CLOCKSOURCE_OF_DECLARE(vexpress, "arm,vexpress-sysreg", + vexpress_sched_clock_init);