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: 24485 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3449D203F3 for ; Tue, 11 Feb 2014 17:15:14 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 142sf23706544ykq.0 for ; Tue, 11 Feb 2014 09:15:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=uFNstZNaIVmIeX6H0LuFVrjygaz1ko+J8KGZ5XzRhAo=; b=lt4gJuQJTbadhLHGmEgptJkxA38tQZqBP2UX8R8VdC9CVjW/YTRq2FzJLN8jdxs+d9 HLZtPwZ/ROOKpcmIfm71A/KzqIO4JbeWg5a5EXsEBm+nGnYoT54HoiF60lTcEGHKlpk5 g0b6aAXx/4hTstfSJ6LcKy4d4KhrDq1bZ3RGQrT3Z782s7ydvY0n+PGF3z0ReeZ+MUbp ZbyRa4yS5XcbuMYtPXThPPJvCtKiJsP6NGYq3Q+SvRFZqRwYVC2d3uUHO887kPnV0S0D 6cByFTiVoaVHjOCEv5HCs8DmjJhpIgCr6ZzsRecBz8IQqNAYBus06GNHCN2HSnflV5Ia l7lg== X-Gm-Message-State: ALoCoQl9Eez9Z+oRqyhdAisqHtJjntcHf+Dp77vnzW1GUOyyyymivDdbCqmnUfyTevF9Lkv1WNba X-Received: by 10.236.92.202 with SMTP id j50mr177686yhf.26.1392138913310; Tue, 11 Feb 2014 09:15:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.161 with SMTP id o30ls2436428qge.98.gmail; Tue, 11 Feb 2014 09:15:13 -0800 (PST) X-Received: by 10.221.55.133 with SMTP id vy5mr29192248vcb.17.1392138913190; Tue, 11 Feb 2014 09:15:13 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id i1si6144783vcl.81.2014.02.11.09.15.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Feb 2014 09:15:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id oy12so6352993veb.14 for ; Tue, 11 Feb 2014 09:15:12 -0800 (PST) X-Received: by 10.52.156.232 with SMTP id wh8mr24333511vdb.23.1392138911281; Tue, 11 Feb 2014 09:15:11 -0800 (PST) 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.174.196 with SMTP id u4csp262510vcz; Tue, 11 Feb 2014 09:15:10 -0800 (PST) X-Received: by 10.66.123.5 with SMTP id lw5mr34078089pab.83.1392138910272; Tue, 11 Feb 2014 09:15:10 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ui8si19643790pac.148.2014.02.11.09.15.09 for ; Tue, 11 Feb 2014 09:15:10 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753002AbaBKRO4 (ORCPT + 27 others); Tue, 11 Feb 2014 12:14:56 -0500 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:25300 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752047AbaBKRKs (ORCPT ); Tue, 11 Feb 2014 12:10:48 -0500 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 Cc: Pawel Moll , Daniel Lezcano , Thomas Gleixner 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);