aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-malta/malta-int.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mti-malta/malta-int.c')
-rw-r--r--arch/mips/mti-malta/malta-int.c89
1 files changed, 24 insertions, 65 deletions
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 2242181a6284..b71ee809191a 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -26,6 +26,7 @@
26#include <asm/i8259.h> 26#include <asm/i8259.h>
27#include <asm/irq_cpu.h> 27#include <asm/irq_cpu.h>
28#include <asm/irq_regs.h> 28#include <asm/irq_regs.h>
29#include <asm/mips-cm.h>
29#include <asm/mips-boards/malta.h> 30#include <asm/mips-boards/malta.h>
30#include <asm/mips-boards/maltaint.h> 31#include <asm/mips-boards/maltaint.h>
31#include <asm/gt64120.h> 32#include <asm/gt64120.h>
@@ -33,13 +34,10 @@
33#include <asm/mips-boards/msc01_pci.h> 34#include <asm/mips-boards/msc01_pci.h>
34#include <asm/msc01_ic.h> 35#include <asm/msc01_ic.h>
35#include <asm/gic.h> 36#include <asm/gic.h>
36#include <asm/gcmpregs.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/rtlx.h> 38#include <asm/rtlx.h>
39 39
40int gcmp_present = -1;
41static unsigned long _msc01_biu_base; 40static unsigned long _msc01_biu_base;
42static unsigned long _gcmp_base;
43static unsigned int ipi_map[NR_CPUS]; 41static unsigned int ipi_map[NR_CPUS];
44 42
45static DEFINE_RAW_SPINLOCK(mips_irq_lock); 43static DEFINE_RAW_SPINLOCK(mips_irq_lock);
@@ -288,10 +286,6 @@ asmlinkage void plat_irq_dispatch(void)
288 286
289#ifdef CONFIG_MIPS_MT_SMP 287#ifdef CONFIG_MIPS_MT_SMP
290 288
291
292#define GIC_MIPS_CPU_IPI_RESCHED_IRQ 3
293#define GIC_MIPS_CPU_IPI_CALL_IRQ 4
294
295#define MIPS_CPU_IPI_RESCHED_IRQ 0 /* SW int 0 for resched */ 289#define MIPS_CPU_IPI_RESCHED_IRQ 0 /* SW int 0 for resched */
296#define C_RESCHED C_SW0 290#define C_RESCHED C_SW0
297#define MIPS_CPU_IPI_CALL_IRQ 1 /* SW int 1 for resched */ 291#define MIPS_CPU_IPI_CALL_IRQ 1 /* SW int 1 for resched */
@@ -308,6 +302,13 @@ static void ipi_call_dispatch(void)
308 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ); 302 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ);
309} 303}
310 304
305#endif /* CONFIG_MIPS_MT_SMP */
306
307#ifdef CONFIG_MIPS_GIC_IPI
308
309#define GIC_MIPS_CPU_IPI_RESCHED_IRQ 3
310#define GIC_MIPS_CPU_IPI_CALL_IRQ 4
311
311static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 312static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
312{ 313{
313#ifdef CONFIG_MIPS_VPE_APSP_API_CMP 314#ifdef CONFIG_MIPS_VPE_APSP_API_CMP
@@ -338,7 +339,7 @@ static struct irqaction irq_call = {
338 .flags = IRQF_PERCPU, 339 .flags = IRQF_PERCPU,
339 .name = "IPI_call" 340 .name = "IPI_call"
340}; 341};
341#endif /* CONFIG_MIPS_MT_SMP */ 342#endif /* CONFIG_MIPS_GIC_IPI */
342 343
343static int gic_resched_int_base; 344static int gic_resched_int_base;
344static int gic_call_int_base; 345static int gic_call_int_base;
@@ -418,49 +419,7 @@ static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
418}; 419};
419#undef X 420#undef X
420 421
421/* 422#ifdef CONFIG_MIPS_GIC_IPI
422 * GCMP needs to be detected before any SMP initialisation
423 */
424int __init gcmp_probe(unsigned long addr, unsigned long size)
425{
426 if ((mips_revision_sconid != MIPS_REVISION_SCON_ROCIT) &&
427 (mips_revision_sconid != MIPS_REVISION_SCON_GT64120)) {
428 gcmp_present = 0;
429 pr_debug("GCMP NOT present\n");
430 return gcmp_present;
431 }
432
433 if (gcmp_present >= 0)
434 return gcmp_present;
435
436 _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR,
437 GCMP_ADDRSPACE_SZ);
438 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE,
439 MSC01_BIU_ADDRSPACE_SZ);
440 gcmp_present = ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) ==
441 GCMP_BASE_ADDR);
442
443 if (gcmp_present)
444 pr_debug("GCMP present\n");
445 return gcmp_present;
446}
447
448/* Return the number of IOCU's present */
449int __init gcmp_niocu(void)
450{
451 return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >>
452 GCMP_GCB_GC_NUMIOCU_SHF) : 0;
453}
454
455/* Set GCMP region attributes */
456void __init gcmp_setregion(int region, unsigned long base,
457 unsigned long mask, int type)
458{
459 GCMPGCBn(CMxBASE, region) = base;
460 GCMPGCBn(CMxMASK, region) = mask | type;
461}
462
463#if defined(CONFIG_MIPS_MT_SMP)
464static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin) 423static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin)
465{ 424{
466 int intr = baseintr + cpu; 425 int intr = baseintr + cpu;
@@ -496,8 +455,8 @@ void __init arch_init_irq(void)
496 if (!cpu_has_veic) 455 if (!cpu_has_veic)
497 mips_cpu_irq_init(); 456 mips_cpu_irq_init();
498 457
499 if (gcmp_present) { 458 if (mips_cm_present()) {
500 GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; 459 write_gcr_gic_base(GIC_BASE_ADDR | CM_GCR_GIC_BASE_GICEN_MSK);
501 gic_present = 1; 460 gic_present = 1;
502 } else { 461 } else {
503 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) { 462 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) {
@@ -576,7 +535,7 @@ void __init arch_init_irq(void)
576 if (gic_present) { 535 if (gic_present) {
577 /* FIXME */ 536 /* FIXME */
578 int i; 537 int i;
579#if defined(CONFIG_MIPS_MT_SMP) 538#if defined(CONFIG_MIPS_GIC_IPI)
580 gic_call_int_base = GIC_NUM_INTRS - 539 gic_call_int_base = GIC_NUM_INTRS -
581 (NR_CPUS - nr_cpu_ids) * 2 - nr_cpu_ids; 540 (NR_CPUS - nr_cpu_ids) * 2 - nr_cpu_ids;
582 gic_resched_int_base = gic_call_int_base - nr_cpu_ids; 541 gic_resched_int_base = gic_call_int_base - nr_cpu_ids;
@@ -584,14 +543,14 @@ void __init arch_init_irq(void)
584#endif 543#endif
585 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, 544 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,
586 ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); 545 ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);
587 if (!gcmp_present) { 546 if (!mips_cm_present()) {
588 /* Enable the GIC */ 547 /* Enable the GIC */
589 i = REG(_msc01_biu_base, MSC01_SC_CFG); 548 i = REG(_msc01_biu_base, MSC01_SC_CFG);
590 REG(_msc01_biu_base, MSC01_SC_CFG) = 549 REG(_msc01_biu_base, MSC01_SC_CFG) =
591 (i | (0x1 << MSC01_SC_CFG_GICENA_SHF)); 550 (i | (0x1 << MSC01_SC_CFG_GICENA_SHF));
592 pr_debug("GIC Enabled\n"); 551 pr_debug("GIC Enabled\n");
593 } 552 }
594#if defined(CONFIG_MIPS_MT_SMP) 553#if defined(CONFIG_MIPS_GIC_IPI)
595 /* set up ipi interrupts */ 554 /* set up ipi interrupts */
596 if (cpu_has_vint) { 555 if (cpu_has_vint) {
597 set_vi_handler(MIPSCPU_INT_IPI0, malta_ipi_irqdispatch); 556 set_vi_handler(MIPSCPU_INT_IPI0, malta_ipi_irqdispatch);
@@ -708,16 +667,16 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
708 /* This duplicates the handling in do_be which seems wrong */ 667 /* This duplicates the handling in do_be which seems wrong */
709 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL; 668 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
710 669
711 if (gcmp_present) { 670 if (mips_cm_present()) {
712 unsigned long cm_error = GCMPGCB(GCMEC); 671 unsigned long cm_error = read_gcr_error_cause();
713 unsigned long cm_addr = GCMPGCB(GCMEA); 672 unsigned long cm_addr = read_gcr_error_addr();
714 unsigned long cm_other = GCMPGCB(GCMEO); 673 unsigned long cm_other = read_gcr_error_mult();
715 unsigned long cause, ocause; 674 unsigned long cause, ocause;
716 char buf[256]; 675 char buf[256];
717 676
718 cause = (cm_error & GCMP_GCB_GMEC_ERROR_TYPE_MSK); 677 cause = cm_error & CM_GCR_ERROR_CAUSE_ERRTYPE_MSK;
719 if (cause != 0) { 678 if (cause != 0) {
720 cause >>= GCMP_GCB_GMEC_ERROR_TYPE_SHF; 679 cause >>= CM_GCR_ERROR_CAUSE_ERRTYPE_SHF;
721 if (cause < 16) { 680 if (cause < 16) {
722 unsigned long cca_bits = (cm_error >> 15) & 7; 681 unsigned long cca_bits = (cm_error >> 15) & 7;
723 unsigned long tr_bits = (cm_error >> 12) & 7; 682 unsigned long tr_bits = (cm_error >> 12) & 7;
@@ -748,8 +707,8 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
748 mcmd[cmd_bits], sport_bits); 707 mcmd[cmd_bits], sport_bits);
749 } 708 }
750 709
751 ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> 710 ocause = (cm_other & CM_GCR_ERROR_MULT_ERR2ND_MSK) >>
752 GCMP_GCB_GMEO_ERROR_2ND_SHF; 711 CM_GCR_ERROR_MULT_ERR2ND_SHF;
753 712
754 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error, 713 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error,
755 causes[cause], buf); 714 causes[cause], buf);
@@ -757,7 +716,7 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
757 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); 716 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]);
758 717
759 /* reprime cause register */ 718 /* reprime cause register */
760 GCMPGCB(GCMEC) = 0; 719 write_gcr_error_cause(0);
761 } 720 }
762 } 721 }
763 722