/* * arch/arm/mach-tegra/irq.c * * IRQ chip driver for Tegra SoCs * * Copyright (c) 2009, NVIDIA Corporation. * * 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. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include "nvcommon.h" #include "nvrm_init.h" #include "nvrm_drf.h" #include "nvrm_hardware_access.h" #include "nvrm_module.h" #include "nvrm_interrupt.h" #include "mach/nvrm_linux.h" #include "ap15/arictlr.h" #include "ap15/arapb_misc.h" #include "ap20/arfic_proc_if.h" #include "ap20/arfic_dist.h" #include "mach/board.h" #ifdef CONFIG_TEGRA_SYSTEM_DMA extern void __init tegra_init_dma(void); /* irq_dma.c */ #endif extern void __init tegra_init_gpio(void); /* irq_gpio.c */ /* Exported symbol shared with NvOs defining the number of non-GPIO interrupts * present on the system */ NvU32 g_NvNumSocIrqs = 0; /* Causes the interrupt decoder to use the legacy portal player decoder */ NvU32 g_NvUsePpiDecoder = 0; void __iomem *g_NvIctlrBase = NULL; #ifdef CONFIG_CPU_AP15 #define NV_MAX_IRQ_INSTANCES 3 static volatile NvU8 *s_Controllers[NV_MAX_IRQ_INSTANCES] = {NULL}; static struct irq_chip s_NvIrqDispatch = { .name = "tegra", }; static void NvPrivAckIrq(unsigned int irq) { /* nothing to do */ } static void NvPrivAp15MaskIrq(unsigned int irq) { NV_WRITE32(s_Controllers[irq>>5] + ICTLR_CPU_IER_CLR_0, 1 << (irq & 31)); } static void NvPrivAp15UnmaskIrq(unsigned int irq) { NV_WRITE32(s_Controllers[irq>>5] + ICTLR_CPU_IER_SET_0, 1 << (irq & 31)); } static struct irq_chip* __init NvPrivAp15InitIrq(void) { NvU32 i; NvRmPhysAddr Phys; NvU32 Len; NvU32 Num; Num = NvRmModuleGetNumInstances(s_hRmGlobal,NvRmPrivModuleID_Interrupt); if (Num > NV_MAX_IRQ_INSTANCES) { printk("More interrupt controllers than static array size\n"); while (1) { } } g_NvNumSocIrqs = Num*32; for (i=0; i>5] + ICTLR_CPU_IER_CLR_0, 1 << (irq & 31)); } void NvPrivAp20UnmaskIrq(unsigned int irq) { gic_unmask_irq(irq); irq -= 32; NV_WRITE32(s_Controllers[irq>>5] + ICTLR_CPU_IER_SET_0, 1 << (irq & 31)); } static void NvPrivAp20AckIrq(unsigned int irq) { gic_ack_irq(irq); } #ifdef CONFIG_SMP static void NvPrivAp20SetCpu(unsigned int irq, const struct cpumask *mask_val) { gic_set_cpu(irq, mask_val); } #endif static void tegra_irq_register_module(NvRmModuleID Module, struct irq_chip* pIrq) { NvU32 i, Num; Num = NvRmModuleGetNumInstances(s_hRmGlobal, Module); for (i=0; i