~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/nios2/kernel/irq.c

Version: ~ [ linux-5.11-rc3 ] ~ [ linux-5.10.7 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.89 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.167 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.215 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.251 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.251 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2013 Altera Corporation
  3  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  4  * Copyright (C) 2008 Thomas Chou <thomas@wytron.com.tw>
  5  *
  6  * based on irq.c from m68k which is:
  7  *
  8  * Copyright (C) 2007 Greg Ungerer <gerg@snapgear.com>
  9  *
 10  * This program is free software; you can redistribute it and/or modify
 11  * it under the terms of the GNU General Public License as published by
 12  * the Free Software Foundation; either version 2 of the License, or
 13  * (at your option) any later version.
 14  *
 15  * This program is distributed in the hope that it will be useful,
 16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18  * GNU General Public License for more details.
 19  *
 20  * You should have received a copy of the GNU General Public License
 21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 22  *
 23  */
 24 
 25 #include <linux/init.h>
 26 #include <linux/interrupt.h>
 27 #include <linux/of.h>
 28 
 29 static u32 ienable;
 30 
 31 asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
 32 {
 33         struct pt_regs *oldregs = set_irq_regs(regs);
 34         int irq;
 35 
 36         irq_enter();
 37         irq = irq_find_mapping(NULL, hwirq);
 38         generic_handle_irq(irq);
 39         irq_exit();
 40 
 41         set_irq_regs(oldregs);
 42 }
 43 
 44 static void chip_unmask(struct irq_data *d)
 45 {
 46         ienable |= (1 << d->hwirq);
 47         WRCTL(CTL_IENABLE, ienable);
 48 }
 49 
 50 static void chip_mask(struct irq_data *d)
 51 {
 52         ienable &= ~(1 << d->hwirq);
 53         WRCTL(CTL_IENABLE, ienable);
 54 }
 55 
 56 static struct irq_chip m_irq_chip = {
 57         .name           = "NIOS2-INTC",
 58         .irq_unmask     = chip_unmask,
 59         .irq_mask       = chip_mask,
 60 };
 61 
 62 static int irq_map(struct irq_domain *h, unsigned int virq,
 63                                 irq_hw_number_t hw_irq_num)
 64 {
 65         irq_set_chip_and_handler(virq, &m_irq_chip, handle_level_irq);
 66 
 67         return 0;
 68 }
 69 
 70 static const struct irq_domain_ops irq_ops = {
 71         .map    = irq_map,
 72         .xlate  = irq_domain_xlate_onecell,
 73 };
 74 
 75 void __init init_IRQ(void)
 76 {
 77         struct irq_domain *domain;
 78         struct device_node *node;
 79 
 80         node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.0");
 81         if (!node)
 82                 node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.1");
 83 
 84         BUG_ON(!node);
 85 
 86         domain = irq_domain_add_linear(node, NIOS2_CPU_NR_IRQS, &irq_ops, NULL);
 87         BUG_ON(!domain);
 88 
 89         irq_set_default_host(domain);
 90         of_node_put(node);
 91         /* Load the initial ienable value */
 92         ienable = RDCTL(CTL_IENABLE);
 93 }
 94 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp