net: Add rtnl_lock_killable()
[linux/fpc-iii.git] / arch / powerpc / sysdev / xilinx_intc.c
blob4a86dcff3fcd521bfea8232ce0dcdc3427c33e31
1 /*
2 * Interrupt controller driver for Xilinx Virtex FPGAs
4 * Copyright (C) 2007 Secret Lab Technologies Ltd.
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
13 * This is a driver for the interrupt controller typically found in
14 * Xilinx Virtex FPGA designs.
16 * The interrupt sense levels are hard coded into the FPGA design with
17 * typically a 1:1 relationship between irq lines and devices (no shared
18 * irq lines). Therefore, this driver does not attempt to handle edge
19 * and level interrupts differently.
21 #undef DEBUG
23 #include <linux/kernel.h>
24 #include <linux/irq.h>
25 #include <linux/of.h>
26 #include <linux/of_address.h>
27 #include <linux/of_irq.h>
28 #include <asm/io.h>
29 #include <asm/processor.h>
30 #include <asm/i8259.h>
31 #include <asm/irq.h>
32 #include <linux/irqchip.h>
34 #if defined(CONFIG_PPC_I8259)
36 * Support code for cascading to 8259 interrupt controllers
38 static void xilinx_i8259_cascade(struct irq_desc *desc)
40 struct irq_chip *chip = irq_desc_get_chip(desc);
41 unsigned int cascade_irq = i8259_irq();
43 if (cascade_irq)
44 generic_handle_irq(cascade_irq);
46 /* Let xilinx_intc end the interrupt */
47 chip->irq_unmask(&desc->irq_data);
50 static void __init xilinx_i8259_setup_cascade(void)
52 struct device_node *cascade_node;
53 int cascade_irq;
55 /* Initialize i8259 controller */
56 cascade_node = of_find_compatible_node(NULL, NULL, "chrp,iic");
57 if (!cascade_node)
58 return;
60 cascade_irq = irq_of_parse_and_map(cascade_node, 0);
61 if (!cascade_irq) {
62 pr_err("virtex_ml510: Failed to map cascade interrupt\n");
63 goto out;
66 i8259_init(cascade_node, 0);
67 irq_set_chained_handler(cascade_irq, xilinx_i8259_cascade);
69 /* Program irq 7 (usb/audio), 14/15 (ide) to level sensitive */
70 /* This looks like a dirty hack to me --gcl */
71 outb(0xc0, 0x4d0);
72 outb(0xc0, 0x4d1);
74 out:
75 of_node_put(cascade_node);
77 #else
78 static inline void xilinx_i8259_setup_cascade(void) { return; }
79 #endif /* defined(CONFIG_PPC_I8259) */
82 * Initialize master Xilinx interrupt controller
84 void __init xilinx_intc_init_tree(void)
86 irqchip_init();
87 xilinx_i8259_setup_cascade();