|
@@ -0,0 +1,56 @@
|
|
|
+/*
|
|
|
+ * linux/arch/arm/kernel/arch_timer.c
|
|
|
+ *
|
|
|
+ * Copyright (C) 2011 ARM Ltd.
|
|
|
+ * All Rights Reserved
|
|
|
+ *
|
|
|
+ * 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.
|
|
|
+ */
|
|
|
+#include <linux/init.h>
|
|
|
+#include <linux/kernel.h>
|
|
|
+#include <linux/delay.h>
|
|
|
+#include <linux/device.h>
|
|
|
+#include <linux/smp.h>
|
|
|
+#include <linux/cpu.h>
|
|
|
+#include <linux/jiffies.h>
|
|
|
+#include <linux/clockchips.h>
|
|
|
+#include <linux/interrupt.h>
|
|
|
+#include <linux/of_irq.h>
|
|
|
+#include <linux/io.h>
|
|
|
+
|
|
|
+#include <asm/cputype.h>
|
|
|
+#include <asm/delay.h>
|
|
|
+#include <asm/localtimer.h>
|
|
|
+#include <asm/arch_timer.h>
|
|
|
+#include <asm/system_info.h>
|
|
|
+#include <asm/sched_clock.h>
|
|
|
+
|
|
|
+static unsigned long arch_timer_rate;
|
|
|
+
|
|
|
+enum ppi_nr {
|
|
|
+ PHYS_SECURE_PPI,
|
|
|
+ PHYS_NONSECURE_PPI,
|
|
|
+ VIRT_PPI,
|
|
|
+ HYP_PPI,
|
|
|
+ MAX_TIMER_PPI
|
|
|
+};
|
|
|
+
|
|
|
+static int arch_timer_ppi[MAX_TIMER_PPI];
|
|
|
+
|
|
|
+static struct clock_event_device __percpu **arch_timer_evt;
|
|
|
+static struct delay_timer arch_delay_timer;
|
|
|
+
|
|
|
+static bool arch_timer_use_virtual = true;
|
|
|
+
|
|
|
+/*
|
|
|
+ * Architected system timer support.
|
|
|
+ */
|
|
|
+
|
|
|
+#define ARCH_TIMER_CTRL_ENABLE (1 << 0)
|
|
|
+#define ARCH_TIMER_CTRL_IT_MASK (1 << 1)
|
|
|
+#define ARCH_TIMER_CTRL_IT_STAT (1 << 2)
|
|
|
+
|
|
|
+#define ARCH_TIMER_REG_CTRL 0
|
|
|
+#define ARCH_TIMER_REG_FREQ 1
|