diff options
Diffstat (limited to 'arch/mips/mti-malta/malta-int.c')
| -rw-r--r-- | arch/mips/mti-malta/malta-int.c | 127 |
1 files changed, 68 insertions, 59 deletions
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index 0892575f829d..2242181a6284 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
| @@ -1,25 +1,16 @@ | |||
| 1 | /* | 1 | /* |
| 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 | * | ||
| 2 | * Carsten Langgaard, carstenl@mips.com | 6 | * Carsten Langgaard, carstenl@mips.com |
| 3 | * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. | 7 | * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. |
| 4 | * Copyright (C) 2001 Ralf Baechle | 8 | * Copyright (C) 2001 Ralf Baechle |
| 5 | * | 9 | * Copyright (C) 2013 Imagination Technologies Ltd. |
| 6 | * This program is free software; you can distribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License (Version 2) as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 13 | * for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
| 18 | * | 10 | * |
| 19 | * Routines for generic manipulation of the interrupts found on the MIPS | 11 | * Routines for generic manipulation of the interrupts found on the MIPS |
| 20 | * Malta board. | 12 | * Malta board. The interrupt controller is located in the South Bridge |
| 21 | * The interrupt controller is located in the South Bridge a PIIX4 device | 13 | * a PIIX4 device with two internal 82C95 interrupt controllers. |
| 22 | * with two internal 82C95 interrupt controllers. | ||
| 23 | */ | 14 | */ |
| 24 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 25 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
| @@ -44,6 +35,7 @@ | |||
| 44 | #include <asm/gic.h> | 35 | #include <asm/gic.h> |
| 45 | #include <asm/gcmpregs.h> | 36 | #include <asm/gcmpregs.h> |
| 46 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
| 38 | #include <asm/rtlx.h> | ||
| 47 | 39 | ||
| 48 | int gcmp_present = -1; | 40 | int gcmp_present = -1; |
| 49 | static unsigned long _msc01_biu_base; | 41 | static unsigned long _msc01_biu_base; |
| @@ -90,7 +82,7 @@ static inline int mips_pcibios_iack(void) | |||
| 90 | BONITO_PCIMAP_CFG = 0; | 82 | BONITO_PCIMAP_CFG = 0; |
| 91 | break; | 83 | break; |
| 92 | default: | 84 | default: |
| 93 | printk(KERN_WARNING "Unknown system controller.\n"); | 85 | pr_emerg("Unknown system controller.\n"); |
| 94 | return -1; | 86 | return -1; |
| 95 | } | 87 | } |
| 96 | return irq; | 88 | return irq; |
| @@ -126,6 +118,11 @@ static void malta_hw0_irqdispatch(void) | |||
| 126 | } | 118 | } |
| 127 | 119 | ||
| 128 | do_IRQ(MALTA_INT_BASE + irq); | 120 | do_IRQ(MALTA_INT_BASE + irq); |
| 121 | |||
| 122 | #ifdef CONFIG_MIPS_VPE_APSP_API_MT | ||
| 123 | if (aprp_hook) | ||
| 124 | aprp_hook(); | ||
| 125 | #endif | ||
| 129 | } | 126 | } |
| 130 | 127 | ||
| 131 | static void malta_ipi_irqdispatch(void) | 128 | static void malta_ipi_irqdispatch(void) |
| @@ -149,11 +146,11 @@ static void corehi_irqdispatch(void) | |||
| 149 | unsigned int intrcause, datalo, datahi; | 146 | unsigned int intrcause, datalo, datahi; |
| 150 | struct pt_regs *regs = get_irq_regs(); | 147 | struct pt_regs *regs = get_irq_regs(); |
| 151 | 148 | ||
| 152 | printk(KERN_EMERG "CoreHI interrupt, shouldn't happen, we die here!\n"); | 149 | pr_emerg("CoreHI interrupt, shouldn't happen, we die here!\n"); |
| 153 | printk(KERN_EMERG "epc : %08lx\nStatus: %08lx\n" | 150 | pr_emerg("epc : %08lx\nStatus: %08lx\n" |
| 154 | "Cause : %08lx\nbadVaddr : %08lx\n", | 151 | "Cause : %08lx\nbadVaddr : %08lx\n", |
| 155 | regs->cp0_epc, regs->cp0_status, | 152 | regs->cp0_epc, regs->cp0_status, |
| 156 | regs->cp0_cause, regs->cp0_badvaddr); | 153 | regs->cp0_cause, regs->cp0_badvaddr); |
| 157 | 154 | ||
| 158 | /* Read all the registers and then print them as there is a | 155 | /* Read all the registers and then print them as there is a |
| 159 | problem with interspersed printk's upsetting the Bonito controller. | 156 | problem with interspersed printk's upsetting the Bonito controller. |
| @@ -171,8 +168,8 @@ static void corehi_irqdispatch(void) | |||
| 171 | intrcause = GT_READ(GT_INTRCAUSE_OFS); | 168 | intrcause = GT_READ(GT_INTRCAUSE_OFS); |
| 172 | datalo = GT_READ(GT_CPUERR_ADDRLO_OFS); | 169 | datalo = GT_READ(GT_CPUERR_ADDRLO_OFS); |
| 173 | datahi = GT_READ(GT_CPUERR_ADDRHI_OFS); | 170 | datahi = GT_READ(GT_CPUERR_ADDRHI_OFS); |
| 174 | printk(KERN_EMERG "GT_INTRCAUSE = %08x\n", intrcause); | 171 | pr_emerg("GT_INTRCAUSE = %08x\n", intrcause); |
| 175 | printk(KERN_EMERG "GT_CPUERR_ADDR = %02x%08x\n", | 172 | pr_emerg("GT_CPUERR_ADDR = %02x%08x\n", |
| 176 | datahi, datalo); | 173 | datahi, datalo); |
| 177 | break; | 174 | break; |
| 178 | case MIPS_REVISION_SCON_BONITO: | 175 | case MIPS_REVISION_SCON_BONITO: |
| @@ -184,14 +181,14 @@ static void corehi_irqdispatch(void) | |||
| 184 | intedge = BONITO_INTEDGE; | 181 | intedge = BONITO_INTEDGE; |
| 185 | intsteer = BONITO_INTSTEER; | 182 | intsteer = BONITO_INTSTEER; |
| 186 | pcicmd = BONITO_PCICMD; | 183 | pcicmd = BONITO_PCICMD; |
| 187 | printk(KERN_EMERG "BONITO_INTISR = %08x\n", intisr); | 184 | pr_emerg("BONITO_INTISR = %08x\n", intisr); |
| 188 | printk(KERN_EMERG "BONITO_INTEN = %08x\n", inten); | 185 | pr_emerg("BONITO_INTEN = %08x\n", inten); |
| 189 | printk(KERN_EMERG "BONITO_INTPOL = %08x\n", intpol); | 186 | pr_emerg("BONITO_INTPOL = %08x\n", intpol); |
| 190 | printk(KERN_EMERG "BONITO_INTEDGE = %08x\n", intedge); | 187 | pr_emerg("BONITO_INTEDGE = %08x\n", intedge); |
| 191 | printk(KERN_EMERG "BONITO_INTSTEER = %08x\n", intsteer); | 188 | pr_emerg("BONITO_INTSTEER = %08x\n", intsteer); |
| 192 | printk(KERN_EMERG "BONITO_PCICMD = %08x\n", pcicmd); | 189 | pr_emerg("BONITO_PCICMD = %08x\n", pcicmd); |
| 193 | printk(KERN_EMERG "BONITO_PCIBADADDR = %08x\n", pcibadaddr); | 190 | pr_emerg("BONITO_PCIBADADDR = %08x\n", pcibadaddr); |
| 194 | printk(KERN_EMERG "BONITO_PCIMSTAT = %08x\n", pcimstat); | 191 | pr_emerg("BONITO_PCIMSTAT = %08x\n", pcimstat); |
| 195 | break; | 192 | break; |
| 196 | } | 193 | } |
| 197 | 194 | ||
| @@ -313,6 +310,11 @@ static void ipi_call_dispatch(void) | |||
| 313 | 310 | ||
| 314 | static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) | 311 | static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) |
| 315 | { | 312 | { |
| 313 | #ifdef CONFIG_MIPS_VPE_APSP_API_CMP | ||
| 314 | if (aprp_hook) | ||
| 315 | aprp_hook(); | ||
| 316 | #endif | ||
| 317 | |||
| 316 | scheduler_ipi(); | 318 | scheduler_ipi(); |
| 317 | 319 | ||
| 318 | return IRQ_HANDLED; | 320 | return IRQ_HANDLED; |
| @@ -365,13 +367,13 @@ static struct irqaction corehi_irqaction = { | |||
| 365 | .flags = IRQF_NO_THREAD, | 367 | .flags = IRQF_NO_THREAD, |
| 366 | }; | 368 | }; |
| 367 | 369 | ||
| 368 | static msc_irqmap_t __initdata msc_irqmap[] = { | 370 | static msc_irqmap_t msc_irqmap[] __initdata = { |
| 369 | {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, | 371 | {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, |
| 370 | {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, | 372 | {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, |
| 371 | }; | 373 | }; |
| 372 | static int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap); | 374 | static int msc_nr_irqs __initdata = ARRAY_SIZE(msc_irqmap); |
| 373 | 375 | ||
| 374 | static msc_irqmap_t __initdata msc_eicirqmap[] = { | 376 | static msc_irqmap_t msc_eicirqmap[] __initdata = { |
| 375 | {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, | 377 | {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, |
| 376 | {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0}, | 378 | {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0}, |
| 377 | {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0}, | 379 | {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0}, |
| @@ -384,7 +386,7 @@ static msc_irqmap_t __initdata msc_eicirqmap[] = { | |||
| 384 | {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} | 386 | {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} |
| 385 | }; | 387 | }; |
| 386 | 388 | ||
| 387 | static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); | 389 | static int msc_nr_eicirqs __initdata = ARRAY_SIZE(msc_eicirqmap); |
| 388 | 390 | ||
| 389 | /* | 391 | /* |
| 390 | * This GIC specific tabular array defines the association between External | 392 | * This GIC specific tabular array defines the association between External |
| @@ -431,9 +433,12 @@ int __init gcmp_probe(unsigned long addr, unsigned long size) | |||
| 431 | if (gcmp_present >= 0) | 433 | if (gcmp_present >= 0) |
| 432 | return gcmp_present; | 434 | return gcmp_present; |
| 433 | 435 | ||
| 434 | _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ); | 436 | _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR, |
| 435 | _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE, MSC01_BIU_ADDRSPACE_SZ); | 437 | GCMP_ADDRSPACE_SZ); |
| 436 | gcmp_present = (GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) == GCMP_BASE_ADDR; | 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); | ||
| 437 | 442 | ||
| 438 | if (gcmp_present) | 443 | if (gcmp_present) |
| 439 | pr_debug("GCMP present\n"); | 444 | pr_debug("GCMP present\n"); |
| @@ -443,9 +448,8 @@ int __init gcmp_probe(unsigned long addr, unsigned long size) | |||
| 443 | /* Return the number of IOCU's present */ | 448 | /* Return the number of IOCU's present */ |
| 444 | int __init gcmp_niocu(void) | 449 | int __init gcmp_niocu(void) |
| 445 | { | 450 | { |
| 446 | return gcmp_present ? | 451 | return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >> |
| 447 | (GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >> GCMP_GCB_GC_NUMIOCU_SHF : | 452 | GCMP_GCB_GC_NUMIOCU_SHF) : 0; |
| 448 | 0; | ||
| 449 | } | 453 | } |
| 450 | 454 | ||
| 451 | /* Set GCMP region attributes */ | 455 | /* Set GCMP region attributes */ |
| @@ -594,11 +598,14 @@ void __init arch_init_irq(void) | |||
| 594 | set_vi_handler(MIPSCPU_INT_IPI1, malta_ipi_irqdispatch); | 598 | set_vi_handler(MIPSCPU_INT_IPI1, malta_ipi_irqdispatch); |
| 595 | } | 599 | } |
| 596 | /* Argh.. this really needs sorting out.. */ | 600 | /* Argh.. this really needs sorting out.. */ |
| 597 | printk("CPU%d: status register was %08x\n", smp_processor_id(), read_c0_status()); | 601 | pr_info("CPU%d: status register was %08x\n", |
| 602 | smp_processor_id(), read_c0_status()); | ||
| 598 | write_c0_status(read_c0_status() | STATUSF_IP3 | STATUSF_IP4); | 603 | write_c0_status(read_c0_status() | STATUSF_IP3 | STATUSF_IP4); |
| 599 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); | 604 | pr_info("CPU%d: status register now %08x\n", |
| 605 | smp_processor_id(), read_c0_status()); | ||
| 600 | write_c0_status(0x1100dc00); | 606 | write_c0_status(0x1100dc00); |
| 601 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); | 607 | pr_info("CPU%d: status register frc %08x\n", |
| 608 | smp_processor_id(), read_c0_status()); | ||
| 602 | for (i = 0; i < nr_cpu_ids; i++) { | 609 | for (i = 0; i < nr_cpu_ids; i++) { |
| 603 | arch_init_ipiirq(MIPS_GIC_IRQ_BASE + | 610 | arch_init_ipiirq(MIPS_GIC_IRQ_BASE + |
| 604 | GIC_RESCHED_INT(i), &irq_resched); | 611 | GIC_RESCHED_INT(i), &irq_resched); |
| @@ -616,11 +623,15 @@ void __init arch_init_irq(void) | |||
| 616 | cpu_ipi_call_irq = MSC01E_INT_SW1; | 623 | cpu_ipi_call_irq = MSC01E_INT_SW1; |
| 617 | } else { | 624 | } else { |
| 618 | if (cpu_has_vint) { | 625 | if (cpu_has_vint) { |
| 619 | set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); | 626 | set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, |
| 620 | set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); | 627 | ipi_resched_dispatch); |
| 628 | set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, | ||
| 629 | ipi_call_dispatch); | ||
| 621 | } | 630 | } |
| 622 | cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ; | 631 | cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + |
| 623 | cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ; | 632 | MIPS_CPU_IPI_RESCHED_IRQ; |
| 633 | cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + | ||
| 634 | MIPS_CPU_IPI_CALL_IRQ; | ||
| 624 | } | 635 | } |
| 625 | arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched); | 636 | arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched); |
| 626 | arch_init_ipiirq(cpu_ipi_call_irq, &irq_call); | 637 | arch_init_ipiirq(cpu_ipi_call_irq, &irq_call); |
| @@ -630,9 +641,7 @@ void __init arch_init_irq(void) | |||
| 630 | 641 | ||
| 631 | void malta_be_init(void) | 642 | void malta_be_init(void) |
| 632 | { | 643 | { |
| 633 | if (gcmp_present) { | 644 | /* Could change CM error mask register. */ |
| 634 | /* Could change CM error mask register */ | ||
| 635 | } | ||
| 636 | } | 645 | } |
| 637 | 646 | ||
| 638 | 647 | ||
| @@ -712,14 +721,14 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup) | |||
| 712 | if (cause < 16) { | 721 | if (cause < 16) { |
| 713 | unsigned long cca_bits = (cm_error >> 15) & 7; | 722 | unsigned long cca_bits = (cm_error >> 15) & 7; |
| 714 | unsigned long tr_bits = (cm_error >> 12) & 7; | 723 | unsigned long tr_bits = (cm_error >> 12) & 7; |
| 715 | unsigned long mcmd_bits = (cm_error >> 7) & 0x1f; | 724 | unsigned long cmd_bits = (cm_error >> 7) & 0x1f; |
| 716 | unsigned long stag_bits = (cm_error >> 3) & 15; | 725 | unsigned long stag_bits = (cm_error >> 3) & 15; |
| 717 | unsigned long sport_bits = (cm_error >> 0) & 7; | 726 | unsigned long sport_bits = (cm_error >> 0) & 7; |
| 718 | 727 | ||
| 719 | snprintf(buf, sizeof(buf), | 728 | snprintf(buf, sizeof(buf), |
| 720 | "CCA=%lu TR=%s MCmd=%s STag=%lu " | 729 | "CCA=%lu TR=%s MCmd=%s STag=%lu " |
| 721 | "SPort=%lu\n", | 730 | "SPort=%lu\n", |
| 722 | cca_bits, tr[tr_bits], mcmd[mcmd_bits], | 731 | cca_bits, tr[tr_bits], mcmd[cmd_bits], |
| 723 | stag_bits, sport_bits); | 732 | stag_bits, sport_bits); |
| 724 | } else { | 733 | } else { |
| 725 | /* glob state & sresp together */ | 734 | /* glob state & sresp together */ |
| @@ -728,7 +737,7 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup) | |||
| 728 | unsigned long c1_bits = (cm_error >> 12) & 7; | 737 | unsigned long c1_bits = (cm_error >> 12) & 7; |
| 729 | unsigned long c0_bits = (cm_error >> 9) & 7; | 738 | unsigned long c0_bits = (cm_error >> 9) & 7; |
| 730 | unsigned long sc_bit = (cm_error >> 8) & 1; | 739 | unsigned long sc_bit = (cm_error >> 8) & 1; |
| 731 | unsigned long mcmd_bits = (cm_error >> 3) & 0x1f; | 740 | unsigned long cmd_bits = (cm_error >> 3) & 0x1f; |
| 732 | unsigned long sport_bits = (cm_error >> 0) & 7; | 741 | unsigned long sport_bits = (cm_error >> 0) & 7; |
| 733 | snprintf(buf, sizeof(buf), | 742 | snprintf(buf, sizeof(buf), |
| 734 | "C3=%s C2=%s C1=%s C0=%s SC=%s " | 743 | "C3=%s C2=%s C1=%s C0=%s SC=%s " |
| @@ -736,16 +745,16 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup) | |||
| 736 | core[c3_bits], core[c2_bits], | 745 | core[c3_bits], core[c2_bits], |
| 737 | core[c1_bits], core[c0_bits], | 746 | core[c1_bits], core[c0_bits], |
| 738 | sc_bit ? "True" : "False", | 747 | sc_bit ? "True" : "False", |
| 739 | mcmd[mcmd_bits], sport_bits); | 748 | mcmd[cmd_bits], sport_bits); |
| 740 | } | 749 | } |
| 741 | 750 | ||
| 742 | ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> | 751 | ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> |
| 743 | GCMP_GCB_GMEO_ERROR_2ND_SHF; | 752 | GCMP_GCB_GMEO_ERROR_2ND_SHF; |
| 744 | 753 | ||
| 745 | printk("CM_ERROR=%08lx %s <%s>\n", cm_error, | 754 | pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error, |
| 746 | causes[cause], buf); | 755 | causes[cause], buf); |
| 747 | printk("CM_ADDR =%08lx\n", cm_addr); | 756 | pr_err("CM_ADDR =%08lx\n", cm_addr); |
| 748 | printk("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); | 757 | pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); |
| 749 | 758 | ||
| 750 | /* reprime cause register */ | 759 | /* reprime cause register */ |
| 751 | GCMPGCB(GCMEC) = 0; | 760 | GCMPGCB(GCMEC) = 0; |
