2012-12-07 03:51:04 +00:00
|
|
|
/*
|
|
|
|
* 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>
|
2014-10-20 19:03:53 +00:00
|
|
|
#include <linux/irqchip/mips-gic.h>
|
2013-04-10 21:28:36 +00:00
|
|
|
#include <linux/time.h>
|
2012-12-07 03:51:04 +00:00
|
|
|
|
|
|
|
static cycle_t gic_hpt_read(struct clocksource *cs)
|
|
|
|
{
|
2013-04-10 21:28:36 +00:00
|
|
|
return gic_read_count();
|
2012-12-07 03:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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. */
|
2014-10-20 19:03:49 +00:00
|
|
|
gic_clocksource.mask = CLOCKSOURCE_MASK(gic_get_count_width());
|
2012-12-07 03:51:04 +00:00
|
|
|
|
|
|
|
/* Calculate a somewhat reasonable rating value. */
|
|
|
|
gic_clocksource.rating = 200 + frequency / 10000000;
|
|
|
|
|
|
|
|
clocksource_register_hz(&gic_clocksource, frequency);
|
|
|
|
}
|