diff options
| author | Steven J. Hill <Steven.Hill@imgtec.com> | 2013-04-10 17:28:36 -0400 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-09 11:55:20 -0400 |
| commit | dfa762e1c31c30607e4e5259f287dd3e174cbcc3 (patch) | |
| tree | b23b7335ac92646a29df85c897b5f4783944dc5b /arch/mips/kernel | |
| parent | 28ea215186d365408756577e9e612ee334e26f8e (diff) | |
MIPS: Refactor GIC clocksource code.
Reorganize some of the GIC clocksource driver code. Below is a list of
the various changes.
* No longer select CSRC_GIC by default for Malta platform.
* Limit choice for either the GIC or R4K clocksource, not both.
* Change location in Makefile.
* Created new 'gic_read_count' function in common 'irq-gic.c' file.
* Change 'git_hpt_read' function in 'csrc-gic.c' to use new function.
* Surround GIC specific code in Malta platform code with #ifdef's.
* Only initialize the GIC clocksource if it was selected. Original
code called it unconditionally if a GIC was found.
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Diffstat (limited to 'arch/mips/kernel')
| -rw-r--r-- | arch/mips/kernel/Makefile | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/csrc-gic.c | 13 | ||||
| -rw-r--r-- | arch/mips/kernel/irq-gic.c | 16 |
3 files changed, 19 insertions, 12 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index de75fb50562b..bab8b16706ca 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
| @@ -23,11 +23,11 @@ obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o | |||
| 23 | obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o | 23 | obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o |
| 24 | obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o | 24 | obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o |
| 25 | obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o | 25 | obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o |
| 26 | obj-$(CONFIG_CSRC_GIC) += csrc-gic.o | ||
| 26 | obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o | 27 | obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o |
| 27 | obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o | 28 | obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o |
| 28 | obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o | 29 | obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o |
| 29 | obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o | 30 | obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o |
| 30 | obj-$(CONFIG_CSRC_GIC) += csrc-gic.o | ||
| 31 | obj-$(CONFIG_SYNC_R4K) += sync-r4k.o | 31 | obj-$(CONFIG_SYNC_R4K) += sync-r4k.o |
| 32 | 32 | ||
| 33 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 33 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
diff --git a/arch/mips/kernel/csrc-gic.c b/arch/mips/kernel/csrc-gic.c index 5dca24bce51b..e02620901117 100644 --- a/arch/mips/kernel/csrc-gic.c +++ b/arch/mips/kernel/csrc-gic.c | |||
| @@ -5,23 +5,14 @@ | |||
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
| 7 | */ | 7 | */ |
| 8 | #include <linux/clocksource.h> | ||
| 9 | #include <linux/init.h> | 8 | #include <linux/init.h> |
| 9 | #include <linux/time.h> | ||
| 10 | 10 | ||
| 11 | #include <asm/time.h> | ||
| 12 | #include <asm/gic.h> | 11 | #include <asm/gic.h> |
| 13 | 12 | ||
| 14 | static cycle_t gic_hpt_read(struct clocksource *cs) | 13 | static cycle_t gic_hpt_read(struct clocksource *cs) |
| 15 | { | 14 | { |
| 16 | unsigned int hi, hi2, lo; | 15 | return gic_read_count(); |
| 17 | |||
| 18 | do { | ||
| 19 | GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_63_32), hi); | ||
| 20 | GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_31_00), lo); | ||
| 21 | GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_63_32), hi2); | ||
| 22 | } while (hi2 != hi); | ||
| 23 | |||
| 24 | return (((cycle_t) hi) << 32) + lo; | ||
| 25 | } | 16 | } |
| 26 | 17 | ||
| 27 | static struct clocksource gic_clocksource = { | 18 | static struct clocksource gic_clocksource = { |
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c index eaf7c1eb873e..6a476e1d41eb 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> |
| @@ -32,6 +33,21 @@ static struct gic_pcpu_mask pcpu_masks[NR_CPUS]; | |||
| 32 | static struct gic_pending_regs pending_regs[NR_CPUS]; | 33 | static struct gic_pending_regs pending_regs[NR_CPUS]; |
| 33 | static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; | 34 | static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; |
| 34 | 35 | ||
| 36 | #ifdef CONFIG_CSRC_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 | #endif | ||
| 50 | |||
| 35 | unsigned int gic_get_timer_pending(void) | 51 | unsigned int gic_get_timer_pending(void) |
| 36 | { | 52 | { |
| 37 | unsigned int vpe_pending; | 53 | unsigned int vpe_pending; |
