mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 05:34:00 +08:00
387904ff84
Export the function gic_get_count_width to read the width of the GIC global counter from GIC_SH_CONFIG. Update the GIC clocksource driver to use this new function. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Qais Yousef <qais.yousef@imgtec.com> Cc: John Crispin <blogic@openwrt.org> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/8124/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
34 lines
851 B
C
34 lines
851 B
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/time.h>
|
|
|
|
#include <asm/gic.h>
|
|
|
|
static cycle_t gic_hpt_read(struct clocksource *cs)
|
|
{
|
|
return gic_read_count();
|
|
}
|
|
|
|
static struct clocksource gic_clocksource = {
|
|
.name = "GIC",
|
|
.read = gic_hpt_read,
|
|
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
|
};
|
|
|
|
void __init gic_clocksource_init(unsigned int frequency)
|
|
{
|
|
/* Set clocksource mask. */
|
|
gic_clocksource.mask = CLOCKSOURCE_MASK(gic_get_count_width());
|
|
|
|
/* Calculate a somewhat reasonable rating value. */
|
|
gic_clocksource.rating = 200 + frequency / 10000000;
|
|
|
|
clocksource_register_hz(&gic_clocksource, frequency);
|
|
}
|