diff options
| -rw-r--r-- | arch/mips/include/asm/gic.h | 20 | ||||
| -rw-r--r-- | arch/mips/kernel/irq-gic.c | 40 |
2 files changed, 26 insertions, 34 deletions
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h index 77207fa459a5..37620db588be 100644 --- a/arch/mips/include/asm/gic.h +++ b/arch/mips/include/asm/gic.h | |||
| @@ -33,13 +33,13 @@ | |||
| 33 | REG32(_gic_base + segment##_##SECTION_OFS + offset) | 33 | REG32(_gic_base + segment##_##SECTION_OFS + offset) |
| 34 | 34 | ||
| 35 | #define GIC_ABS_REG(segment, offset) \ | 35 | #define GIC_ABS_REG(segment, offset) \ |
| 36 | (_gic_base + segment##_##SECTION_OFS + offset##_##OFS) | 36 | (_gic_base + segment##_##SECTION_OFS + offset##_##OFS) |
| 37 | #define GIC_REG_ABS_ADDR(segment, offset) \ | 37 | #define GIC_REG_ABS_ADDR(segment, offset) \ |
| 38 | (_gic_base + segment##_##SECTION_OFS + offset) | 38 | (_gic_base + segment##_##SECTION_OFS + offset) |
| 39 | 39 | ||
| 40 | #ifdef GICISBYTELITTLEENDIAN | 40 | #ifdef GICISBYTELITTLEENDIAN |
| 41 | #define GICREAD(reg, data) (data) = (reg), (data) = le32_to_cpu(data) | 41 | #define GICREAD(reg, data) ((data) = (reg), (data) = le32_to_cpu(data)) |
| 42 | #define GICWRITE(reg, data) (reg) = cpu_to_le32(data) | 42 | #define GICWRITE(reg, data) ((reg) = cpu_to_le32(data)) |
| 43 | #define GICBIS(reg, bits) \ | 43 | #define GICBIS(reg, bits) \ |
| 44 | ({unsigned int data; \ | 44 | ({unsigned int data; \ |
| 45 | GICREAD(reg, data); \ | 45 | GICREAD(reg, data); \ |
| @@ -48,9 +48,9 @@ | |||
| 48 | }) | 48 | }) |
| 49 | 49 | ||
| 50 | #else | 50 | #else |
| 51 | #define GICREAD(reg, data) (data) = (reg) | 51 | #define GICREAD(reg, data) ((data) = (reg)) |
| 52 | #define GICWRITE(reg, data) (reg) = (data) | 52 | #define GICWRITE(reg, data) ((reg) = (data)) |
| 53 | #define GICBIS(reg, bits) (reg) |= (bits) | 53 | #define GICBIS(reg, bits) ((reg) |= (bits)) |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | 56 | ||
| @@ -304,15 +304,15 @@ | |||
| 304 | GIC_SH_MAP_TO_VPE_REG_BIT(vpe)) | 304 | GIC_SH_MAP_TO_VPE_REG_BIT(vpe)) |
| 305 | 305 | ||
| 306 | struct gic_pcpu_mask { | 306 | struct gic_pcpu_mask { |
| 307 | DECLARE_BITMAP(pcpu_mask, GIC_NUM_INTRS); | 307 | DECLARE_BITMAP(pcpu_mask, GIC_NUM_INTRS); |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | struct gic_pending_regs { | 310 | struct gic_pending_regs { |
| 311 | DECLARE_BITMAP(pending, GIC_NUM_INTRS); | 311 | DECLARE_BITMAP(pending, GIC_NUM_INTRS); |
| 312 | }; | 312 | }; |
| 313 | 313 | ||
| 314 | struct gic_intrmask_regs { | 314 | struct gic_intrmask_regs { |
| 315 | DECLARE_BITMAP(intrmask, GIC_NUM_INTRS); | 315 | DECLARE_BITMAP(intrmask, GIC_NUM_INTRS); |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | /* | 318 | /* |
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c index 18124c3bda2f..770c07552518 100644 --- a/arch/mips/kernel/irq-gic.c +++ b/arch/mips/kernel/irq-gic.c | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | #undef DEBUG | 1 | /* |
| 2 | 2 | * This file is subject to the terms and conditions of the GNU General Public | |
| 3 | * License. See the file "COPYING" in the main directory of this archive | ||
| 4 | * for more details. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2008 Ralf Baechle (ralf@linux-mips.org) | ||
| 7 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | ||
| 8 | */ | ||
| 3 | #include <linux/bitmap.h> | 9 | #include <linux/bitmap.h> |
| 4 | #include <linux/init.h> | 10 | #include <linux/init.h> |
| 5 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
| @@ -11,7 +17,6 @@ | |||
| 11 | #include <linux/hardirq.h> | 17 | #include <linux/hardirq.h> |
| 12 | #include <asm-generic/bitops/find.h> | 18 | #include <asm-generic/bitops/find.h> |
| 13 | 19 | ||
| 14 | |||
| 15 | unsigned long _gic_base; | 20 | unsigned long _gic_base; |
| 16 | unsigned int gic_irq_base; | 21 | unsigned int gic_irq_base; |
| 17 | unsigned int gic_irq_flags[GIC_NUM_INTRS]; | 22 | unsigned int gic_irq_flags[GIC_NUM_INTRS]; |
| @@ -22,17 +27,15 @@ static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; | |||
| 22 | 27 | ||
| 23 | void gic_send_ipi(unsigned int intr) | 28 | void gic_send_ipi(unsigned int intr) |
| 24 | { | 29 | { |
| 25 | pr_debug("CPU%d: %s status %08x\n", smp_processor_id(), __func__, | ||
| 26 | read_c0_status()); | ||
| 27 | GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), 0x80000000 | intr); | 30 | GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), 0x80000000 | intr); |
| 28 | } | 31 | } |
| 29 | 32 | ||
| 30 | /* This is Malta specific and needs to be exported */ | ||
| 31 | static void __init vpe_local_setup(unsigned int numvpes) | 33 | static void __init vpe_local_setup(unsigned int numvpes) |
| 32 | { | 34 | { |
| 33 | int i; | 35 | unsigned long timer_interrupt = GIC_INT_TMR; |
| 34 | unsigned long timer_interrupt = 5, perf_interrupt = 5; | 36 | unsigned long perf_interrupt = GIC_INT_PERFCTR; |
| 35 | unsigned int vpe_ctl; | 37 | unsigned int vpe_ctl; |
| 38 | int i; | ||
| 36 | 39 | ||
| 37 | /* | 40 | /* |
| 38 | * Setup the default performance counter timer interrupts | 41 | * Setup the default performance counter timer interrupts |
| @@ -79,40 +82,30 @@ unsigned int gic_get_int(void) | |||
| 79 | bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS); | 82 | bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS); |
| 80 | bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS); | 83 | bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS); |
| 81 | 84 | ||
| 82 | i = find_first_bit(pending, GIC_NUM_INTRS); | 85 | return find_first_bit(pending, GIC_NUM_INTRS); |
| 83 | |||
| 84 | pr_debug("CPU%d: %s pend=%d\n", smp_processor_id(), __func__, i); | ||
| 85 | |||
| 86 | return i; | ||
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | static void gic_mask_irq(struct irq_data *d) | 88 | static void gic_mask_irq(struct irq_data *d) |
| 90 | { | 89 | { |
| 91 | unsigned int irq = d->irq - gic_irq_base; | 90 | GIC_CLR_INTR_MASK(d->irq - gic_irq_base); |
| 92 | pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); | ||
| 93 | GIC_CLR_INTR_MASK(irq); | ||
| 94 | } | 91 | } |
| 95 | 92 | ||
| 96 | static void gic_unmask_irq(struct irq_data *d) | 93 | static void gic_unmask_irq(struct irq_data *d) |
| 97 | { | 94 | { |
| 98 | unsigned int irq = d->irq - gic_irq_base; | 95 | GIC_SET_INTR_MASK(d->irq - gic_irq_base); |
| 99 | pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); | ||
| 100 | GIC_SET_INTR_MASK(irq); | ||
| 101 | } | 96 | } |
| 102 | 97 | ||
| 103 | #ifdef CONFIG_SMP | 98 | #ifdef CONFIG_SMP |
| 104 | |||
| 105 | static DEFINE_SPINLOCK(gic_lock); | 99 | static DEFINE_SPINLOCK(gic_lock); |
| 106 | 100 | ||
| 107 | static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, | 101 | static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, |
| 108 | bool force) | 102 | bool force) |
| 109 | { | 103 | { |
| 110 | unsigned int irq = d->irq - gic_irq_base; | 104 | unsigned int irq = (d->irq - gic_irq_base); |
| 111 | cpumask_t tmp = CPU_MASK_NONE; | 105 | cpumask_t tmp = CPU_MASK_NONE; |
| 112 | unsigned long flags; | 106 | unsigned long flags; |
| 113 | int i; | 107 | int i; |
| 114 | 108 | ||
| 115 | pr_debug("%s(%d) called\n", __func__, irq); | ||
| 116 | cpumask_and(&tmp, cpumask, cpu_online_mask); | 109 | cpumask_and(&tmp, cpumask, cpu_online_mask); |
| 117 | if (cpus_empty(tmp)) | 110 | if (cpus_empty(tmp)) |
| 118 | return -1; | 111 | return -1; |
| @@ -176,6 +169,7 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu, | |||
| 176 | 169 | ||
| 177 | /* Init Intr Masks */ | 170 | /* Init Intr Masks */ |
| 178 | GIC_CLR_INTR_MASK(intr); | 171 | GIC_CLR_INTR_MASK(intr); |
| 172 | |||
| 179 | /* Initialise per-cpu Interrupt software masks */ | 173 | /* Initialise per-cpu Interrupt software masks */ |
| 180 | if (flags & GIC_FLAG_IPI) | 174 | if (flags & GIC_FLAG_IPI) |
| 181 | set_bit(intr, pcpu_masks[cpu].pcpu_mask); | 175 | set_bit(intr, pcpu_masks[cpu].pcpu_mask); |
| @@ -237,8 +231,6 @@ void __init gic_init(unsigned long gic_base_addr, | |||
| 237 | numvpes = (gicconfig & GIC_SH_CONFIG_NUMVPES_MSK) >> | 231 | numvpes = (gicconfig & GIC_SH_CONFIG_NUMVPES_MSK) >> |
| 238 | GIC_SH_CONFIG_NUMVPES_SHF; | 232 | GIC_SH_CONFIG_NUMVPES_SHF; |
| 239 | 233 | ||
| 240 | pr_debug("%s called\n", __func__); | ||
| 241 | |||
| 242 | gic_basic_init(numintrs, numvpes, intr_map, intr_map_size); | 234 | gic_basic_init(numintrs, numvpes, intr_map, intr_map_size); |
| 243 | 235 | ||
| 244 | gic_platform_init(numintrs, &gic_irq_controller); | 236 | gic_platform_init(numintrs, &gic_irq_controller); |
