From patchwork Mon Apr 28 17:57:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 29266 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0497820553 for ; Mon, 28 Apr 2014 18:01:37 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id hz1sf14007905pad.8 for ; Mon, 28 Apr 2014 11:01:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=oYhn9KApLLeX2zH8NGmgKfSvaYVm0BEbDWkfwVsWKPA=; b=cFOygxgRukCd6TihP4Gr/iI5FiBTXnkJQ/Qk/Eo3dVn6LGkHiVv11IdTBAOWZUo4vY 2fA66aIA9eXs6tJaGXKgjkW8DssNHAS/0Vh5nJgNrp9+d0M7cQhyypIZbSV1sCN1Kfm0 49EAfaaxxiHXEnTKUKw706cOXC1eDZ6FVvxBaLYE0e2eba5hLuG5+Up150U5RCYKozHo BunNDkNERwWPJibH6lHcCBoAfgJtfYVgGVne46rDgrJ2mt4ePDmkWc3vOk2mgYg0Mj+j orFyJJqHQxp6oyP6SvFpQDOHX9KYOYl2XHVA2cmnRX8LYyLfz8EaSA7M/L6yiE789Y0a WNFA== X-Gm-Message-State: ALoCoQlC9M+ZgE35xSHeat7L5UYb2AVrsVQuEyE5uRBJCAjH1biZTriXRAGwIFnHmpe8BofI8gT0 X-Received: by 10.66.222.129 with SMTP id qm1mr12235305pac.6.1398708097096; Mon, 28 Apr 2014 11:01:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.135 with SMTP id e7ls210340qga.70.gmail; Mon, 28 Apr 2014 11:01:36 -0700 (PDT) X-Received: by 10.220.10.2 with SMTP id n2mr4153130vcn.26.1398708096953; Mon, 28 Apr 2014 11:01:36 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id w19si3828155vcf.59.2014.04.28.11.01.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 11:01:36 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id hq16so6191916vcb.11 for ; Mon, 28 Apr 2014 11:01:36 -0700 (PDT) X-Received: by 10.52.65.132 with SMTP id x4mr2182177vds.36.1398708096847; Mon, 28 Apr 2014 11:01:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp136152vcb; Mon, 28 Apr 2014 11:01:36 -0700 (PDT) X-Received: by 10.140.101.99 with SMTP id t90mr4794727qge.115.1398708095989; Mon, 28 Apr 2014 11:01:35 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id m9si8294701qge.21.2014.04.28.11.01.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Apr 2014 11:01:35 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WepqE-0003zT-5g; Mon, 28 Apr 2014 17:59:46 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WeppD-00033J-Aa for linux-arm-kernel@lists.infradead.org; Mon, 28 Apr 2014 17:58:44 +0000 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.45]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 7B8F013FE91; Mon, 28 Apr 2014 12:58:10 -0500 (CDT) From: Pawel Moll To: Grant Likely , Rob Herring , Samuel Ortiz , Lee Jones , Arnd Bergmann , Greg Kroah-Hartman , Russell King Subject: [PATCH 06/10] clocksource: Sched clock source for Versatile Express Date: Mon, 28 Apr 2014 18:57:53 +0100 Message-Id: <1398707877-22596-7-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1398707877-22596-1-git-send-email-pawel.moll@arm.com> References: <1398707877-22596-1-git-send-email-pawel.moll@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140428_105843_464554_DAE4D50F X-CRM114-Status: GOOD ( 14.41 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Pawel Moll , Daniel Lezcano , linux-kernel@vger.kernel.org, arm@kernel.org, Thomas Gleixner , linux-arm-kernel@lists.infradead.org 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pawel.moll@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This patch adds a trival sched clock source using free running, 24MHz clocked counter present in the ARM Ltd. reference platforms (Versatile, RealView, Versatile Express) System Registers block. This code replaces the call in the VE machine code. Cc: Daniel Lezcano Cc: Thomas Gleixner Signed-off-by: Pawel Moll --- arch/arm/mach-vexpress/v2m.c | 2 -- drivers/clocksource/Kconfig | 11 +++++++++++ drivers/clocksource/Makefile | 1 + drivers/clocksource/versatile.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 drivers/clocksource/versatile.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 96918e1..2c27b02 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -191,3 +191,14 @@ config EM_TIMER_STI config CLKSRC_QCOM bool + +config CLKSRC_VERSATILE + bool "ARM Versatile (Express) reference platforms clock source" + depends on GENERIC_SCHED_CLOCK + select CLKSRC_OF + default y if MFD_VEXPRESS_SYSREG + help + This option enables clock source based on free running + counter available in the "System Registers" block of + ARM Versatile, RealView and Versatile Express reference + platforms. diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 98cb6c5..6f25bdf 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -39,3 +39,4 @@ 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_ARCH_KEYSTONE) += timer-keystone.o +obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o diff --git a/drivers/clocksource/versatile.c b/drivers/clocksource/versatile.c new file mode 100644 index 0000000..e4c50ad --- /dev/null +++ b/drivers/clocksource/versatile.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) 2014 ARM Limited + */ + +#include +#include +#include +#include + +#define SYS_24MHZ 0x05c + +static void __iomem *versatile_sys_24mhz; + +static u32 notrace versatile_sys_24mhz_read(void) +{ + return readl(versatile_sys_24mhz); +} + +static void __init versatile_sched_clock_init(struct device_node *node) +{ + void __iomem *base = of_iomap(node, 0); + + if (!base) + return; + + versatile_sys_24mhz = base + SYS_24MHZ; + + setup_sched_clock(versatile_sys_24mhz_read, 32, 24000000); +} +CLOCKSOURCE_OF_DECLARE(versatile, "arm,vexpress-sysreg", + versatile_sched_clock_init);