Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 220e2a8d authored by Pawel Moll's avatar Pawel Moll
Browse files

clocksource: Sched clock source for Versatile Express



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.

Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 5ee2b877
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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);
}


+11 −0
Original line number Diff line number Diff line
@@ -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.
+1 −0
Original line number Diff line number Diff line
@@ -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
+40 −0
Original line number Diff line number Diff line
/*
 * 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 <linux/clocksource.h>
#include <linux/io.h>
#include <linux/of_address.h>
#include <linux/sched_clock.h>

#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);