mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 08:40:53 +07:00
1727339590
The CLOCKSOURCE_OF_DECLARE macro is used widely for the timers to declare the clocksource at early stage. However, this macro is also used to initialize the clockevent if any, or the clockevent only. It was originally suggested to declare another macro to initialize a clockevent, so in order to separate the two entities even they belong to the same IP. This was not accepted because of the impact on the DT where splitting a clocksource/clockevent definition does not make sense as it is a Linux concept not a hardware description. On the other side, the clocksource has not interrupt declared while the clockevent has, so it is easy from the driver to know if the description is for a clockevent or a clocksource, IOW it could be implemented at the driver level. So instead of dealing with a named clocksource macro, let's use a more generic one: TIMER_OF_DECLARE. The patch has not functional changes. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/*
|
|
* 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 u64 notrace versatile_sys_24mhz_read(void)
|
|
{
|
|
return readl(versatile_sys_24mhz);
|
|
}
|
|
|
|
static int __init versatile_sched_clock_init(struct device_node *node)
|
|
{
|
|
void __iomem *base = of_iomap(node, 0);
|
|
|
|
if (!base)
|
|
return -ENXIO;
|
|
|
|
versatile_sys_24mhz = base + SYS_24MHZ;
|
|
|
|
sched_clock_register(versatile_sys_24mhz_read, 32, 24000000);
|
|
|
|
return 0;
|
|
}
|
|
TIMER_OF_DECLARE(vexpress, "arm,vexpress-sysreg",
|
|
versatile_sched_clock_init);
|
|
TIMER_OF_DECLARE(versatile, "arm,versatile-sysreg",
|
|
versatile_sched_clock_init);
|