]>
git.ipfire.org Git - people/ms/u-boot.git/blob - cpu/microblaze/interrupts.c
2 * (C) Copyright 2007 Michal Simek
3 * (C) Copyright 2004 Atmark Techno, Inc.
5 * Michal SIMEK <monstr@monstr.eu>
6 * Yasushi SHOJI <yashi@atmark-techno.com>
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/microblaze_intc.h>
34 extern void microblaze_disable_interrupts (void);
35 extern void microblaze_enable_interrupts (void);
37 void enable_interrupts (void)
42 int disable_interrupts (void)
48 #ifdef CONFIG_SYS_INTC_0
49 #ifdef CONFIG_SYS_TIMER_0
50 extern void timer_init (void);
52 #ifdef CONFIG_SYS_FSL_2
53 extern void fsl_init2 (void);
57 static struct irq_action vecs
[CONFIG_SYS_INTC_0_NUM
];
59 /* mapping structure to interrupt controller */
60 microblaze_intc_t
*intc
= (microblaze_intc_t
*) (CONFIG_SYS_INTC_0_ADDR
);
68 void enable_one_interrupt (int irq
)
74 intc
->ier
= (mask
| offset
);
76 printf ("Enable one interrupt irq %x - mask %x,ier %x\n", offset
, mask
,
78 printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc
->isr
, intc
->ier
,
79 intc
->iar
, intc
->mer
);
83 void disable_one_interrupt (int irq
)
89 intc
->ier
= (mask
& ~offset
);
91 printf ("Disable one interrupt irq %x - mask %x,ier %x\n", irq
, mask
,
93 printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc
->isr
, intc
->ier
,
94 intc
->iar
, intc
->mer
);
98 /* adding new handler for interrupt */
99 void install_interrupt_handler (int irq
, interrupt_handler_t
* hdlr
, void *arg
)
101 struct irq_action
*act
;
102 /* irq out of range */
103 if ((irq
< 0) || (irq
> CONFIG_SYS_INTC_0_NUM
)) {
104 puts ("IRQ out of range\n");
108 if (hdlr
) { /* enable */
112 enable_one_interrupt (irq
);
113 } else { /* disable */
114 act
->handler
= (interrupt_handler_t
*) def_hdlr
;
115 act
->arg
= (void *)irq
;
116 disable_one_interrupt (irq
);
120 /* initialization interrupt controller - hardware */
121 void intc_init (void)
125 intc
->iar
= 0xFFFFFFFF;
126 /* XIntc_Start - hw_interrupt enable and all interrupt enable */
129 printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc
->isr
, intc
->ier
,
130 intc
->iar
, intc
->mer
);
134 int interrupts_init (void)
137 /* initialize irq list */
138 for (i
= 0; i
< CONFIG_SYS_INTC_0_NUM
; i
++) {
139 vecs
[i
].handler
= (interrupt_handler_t
*) def_hdlr
;
140 vecs
[i
].arg
= (void *)i
;
143 /* initialize intc controller */
145 #ifdef CONFIG_SYS_TIMER_0
148 #ifdef CONFIG_SYS_FSL_2
151 enable_interrupts ();
155 void interrupt_handler (void)
157 int irqs
= (intc
->isr
& intc
->ier
); /* find active interrupt */
161 printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc
->isr
, intc
->ier
,
162 intc
->iar
, intc
->mer
);
164 printf ("Interrupt handler on %x line, r14 %x\n", irqs
, value
);
166 struct irq_action
*act
= vecs
;
171 ("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
172 act
->handler
, act
->count
, act
->arg
);
174 act
->handler (act
->arg
);
185 printf ("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc
->isr
,
186 intc
->ier
, intc
->iar
, intc
->mer
);
188 printf ("Interrupt handler on %x line, r14 %x\n", irqs
, value
);
193 #if defined(CONFIG_CMD_IRQ)
194 #ifdef CONFIG_SYS_INTC_0
195 int do_irqinfo (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char *argv
[])
198 struct irq_action
*act
= vecs
;
200 puts ("\nInterrupt-Information:\n\n"
201 "Nr Routine Arg Count\n"
202 "-----------------------------\n");
204 for (i
= 0; i
< CONFIG_SYS_INTC_0_NUM
; i
++) {
205 if (act
->handler
!= (interrupt_handler_t
*) def_hdlr
) {
206 printf ("%02d %08x %08x %d\n", i
,
207 (int)act
->handler
, (int)act
->arg
, act
->count
);
215 int do_irqinfo (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char *argv
[])
217 puts ("Undefined interrupt controller\n");