From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/12] clocksource: Sched clock source for Versatile Express
Date: Wed, 16 Apr 2014 08:56:45 -0500 [thread overview]
Message-ID: <CAL_JsqLiFE_D+PSFg62sVm3wO0uvZT+pwAVyn7Lwn2ma3+3DoA@mail.gmail.com> (raw)
In-Reply-To: <1392138636-29240-5-git-send-email-pawel.moll@arm.com>
Adding Linus W...
On Tue, Feb 11, 2014 at 11:10 AM, Pawel Moll <pawel.moll@arm.com> wrote:
> 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 <daniel.lezcano@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---
> 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
But you don't really depend on this...
> + depends on GENERIC_SCHED_CLOCK
I think this should be a select, not a depends.
> + 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
Did you write this last year?
> + */
> +
> +#include <linux/clocksource.h>
> +#include <linux/io.h>
> +#include <linux/of_address.h>
> +#include <linux/sched_clock.h>
> +
> +#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);
This frequency should come from a DT clock binding. You will have to
fallback to 24MHz for backwards compatibility though.
> +}
Wouldn't this code work for Versatile and Realview ARM reference
boards? Even the register offset is the same.
> +CLOCKSOURCE_OF_DECLARE(vexpress, "arm,vexpress-sysreg",
> + vexpress_sched_clock_init);
> --
> 1.8.3.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2014-04-16 13:56 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 17:10 [PATCH 00/12] Versatile Express updates Pawel Moll
2014-02-11 17:10 ` [PATCH 01/12] misc: vexpress-syscfg: Add udelay-based delay Pawel Moll
2014-02-15 19:19 ` Greg Kroah-Hartman
2014-02-11 17:10 ` [PATCH 02/12] power/reset: vexpress: Use udelay instead of timers Pawel Moll
2014-02-11 20:59 ` Arnd Bergmann
2014-02-12 11:56 ` Pawel Moll
2014-02-11 17:10 ` [PATCH 03/12] clk: versatile: Split config options for sp810 and vexpress_osc Pawel Moll
2014-02-11 17:10 ` [PATCH 04/12] clocksource: Sched clock source for Versatile Express Pawel Moll
2014-04-16 13:56 ` Rob Herring [this message]
2014-04-16 14:22 ` Pawel Moll
2014-04-16 14:45 ` Rob Herring
2014-04-16 15:05 ` Pawel Moll
2014-05-02 22:14 ` Linus Walleij
2014-05-07 9:57 ` Pawel Moll
2014-05-13 8:47 ` Linus Walleij
2014-02-11 17:10 ` [PATCH 05/12] GPIO: gpio-generic: Add label to platform data Pawel Moll
2014-02-11 17:17 ` Lee Jones
2014-02-11 17:20 ` Pawel Moll
2014-02-11 17:29 ` Pawel Moll
2014-02-11 17:46 ` Lee Jones
2014-02-11 17:10 ` [PATCH 06/12] mfd: vexpress-sysreg: Add labels to gpio banks Pawel Moll
2014-02-11 17:19 ` Lee Jones
2014-02-13 13:08 ` Linus Walleij
2014-02-13 13:11 ` Pawel Moll
2014-02-11 17:10 ` [PATCH 07/12] mfd: syscon: Consider platform data a regmap config name Pawel Moll
2014-02-11 17:24 ` Lee Jones
2014-02-12 7:09 ` Alexander Shiyan
2014-02-12 8:26 ` Lee Jones
2014-02-12 11:06 ` Pawel Moll
2014-02-12 11:18 ` Lee Jones
2014-02-12 11:27 ` Alexander Shiyan
2014-02-12 11:43 ` Pawel Moll
2014-02-11 17:10 ` [PATCH 08/12] mfd: vexpress-sysreg: Add syscon labels as platform data Pawel Moll
2014-02-11 17:29 ` Lee Jones
2014-02-11 17:32 ` Pawel Moll
2014-02-11 17:48 ` Lee Jones
2014-02-11 17:52 ` [PATCH v2 1/2] mfd: syscon: Add platform data with a regmap config name Pawel Moll
2014-02-11 17:52 ` [PATCH v2 2/2] mfd: vexpress-sysreg: Add syscon labels as platform data Pawel Moll
2014-02-12 11:20 ` Lee Jones
2014-02-11 17:55 ` [PATCH v2 1/2] mfd: syscon: Add platform data with a regmap config name Pawel Moll
2014-02-12 11:19 ` Lee Jones
2014-02-11 17:10 ` [PATCH 09/12] hwmon: vexpress: Use devm helper for hwmon device registration Pawel Moll
2014-02-11 20:57 ` Arnd Bergmann
2014-02-11 17:10 ` [PATCH 10/12] ARM: vexpress: remove redundant vexpress_dt_cpus_num to get cpu count Pawel Moll
2014-02-11 17:10 ` [PATCH 11/12] ARM: vexpress: Simplify SMP operations for DT-powered system Pawel Moll
2014-02-11 17:10 ` [PATCH 12/12] ARM: vexpress: move HBI check to sysreg driver Pawel Moll
2014-02-11 19:28 ` [PATCH 00/12] Versatile Express updates Arnd Bergmann
2014-02-12 12:30 ` Pawel Moll
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAL_JsqLiFE_D+PSFg62sVm3wO0uvZT+pwAVyn7Lwn2ma3+3DoA@mail.gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).