diff options
Diffstat (limited to 'arch/mips/kernel/irq-gic.c')
-rw-r--r-- | arch/mips/kernel/irq-gic.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c index 485e6a961b31..c01b307317a9 100644 --- a/arch/mips/kernel/irq-gic.c +++ b/arch/mips/kernel/irq-gic.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
13 | #include <linux/clocksource.h> | ||
13 | 14 | ||
14 | #include <asm/io.h> | 15 | #include <asm/io.h> |
15 | #include <asm/gic.h> | 16 | #include <asm/gic.h> |
@@ -19,6 +20,8 @@ | |||
19 | #include <linux/hardirq.h> | 20 | #include <linux/hardirq.h> |
20 | #include <asm-generic/bitops/find.h> | 21 | #include <asm-generic/bitops/find.h> |
21 | 22 | ||
23 | unsigned int gic_frequency; | ||
24 | unsigned int gic_present; | ||
22 | unsigned long _gic_base; | 25 | unsigned long _gic_base; |
23 | unsigned int gic_irq_base; | 26 | unsigned int gic_irq_base; |
24 | unsigned int gic_irq_flags[GIC_NUM_INTRS]; | 27 | unsigned int gic_irq_flags[GIC_NUM_INTRS]; |
@@ -30,6 +33,39 @@ static struct gic_pcpu_mask pcpu_masks[NR_CPUS]; | |||
30 | static struct gic_pending_regs pending_regs[NR_CPUS]; | 33 | static struct gic_pending_regs pending_regs[NR_CPUS]; |
31 | static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; | 34 | static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; |
32 | 35 | ||
36 | #if defined(CONFIG_CSRC_GIC) || defined(CONFIG_CEVT_GIC) | ||
37 | cycle_t gic_read_count(void) | ||
38 | { | ||
39 | unsigned int hi, hi2, lo; | ||
40 | |||
41 | do { | ||
42 | GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_63_32), hi); | ||
43 | GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_31_00), lo); | ||
44 | GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_63_32), hi2); | ||
45 | } while (hi2 != hi); | ||
46 | |||
47 | return (((cycle_t) hi) << 32) + lo; | ||
48 | } | ||
49 | |||
50 | void gic_write_compare(cycle_t cnt) | ||
51 | { | ||
52 | GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI), | ||
53 | (int)(cnt >> 32)); | ||
54 | GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_LO), | ||
55 | (int)(cnt & 0xffffffff)); | ||
56 | } | ||
57 | |||
58 | cycle_t gic_read_compare(void) | ||
59 | { | ||
60 | unsigned int hi, lo; | ||
61 | |||
62 | GICREAD(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI), hi); | ||
63 | GICREAD(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_LO), lo); | ||
64 | |||
65 | return (((cycle_t) hi) << 32) + lo; | ||
66 | } | ||
67 | #endif | ||
68 | |||
33 | unsigned int gic_get_timer_pending(void) | 69 | unsigned int gic_get_timer_pending(void) |
34 | { | 70 | { |
35 | unsigned int vpe_pending; | 71 | unsigned int vpe_pending; |
@@ -116,6 +152,17 @@ static void __init vpe_local_setup(unsigned int numvpes) | |||
116 | } | 152 | } |
117 | } | 153 | } |
118 | 154 | ||
155 | unsigned int gic_compare_int(void) | ||
156 | { | ||
157 | unsigned int pending; | ||
158 | |||
159 | GICREAD(GIC_REG(VPE_LOCAL, GIC_VPE_PEND), pending); | ||
160 | if (pending & GIC_VPE_PEND_CMP_MSK) | ||
161 | return 1; | ||
162 | else | ||
163 | return 0; | ||
164 | } | ||
165 | |||
119 | unsigned int gic_get_int(void) | 166 | unsigned int gic_get_int(void) |
120 | { | 167 | { |
121 | unsigned int i; | 168 | unsigned int i; |