1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <common.h>
20#include <watchdog.h>
21#include <command.h>
22#include <asm/processor.h>
23#include <asm/interrupt.h>
24#include <ppc4xx.h>
25#include <ppc_asm.tmpl>
26#include <commproc.h>
27#include <asm/io.h>
28#include <asm/xilinx_irq.h>
29
30DECLARE_GLOBAL_DATA_PTR;
31
32void pic_enable(void)
33{
34 debug("Xilinx PIC at 0x%8x\n", intc);
35
36
37
38
39
40 out_be32((u32 *) IER, 0);
41
42
43 out_be32((u32 *) IAR, 0xffffffff);
44
45
46 out_be32((u32 *) MER, 0x3UL);
47
48 return;
49}
50
51int xilinx_pic_irq_get(void)
52{
53 u32 irq;
54 irq = in_be32((u32 *) IVR);
55
56
57
58
59
60
61 if (irq >= XPAR_INTC_MAX_NUM_INTR_INPUTS)
62 irq = -1;
63
64 debug("get_irq: %d\n", irq);
65 return (irq);
66}
67
68void pic_irq_enable(unsigned int irq)
69{
70 u32 mask = IRQ_MASK(irq);
71 debug("enable: %d\n", irq);
72 out_be32((u32 *) SIE, mask);
73}
74
75void pic_irq_disable(unsigned int irq)
76{
77 u32 mask = IRQ_MASK(irq);
78 debug("disable: %d\n", irq);
79 out_be32((u32 *) CIE, mask);
80}
81
82void pic_irq_ack(unsigned int irq)
83{
84 u32 mask = IRQ_MASK(irq);
85 debug("ack: %d\n", irq);
86 out_be32((u32 *) IAR, mask);
87}
88
89void external_interrupt(struct pt_regs *regs)
90{
91 int irq;
92
93 irq = xilinx_pic_irq_get();
94 if (irq < 0)
95 return;
96
97 interrupt_run_handler(irq);
98
99 return;
100}
101