blob: 1fff316881505d701827cecc0a1f7c323cba333c [file] [log] [blame]
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01001/*
2 * U-boot - irq.h Interrupt related header file
3 *
Aubrey Li155fd762007-04-05 18:31:18 +08004 * Copyright (c) 2005-2007 Analog Devices Inc.
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01005 *
6 * This file was based on
7 * linux/arch/$(ARCH)/platform/$(PLATFORM)/irq.c
8 *
9 * Changed by HuTao Apr18, 2003
10 *
11 * Copyright was missing when I got the code so took from MIPS arch ...MaTed---
12 * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
13 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 by Ralf Baechle
14 *
15 * Adapted for BlackFin (ADI) by Ted Ma <mated@sympatico.ca>
16 * Copyright (c) 2002 Arcturus Networks Inc. (www.arcturusnetworks.com)
17 * Copyright (c) 2002 Lineo, Inc. <mattw@lineo.com>
18 *
19 * See file CREDITS for list of people who contributed to this
20 * project.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License as
24 * published by the Free Software Foundation; either version 2 of
25 * the License, or (at your option) any later version.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU General Public License for more details.
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
Aubrey Li155fd762007-04-05 18:31:18 +080034 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
35 * MA 02110-1301 USA
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010036 */
37
38#ifndef _BLACKFIN_IRQ_H_
39#define _BLACKFIN_IRQ_H_
40
41#include <linux/config.h>
Aubrey.Li3f0606a2007-03-09 13:38:44 +080042#include <asm/hw_irq.h>
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010043
44/*
45 * On the Blackfin, the interrupt structure allows remmapping of the hardware
46 * levels.
47 * - I'm going to assume that the H/W level is going to stay at the default
48 * settings. If someone wants to go through and abstart this out, feel free
49 * to mod the interrupt numbering scheme.
50 * - I'm abstracting the interrupts so that uClinux does not know anything
51 * about the H/W levels. If you want to change the H/W AND keep the abstracted
52 * levels that uClinux sees, you should be able to do most of it here.
53 * - I've left the "abstract" numbering sparce in case someone wants to pull the
54 * interrupts apart (just the TX/RX for the various devices)
55 */
56
57#define NR_IRQS SYS_IRQS
58/*
59 * "Generic" interrupt sources
60 */
61#define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */
62
63static __inline__ int irq_cannonicalize(int irq)
64{
65 return irq;
66}
67
68/*
69 * Machine specific interrupt sources.
70 *
71 * Adding an interrupt service routine for a source with this bit
72 * set indicates a special machine specific interrupt source.
73 * The machine specific files define these sources.
74 *
75 * The IRQ_MACHSPEC bit is now gone - the only thing it did was to
76 * introduce unnecessary overhead.
77 *
78 * All interrupt handling is actually machine specific so it is better
79 * to use function pointers, as used by the Sparc port, and select the
80 * interrupt handling functions when initializing the kernel. This way
81 * we save some unnecessary overhead at run-time.
82 * 01/11/97 - Jes
83 */
84
85extern void (*mach_enable_irq) (unsigned int);
86extern void (*mach_disable_irq) (unsigned int);
87extern int sys_request_irq(unsigned int,
Aubrey.Li3f0606a2007-03-09 13:38:44 +080088 void (*)(int, void *, struct pt_regs *),
89 unsigned long, const char *, void *);
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010090extern void sys_free_irq(unsigned int, void *);
91
92/*
93 * various flags for request_irq() - the Amiga now uses the standard
94 * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ
95 * are your friends.
96 */
97#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
98#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
99#define IRQ_FLG_FAST (0x0004)
100#define IRQ_FLG_SLOW (0x0008)
101#define IRQ_FLG_STD (0x8000) /* internally used */
102
103/*
104 * This structure is used to chain together the ISRs for a particular
105 * interrupt source (if it supports chaining).
106 */
107typedef struct irq_node {
108 void (*handler) (int, void *, struct pt_regs *);
109 unsigned long flags;
110 void *dev_id;
111 const char *devname;
112 struct irq_node *next;
113} irq_node_t;
114
115/*
116 * This structure has only 4 elements for speed reasons
117 */
118typedef struct irq_handler {
119 void (*handler) (int, void *, struct pt_regs *);
120 unsigned long flags;
121 void *dev_id;
122 const char *devname;
123} irq_handler_t;
124
125/* count of spurious interrupts */
126extern volatile unsigned int num_spurious;
127
128/*
129 * This function returns a new irq_node_t
130 */
131extern irq_node_t *new_irq_node(void);
132
133/*
134 * Some drivers want these entry points
135 */
136#define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0)
137#define disable_irq(x) (mach_disable_irq ? (*mach_disable_irq)(x) : 0)
138
139#define enable_irq_nosync(x) enable_irq(x)
140#define disable_irq_nosync(x) disable_irq(x)
141
142#endif