xref: /linux/arch/sparc/kernel/irq.h (revision 38f7f8f05e8239e9871f7e1c4b0a842080e85315)
11d05995bSSam Ravnborg #include <linux/platform_device.h>
21d05995bSSam Ravnborg 
332231a66SAl Viro #include <asm/btfixup.h>
432231a66SAl Viro 
56baa9b20SSam Ravnborg struct irq_bucket {
66baa9b20SSam Ravnborg         struct irq_bucket *next;
76baa9b20SSam Ravnborg         unsigned int real_irq;
86baa9b20SSam Ravnborg         unsigned int irq;
96baa9b20SSam Ravnborg         unsigned int pil;
106baa9b20SSam Ravnborg };
116baa9b20SSam Ravnborg 
126baa9b20SSam Ravnborg #define SUN4D_MAX_BOARD 10
136baa9b20SSam Ravnborg #define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5)
146baa9b20SSam Ravnborg 
156baa9b20SSam Ravnborg /* Map between the irq identifier used in hw to the
166baa9b20SSam Ravnborg  * irq_bucket. The map is sufficient large to hold
176baa9b20SSam Ravnborg  * the sun4d hw identifiers.
186baa9b20SSam Ravnborg  */
196baa9b20SSam Ravnborg extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ];
206baa9b20SSam Ravnborg 
216baa9b20SSam Ravnborg 
220399bb5bSSam Ravnborg /* sun4m specific type definitions */
230399bb5bSSam Ravnborg 
240399bb5bSSam Ravnborg /* This maps direct to CPU specific interrupt registers */
250399bb5bSSam Ravnborg struct sun4m_irq_percpu {
260399bb5bSSam Ravnborg 	u32	pending;
270399bb5bSSam Ravnborg 	u32	clear;
280399bb5bSSam Ravnborg 	u32	set;
290399bb5bSSam Ravnborg };
300399bb5bSSam Ravnborg 
310399bb5bSSam Ravnborg /* This maps direct to global interrupt registers */
320399bb5bSSam Ravnborg struct sun4m_irq_global {
330399bb5bSSam Ravnborg 	u32	pending;
340399bb5bSSam Ravnborg 	u32	mask;
350399bb5bSSam Ravnborg 	u32	mask_clear;
360399bb5bSSam Ravnborg 	u32	mask_set;
370399bb5bSSam Ravnborg 	u32	interrupt_target;
380399bb5bSSam Ravnborg };
390399bb5bSSam Ravnborg 
400399bb5bSSam Ravnborg extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS];
410399bb5bSSam Ravnborg extern struct sun4m_irq_global __iomem *sun4m_irq_global;
420399bb5bSSam Ravnborg 
43bbdc2661SSam Ravnborg /*
44bbdc2661SSam Ravnborg  * Platform specific irq configuration
45bbdc2661SSam Ravnborg  * The individual platforms assign their platform
46bbdc2661SSam Ravnborg  * specifics in their init functions.
47bbdc2661SSam Ravnborg  */
48bbdc2661SSam Ravnborg struct sparc_irq_config {
49bbdc2661SSam Ravnborg 	void (*init_timers)(irq_handler_t);
501d05995bSSam Ravnborg 	unsigned int (*build_device_irq)(struct platform_device *op,
511d05995bSSam Ravnborg 	                                 unsigned int real_irq);
52bbdc2661SSam Ravnborg };
53bbdc2661SSam Ravnborg extern struct sparc_irq_config sparc_irq_config;
54bbdc2661SSam Ravnborg 
556baa9b20SSam Ravnborg unsigned int irq_alloc(unsigned int real_irq, unsigned int pil);
566baa9b20SSam Ravnborg void irq_link(unsigned int irq);
576baa9b20SSam Ravnborg void irq_unlink(unsigned int irq);
586baa9b20SSam Ravnborg void handler_irq(unsigned int pil, struct pt_regs *regs);
59bbdc2661SSam Ravnborg 
600f516813SAl Viro /* Dave Redman (djhr@tadpole.co.uk)
610f516813SAl Viro  * changed these to function pointers.. it saves cycles and will allow
620f516813SAl Viro  * the irq dependencies to be split into different files at a later date
630f516813SAl Viro  * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
640f516813SAl Viro  * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
650f516813SAl Viro  * Changed these to btfixup entities... It saves cycles :)
660f516813SAl Viro  */
670f516813SAl Viro 
6832231a66SAl Viro BTFIXUPDEF_CALL(void, clear_clock_irq, void)
6932231a66SAl Viro BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
7032231a66SAl Viro 
7132231a66SAl Viro static inline void clear_clock_irq(void)
7232231a66SAl Viro {
7332231a66SAl Viro 	BTFIXUP_CALL(clear_clock_irq)();
7432231a66SAl Viro }
7532231a66SAl Viro 
7632231a66SAl Viro static inline void load_profile_irq(int cpu, int limit)
7732231a66SAl Viro {
7832231a66SAl Viro 	BTFIXUP_CALL(load_profile_irq)(cpu, limit);
7932231a66SAl Viro }
8032231a66SAl Viro 
8132231a66SAl Viro #ifdef CONFIG_SMP
8232231a66SAl Viro BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
8332231a66SAl Viro BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
8432231a66SAl Viro BTFIXUPDEF_CALL(void, set_irq_udt, int)
8532231a66SAl Viro 
8632231a66SAl Viro #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
8732231a66SAl Viro #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
8832231a66SAl Viro #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
8955dd23ecSDaniel Hellstrom 
9055dd23ecSDaniel Hellstrom /* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
91*38f7f8f0SKjetil Oftedal #define SUN4D_IPI_IRQ 13
9255dd23ecSDaniel Hellstrom 
9355dd23ecSDaniel Hellstrom extern void sun4d_ipi_interrupt(void);
9455dd23ecSDaniel Hellstrom 
9532231a66SAl Viro #endif
96