MIPS/IRQCHIP: Move irq_chip from arch/mips to drivers/irqchip.
authorRalf Baechle <ralf@linux-mips.org>
Tue, 26 May 2015 16:20:06 +0000 (18:20 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Sun, 21 Jun 2015 19:52:50 +0000 (21:52 +0200)
While at it, rename it because in drivers/irqchip no longer every CPU is
a MIPS.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
14 files changed:
arch/mips/Kconfig
arch/mips/include/asm/irqflags.h
arch/mips/include/asm/mach-generic/irq.h
arch/mips/include/asm/txx9irq.h
arch/mips/kernel/Makefile
arch/mips/kernel/irq_cpu.c [deleted file]
arch/mips/loongson/Kconfig
arch/mips/loongson1/Kconfig
arch/mips/sibyte/Kconfig
arch/mips/txx9/Kconfig
arch/mips/vr41xx/Kconfig
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/irqchip/irq-mips-cpu.c [new file with mode: 0644]

index 9501d814ded5165e43fa615c7fe5c241280eb9a9..5fcfc6d989f450f75becb5247839b5e287b676f9 100644 (file)
@@ -71,7 +71,7 @@ config MIPS_ALCHEMY
        select ARCH_PHYS_ADDR_T_64BIT
        select CEVT_R4K
        select CSRC_R4K
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select DMA_MAYBE_COHERENT       # Au1000,1500,1100 aren't, rest is
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -86,7 +86,7 @@ config AR7
        select DMA_NONCOHERENT
        select CEVT_R4K
        select CSRC_R4K
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select NO_EXCEPT_FILL
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_MIPS32_R1
@@ -107,7 +107,7 @@ config ATH25
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select IRQ_DOMAIN
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_SUPPORTS_BIG_ENDIAN
@@ -125,7 +125,7 @@ config ATH79
        select DMA_NONCOHERENT
        select HAVE_CLK
        select CLKDEV_LOOKUP
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select MIPS_MACHINE
        select SYS_HAS_CPU_MIPS32_R2
        select SYS_HAS_EARLY_PRINTK
@@ -147,7 +147,7 @@ config BMIPS_GENERIC
        select BCM7038_L1_IRQ
        select BCM7120_L2_IRQ
        select BRCMSTB_L2_IRQ
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select RAW_IRQ_ACCESSORS
        select DMA_NONCOHERENT
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -177,7 +177,7 @@ config BCM47XX
        select CSRC_R4K
        select DMA_NONCOHERENT
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_HAS_CPU_MIPS32_R1
        select NO_EXCEPT_FILL
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -197,7 +197,7 @@ config BCM63XX
        select CSRC_R4K
        select SYNC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_HAS_EARLY_PRINTK
@@ -217,7 +217,7 @@ config MIPS_COBALT
        select HW_HAS_PCI
        select I8253
        select I8259
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select IRQ_GT641XX
        select PCI_GT64XXX_PCI0
        select PCI
@@ -240,7 +240,7 @@ config MACH_DECSTATION
        select CPU_R4400_WORKAROUNDS if 64BIT
        select DMA_NONCOHERENT
        select NO_IOPORT_MAP
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_HAS_CPU_R3000
        select SYS_HAS_CPU_R4X00
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -275,7 +275,7 @@ config MACH_JAZZ
        select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN
        select GENERIC_ISA_DMA
        select HAVE_PCSPKR_PLATFORM
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select I8253
        select I8259
        select ISA
@@ -295,7 +295,7 @@ config MACH_INGENIC
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_ZBOOT_UART16550
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select ARCH_REQUIRE_GPIOLIB
        select SYS_HAS_EARLY_PRINTK
        select HAVE_CLK
@@ -306,7 +306,7 @@ config MACH_INGENIC
 config LANTIQ
        bool "Lantiq based platforms"
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select CEVT_R4K
        select CSRC_R4K
        select SYS_HAS_CPU_MIPS32_R1
@@ -335,7 +335,7 @@ config LASAT
        select DMA_NONCOHERENT
        select SYS_HAS_EARLY_PRINTK
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select PCI_GT64XXX_PCI0
        select MIPS_NILE4
        select R5000_CPU_SCACHE
@@ -375,7 +375,7 @@ config MACH_PISTACHIO
        select COMMON_CLK
        select CSRC_R4K
        select DMA_MAYBE_COHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select LIBFDT
        select MFD_SYSCON
        select MIPS_CPU_SCACHE
@@ -403,7 +403,7 @@ config MIPS_MALTA
        select DMA_MAYBE_COHERENT
        select GENERIC_ISA_DMA
        select HAVE_PCSPKR_PLATFORM
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select MIPS_GIC
        select HW_HAS_PCI
        select I8253
@@ -451,7 +451,7 @@ config MIPS_SEAD3
        select CPU_MIPSR2_IRQ_VI
        select CPU_MIPSR2_IRQ_EI
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select MIPS_GIC
        select LIBFDT
        select MIPS_MSC
@@ -514,7 +514,7 @@ config PMC_MSP
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_MIPS16
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SERIAL_8250
        select SERIAL_8250_CONSOLE
        select USB_EHCI_BIG_ENDIAN_MMIO
@@ -531,7 +531,7 @@ config RALINK
        select CSRC_R4K
        select BOOT_RAW
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select USE_OF
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_HAS_CPU_MIPS32_R2
@@ -557,7 +557,7 @@ config SGI_IP22
        select I8253
        select I8259
        select IP22_CPU_SCACHE
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select GENERIC_ISA_DMA_SUPPORT_BROKEN
        select SGI_HAS_I8042
        select SGI_HAS_INDYDOG
@@ -616,7 +616,7 @@ config SGI_IP28
        select DEFAULT_SGI_PARTITION
        select DMA_NONCOHERENT
        select GENERIC_ISA_DMA_SUPPORT_BROKEN
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select HW_HAS_EISA
        select I8253
        select I8259
@@ -652,7 +652,7 @@ config SGI_IP32
        select CSRC_R4K
        select DMA_NONCOHERENT
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select R5000_CPU_SCACHE
        select RM7000_CPU_SCACHE
        select SYS_HAS_CPU_R5000
@@ -768,7 +768,7 @@ config SNI_RM
        select HAVE_PCSPKR_PLATFORM
        select HW_HAS_EISA
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select I8253
        select I8259
        select ISA
@@ -801,7 +801,7 @@ config MIKROTIK_RB532
        select CSRC_R4K
        select DMA_NONCOHERENT
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -867,7 +867,7 @@ config NLM_XLR_BOARD
        select NR_CPUS_DEFAULT_32
        select CEVT_R4K
        select CSRC_R4K
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select ZONE_DMA32 if 64BIT
        select SYNC_R4K
        select SYS_HAS_EARLY_PRINTK
@@ -894,7 +894,7 @@ config NLM_XLP_BOARD
        select NR_CPUS_DEFAULT_32
        select CEVT_R4K
        select CSRC_R4K
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select ZONE_DMA32 if 64BIT
        select SYNC_R4K
        select SYS_HAS_EARLY_PRINTK
@@ -1143,10 +1143,6 @@ config SYS_SUPPORTS_HUGETLBFS
 config MIPS_HUGE_TLB_SUPPORT
        def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE
 
-config IRQ_CPU
-       bool
-       select IRQ_DOMAIN
-
 config IRQ_CPU_RM7K
        bool
 
@@ -1173,7 +1169,7 @@ config SOC_EMMA2RH
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_R5500
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -1184,7 +1180,7 @@ config SOC_PNX833X
        bool
        select CEVT_R4K
        select CSRC_R4K
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select DMA_NONCOHERENT
        select SYS_HAS_CPU_MIPS32_R2
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -1588,7 +1584,7 @@ config CPU_BMIPS
        select CPU_BMIPS5000 if SYS_HAS_CPU_BMIPS5000
        select CPU_SUPPORTS_32BIT_KERNEL
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SWAP_IO_SPACE
        select WEAK_ORDERING
        select CPU_SUPPORTS_HIGHMEM
index d60cc68fa31e4f908685dd9c9f332e8df3d36242..e7b138b4b3d37f9f038aaec933b5040f0e7c3b2a 100644 (file)
@@ -60,7 +60,7 @@ static inline void arch_local_irq_restore(unsigned long flags)
        "       .set    push                                            \n"
        "       .set    noreorder                                       \n"
        "       .set    noat                                            \n"
-#if defined(CONFIG_IRQ_CPU)
+#if defined(CONFIG_IRQ_MIPS_CPU)
        /*
         * Slow, but doesn't suffer from a relatively unlikely race
         * condition we're having since days 1.
@@ -90,7 +90,7 @@ static inline void __arch_local_irq_restore(unsigned long flags)
        "       .set    push                                            \n"
        "       .set    noreorder                                       \n"
        "       .set    noat                                            \n"
-#if defined(CONFIG_IRQ_CPU)
+#if defined(CONFIG_IRQ_MIPS_CPU)
        /*
         * Slow, but doesn't suffer from a relatively unlikely race
         * condition we're having since days 1.
index 050e18bb1a049da4500b75451be148013321a220..be546a0f65fadf7525bb4759ca41b32709354155 100644 (file)
@@ -18,7 +18,7 @@
 #endif
 #endif
 
-#ifdef CONFIG_IRQ_CPU
+#ifdef CONFIG_IRQ_MIPS_CPU
 
 #ifndef MIPS_CPU_IRQ_BASE
 #ifdef CONFIG_I8259
@@ -34,7 +34,7 @@
 #endif
 #endif
 
-#endif /* CONFIG_IRQ_CPU */
+#endif /* CONFIG_IRQ_MIPS_CPU */
 
 #ifdef CONFIG_MIPS_GIC
 #ifndef MIPS_GIC_IRQ_BASE
index 5620879be37fb632310fe137264e2ef525cf3b9d..68a6650a4025b999fa273b6222b0b6a6da2d7094 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <irq.h>
 
-#ifdef CONFIG_IRQ_CPU
+#ifdef CONFIG_IRQ_MIPS_CPU
 #define TXX9_IRQ_BASE  (MIPS_CPU_IRQ_BASE + 8)
 #else
 #ifdef CONFIG_I8259
index a2debcbedb6ddbc5d0d7c960026f7b7b8466ce7a..3f5cf8aff6f344756b7a08441a771795b944828a 100644 (file)
@@ -62,7 +62,6 @@ obj-$(CONFIG_MIPS_VPE_APSP_API_CMP) += rtlx-cmp.o
 obj-$(CONFIG_MIPS_VPE_APSP_API_MT) += rtlx-mt.o
 
 obj-$(CONFIG_I8259)            += i8259.o
-obj-$(CONFIG_IRQ_CPU)          += irq_cpu.o
 obj-$(CONFIG_IRQ_CPU_RM7K)     += irq-rm7000.o
 obj-$(CONFIG_MIPS_MSC)         += irq-msc01.o
 obj-$(CONFIG_IRQ_TXX9)         += irq_txx9.o
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
deleted file mode 100644 (file)
index 6eb7a3f..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * Copyright (C) 2001 Ralf Baechle
- * Copyright (C) 2005  MIPS Technologies, Inc. All rights reserved.
- *     Author: Maciej W. Rozycki <macro@mips.com>
- *
- * This file define the irq handler for MIPS CPU interrupts.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under  the terms of the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-/*
- * Almost all MIPS CPUs define 8 interrupt sources.  They are typically
- * level triggered (i.e., cannot be cleared from CPU; must be cleared from
- * device).  The first two are software interrupts which we don't really
- * use or support.  The last one is usually the CPU timer interrupt if
- * counter register is present or, for CPUs with an external FPU, by
- * convention it's the FPU exception interrupt.
- *
- * Don't even think about using this on SMP.  You have been warned.
- *
- * This file exports one global function:
- *     void mips_cpu_irq_init(void);
- */
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/irq.h>
-#include <linux/irqdomain.h>
-
-#include <asm/irq_cpu.h>
-#include <asm/mipsregs.h>
-#include <asm/mipsmtregs.h>
-#include <asm/setup.h>
-
-static inline void unmask_mips_irq(struct irq_data *d)
-{
-       set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
-       irq_enable_hazard();
-}
-
-static inline void mask_mips_irq(struct irq_data *d)
-{
-       clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
-       irq_disable_hazard();
-}
-
-static struct irq_chip mips_cpu_irq_controller = {
-       .name           = "MIPS",
-       .irq_ack        = mask_mips_irq,
-       .irq_mask       = mask_mips_irq,
-       .irq_mask_ack   = mask_mips_irq,
-       .irq_unmask     = unmask_mips_irq,
-       .irq_eoi        = unmask_mips_irq,
-       .irq_disable    = mask_mips_irq,
-       .irq_enable     = unmask_mips_irq,
-};
-
-/*
- * Basically the same as above but taking care of all the MT stuff
- */
-
-static unsigned int mips_mt_cpu_irq_startup(struct irq_data *d)
-{
-       unsigned int vpflags = dvpe();
-
-       clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
-       evpe(vpflags);
-       unmask_mips_irq(d);
-       return 0;
-}
-
-/*
- * While we ack the interrupt interrupts are disabled and thus we don't need
- * to deal with concurrency issues.  Same for mips_cpu_irq_end.
- */
-static void mips_mt_cpu_irq_ack(struct irq_data *d)
-{
-       unsigned int vpflags = dvpe();
-       clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
-       evpe(vpflags);
-       mask_mips_irq(d);
-}
-
-static struct irq_chip mips_mt_cpu_irq_controller = {
-       .name           = "MIPS",
-       .irq_startup    = mips_mt_cpu_irq_startup,
-       .irq_ack        = mips_mt_cpu_irq_ack,
-       .irq_mask       = mask_mips_irq,
-       .irq_mask_ack   = mips_mt_cpu_irq_ack,
-       .irq_unmask     = unmask_mips_irq,
-       .irq_eoi        = unmask_mips_irq,
-       .irq_disable    = mask_mips_irq,
-       .irq_enable     = unmask_mips_irq,
-};
-
-asmlinkage void __weak plat_irq_dispatch(void)
-{
-       unsigned long pending = read_c0_cause() & read_c0_status() & ST0_IM;
-       int irq;
-
-       if (!pending) {
-               spurious_interrupt();
-               return;
-       }
-
-       pending >>= CAUSEB_IP;
-       while (pending) {
-               irq = fls(pending) - 1;
-               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
-               pending &= ~BIT(irq);
-       }
-}
-
-static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq,
-                            irq_hw_number_t hw)
-{
-       static struct irq_chip *chip;
-
-       if (hw < 2 && cpu_has_mipsmt) {
-               /* Software interrupts are used for MT/CMT IPI */
-               chip = &mips_mt_cpu_irq_controller;
-       } else {
-               chip = &mips_cpu_irq_controller;
-       }
-
-       if (cpu_has_vint)
-               set_vi_handler(hw, plat_irq_dispatch);
-
-       irq_set_chip_and_handler(irq, chip, handle_percpu_irq);
-
-       return 0;
-}
-
-static const struct irq_domain_ops mips_cpu_intc_irq_domain_ops = {
-       .map = mips_cpu_intc_map,
-       .xlate = irq_domain_xlate_onecell,
-};
-
-static void __init __mips_cpu_irq_init(struct device_node *of_node)
-{
-       struct irq_domain *domain;
-
-       /* Mask interrupts. */
-       clear_c0_status(ST0_IM);
-       clear_c0_cause(CAUSEF_IP);
-
-       domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0,
-                                      &mips_cpu_intc_irq_domain_ops, NULL);
-       if (!domain)
-               panic("Failed to add irqdomain for MIPS CPU");
-}
-
-void __init mips_cpu_irq_init(void)
-{
-       __mips_cpu_irq_init(NULL);
-}
-
-int __init mips_cpu_irq_of_init(struct device_node *of_node,
-                               struct device_node *parent)
-{
-       __mips_cpu_irq_init(of_node);
-       return 0;
-}
index 156de85b82cd552eb9b422a1ed613fa70ab9a0e6..50641491546354648ebb3a9872061c2de84ed63d 100644 (file)
@@ -15,7 +15,7 @@ config LEMOTE_FULOONG2E
        select HW_HAS_PCI
        select I8259
        select ISA
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -44,7 +44,7 @@ config LEMOTE_MACH2F
        select HAVE_CLK
        select HW_HAS_PCI
        select I8259
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select ISA
        select SYS_HAS_CPU_LOONGSON2F
        select SYS_HAS_EARLY_PRINTK
@@ -73,7 +73,7 @@ config LOONGSON_MACH3X
        select ISA
        select HT_PCI
        select I8259
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select NR_CPUS_DEFAULT_4
        select SYS_HAS_CPU_LOONGSON3
        select SYS_HAS_EARLY_PRINTK
index a2b796eaf3c3be124631ac986318b862c78d7cde..aeecdd9fac9fabb3be49cb2eb4cf7881e21e4f7e 100644 (file)
@@ -10,7 +10,7 @@ config LOONGSON1_LS1B
        select SYS_HAS_CPU_LOONGSON1B
        select DMA_NONCOHERENT
        select BOOT_ELF32
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_HIGHMEM
index 5fbd3605d24f50988d61731362ad1e43c720dba1..a8bb972fd9fddfee74c791b750707970341861fc 100644 (file)
@@ -3,7 +3,7 @@ config SIBYTE_SB1250
        select CEVT_SB1250
        select CSRC_SB1250
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_ENABLE_LDT_IF_PCI
        select SIBYTE_HAS_ZBUS_PROFILING
        select SIBYTE_SB1xxx_SOC
@@ -13,7 +13,7 @@ config SIBYTE_BCM1120
        bool
        select CEVT_SB1250
        select CSRC_SB1250
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_BCM112X
        select SIBYTE_HAS_ZBUS_PROFILING
        select SIBYTE_SB1xxx_SOC
@@ -23,7 +23,7 @@ config SIBYTE_BCM1125
        select CEVT_SB1250
        select CSRC_SB1250
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_BCM112X
        select SIBYTE_HAS_ZBUS_PROFILING
        select SIBYTE_SB1xxx_SOC
@@ -33,7 +33,7 @@ config SIBYTE_BCM1125H
        select CEVT_SB1250
        select CSRC_SB1250
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_BCM112X
        select SIBYTE_ENABLE_LDT_IF_PCI
        select SIBYTE_HAS_ZBUS_PROFILING
@@ -43,7 +43,7 @@ config SIBYTE_BCM112X
        bool
        select CEVT_SB1250
        select CSRC_SB1250
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_SB1xxx_SOC
        select SIBYTE_HAS_ZBUS_PROFILING
 
@@ -52,7 +52,7 @@ config SIBYTE_BCM1x80
        select CEVT_BCM1480
        select CSRC_BCM1480
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_HAS_ZBUS_PROFILING
        select SIBYTE_SB1xxx_SOC
        select SYS_SUPPORTS_SMP
@@ -62,7 +62,7 @@ config SIBYTE_BCM1x55
        select CEVT_BCM1480
        select CSRC_BCM1480
        select HW_HAS_PCI
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SIBYTE_SB1xxx_SOC
        select SIBYTE_HAS_ZBUS_PROFILING
        select SYS_SUPPORTS_SMP
@@ -70,7 +70,7 @@ config SIBYTE_BCM1x55
 config SIBYTE_SB1xxx_SOC
        bool
        select DMA_COHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SWAP_IO_SPACE
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
index 6d40bc783459fae425577c4da3b145e1907368de..8c337d60f790db9f0ae31c8a64872acfe734cb9b 100644 (file)
@@ -8,7 +8,7 @@ config MACH_TX49XX
        select MACH_TXX9
        select CEVT_R4K
        select CSRC_R4K
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select SYS_HAS_CPU_TX49XX
        select SYS_SUPPORTS_64BIT_KERNEL
 
index c1be6b37fb2a4966723c35d47fec28c793d004d7..74927b4d4f0bfda76f2e9cd69d98f41104242e3f 100644 (file)
@@ -8,7 +8,7 @@ config CASIO_E55
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select ISA
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -18,7 +18,7 @@ config IBM_WORKPAD
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select ISA
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -28,7 +28,7 @@ config TANBAC_TB022X
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select HW_HAS_PCI
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -44,7 +44,7 @@ config VICTOR_MPC30X
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select HW_HAS_PCI
        select PCI_VR41XX
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -55,7 +55,7 @@ config ZAO_CAPCELLA
        select CEVT_R4K
        select CSRC_R4K
        select DMA_NONCOHERENT
-       select IRQ_CPU
+       select IRQ_MIPS_CPU
        select HW_HAS_PCI
        select PCI_VR41XX
        select SYS_SUPPORTS_32BIT_KERNEL
index 6de62a96e79c80e9d442ca07f53549cf334f8c7c..2b7531e0e84cc3baf50ad3c8db43612f32057834 100644 (file)
@@ -85,6 +85,11 @@ config IMGPDC_IRQ
        select GENERIC_IRQ_CHIP
        select IRQ_DOMAIN
 
+config IRQ_MIPS_CPU
+       bool
+       select GENERIC_IRQ_CHIP
+       select IRQ_DOMAIN
+
 config CLPS711X_IRQCHIP
        bool
        depends on ARCH_CLPS711X
index dda4927e47a6a98fab0a66a8c8416b252096533b..129cde1ff5a7bfcce1149992120cbd93d6e3bdf8 100644 (file)
@@ -28,6 +28,7 @@ obj-$(CONFIG_ARM_VIC)                 += irq-vic.o
 obj-$(CONFIG_ATMEL_AIC_IRQ)            += irq-atmel-aic-common.o irq-atmel-aic.o
 obj-$(CONFIG_ATMEL_AIC5_IRQ)   += irq-atmel-aic-common.o irq-atmel-aic5.o
 obj-$(CONFIG_IMGPDC_IRQ)               += irq-imgpdc.o
+obj-$(CONFIG_IRQ_MIPS_CPU)             += irq-mips-cpu.o
 obj-$(CONFIG_SIRF_IRQ)                 += irq-sirfsoc.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)      += irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)             += irq-renesas-irqc.o
diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c
new file mode 100644 (file)
index 0000000..6eb7a3f
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * Copyright (C) 2001 Ralf Baechle
+ * Copyright (C) 2005  MIPS Technologies, Inc. All rights reserved.
+ *     Author: Maciej W. Rozycki <macro@mips.com>
+ *
+ * This file define the irq handler for MIPS CPU interrupts.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under  the terms of the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/*
+ * Almost all MIPS CPUs define 8 interrupt sources.  They are typically
+ * level triggered (i.e., cannot be cleared from CPU; must be cleared from
+ * device).  The first two are software interrupts which we don't really
+ * use or support.  The last one is usually the CPU timer interrupt if
+ * counter register is present or, for CPUs with an external FPU, by
+ * convention it's the FPU exception interrupt.
+ *
+ * Don't even think about using this on SMP.  You have been warned.
+ *
+ * This file exports one global function:
+ *     void mips_cpu_irq_init(void);
+ */
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+
+#include <asm/irq_cpu.h>
+#include <asm/mipsregs.h>
+#include <asm/mipsmtregs.h>
+#include <asm/setup.h>
+
+static inline void unmask_mips_irq(struct irq_data *d)
+{
+       set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
+       irq_enable_hazard();
+}
+
+static inline void mask_mips_irq(struct irq_data *d)
+{
+       clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
+       irq_disable_hazard();
+}
+
+static struct irq_chip mips_cpu_irq_controller = {
+       .name           = "MIPS",
+       .irq_ack        = mask_mips_irq,
+       .irq_mask       = mask_mips_irq,
+       .irq_mask_ack   = mask_mips_irq,
+       .irq_unmask     = unmask_mips_irq,
+       .irq_eoi        = unmask_mips_irq,
+       .irq_disable    = mask_mips_irq,
+       .irq_enable     = unmask_mips_irq,
+};
+
+/*
+ * Basically the same as above but taking care of all the MT stuff
+ */
+
+static unsigned int mips_mt_cpu_irq_startup(struct irq_data *d)
+{
+       unsigned int vpflags = dvpe();
+
+       clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
+       evpe(vpflags);
+       unmask_mips_irq(d);
+       return 0;
+}
+
+/*
+ * While we ack the interrupt interrupts are disabled and thus we don't need
+ * to deal with concurrency issues.  Same for mips_cpu_irq_end.
+ */
+static void mips_mt_cpu_irq_ack(struct irq_data *d)
+{
+       unsigned int vpflags = dvpe();
+       clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
+       evpe(vpflags);
+       mask_mips_irq(d);
+}
+
+static struct irq_chip mips_mt_cpu_irq_controller = {
+       .name           = "MIPS",
+       .irq_startup    = mips_mt_cpu_irq_startup,
+       .irq_ack        = mips_mt_cpu_irq_ack,
+       .irq_mask       = mask_mips_irq,
+       .irq_mask_ack   = mips_mt_cpu_irq_ack,
+       .irq_unmask     = unmask_mips_irq,
+       .irq_eoi        = unmask_mips_irq,
+       .irq_disable    = mask_mips_irq,
+       .irq_enable     = unmask_mips_irq,
+};
+
+asmlinkage void __weak plat_irq_dispatch(void)
+{
+       unsigned long pending = read_c0_cause() & read_c0_status() & ST0_IM;
+       int irq;
+
+       if (!pending) {
+               spurious_interrupt();
+               return;
+       }
+
+       pending >>= CAUSEB_IP;
+       while (pending) {
+               irq = fls(pending) - 1;
+               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
+               pending &= ~BIT(irq);
+       }
+}
+
+static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq,
+                            irq_hw_number_t hw)
+{
+       static struct irq_chip *chip;
+
+       if (hw < 2 && cpu_has_mipsmt) {
+               /* Software interrupts are used for MT/CMT IPI */
+               chip = &mips_mt_cpu_irq_controller;
+       } else {
+               chip = &mips_cpu_irq_controller;
+       }
+
+       if (cpu_has_vint)
+               set_vi_handler(hw, plat_irq_dispatch);
+
+       irq_set_chip_and_handler(irq, chip, handle_percpu_irq);
+
+       return 0;
+}
+
+static const struct irq_domain_ops mips_cpu_intc_irq_domain_ops = {
+       .map = mips_cpu_intc_map,
+       .xlate = irq_domain_xlate_onecell,
+};
+
+static void __init __mips_cpu_irq_init(struct device_node *of_node)
+{
+       struct irq_domain *domain;
+
+       /* Mask interrupts. */
+       clear_c0_status(ST0_IM);
+       clear_c0_cause(CAUSEF_IP);
+
+       domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0,
+                                      &mips_cpu_intc_irq_domain_ops, NULL);
+       if (!domain)
+               panic("Failed to add irqdomain for MIPS CPU");
+}
+
+void __init mips_cpu_irq_init(void)
+{
+       __mips_cpu_irq_init(NULL);
+}
+
+int __init mips_cpu_irq_of_init(struct device_node *of_node,
+                               struct device_node *parent)
+{
+       __mips_cpu_irq_init(of_node);
+       return 0;
+}