blob: 3f6ca4d55dc41e787bbaeac542e5b7c57eabeb3a [file] [log] [blame]
Sam Ravnborg1d059952011-02-25 23:01:19 -08001#include <linux/platform_device.h>
2
Al Viro32231a62007-07-21 19:18:57 -07003#include <asm/btfixup.h>
David Howellsd550bbd2012-03-28 18:30:03 +01004#include <asm/cpu_type.h>
Al Viro32231a62007-07-21 19:18:57 -07005
Sam Ravnborg6baa9b22011-04-18 11:25:44 +00006struct irq_bucket {
7 struct irq_bucket *next;
8 unsigned int real_irq;
9 unsigned int irq;
10 unsigned int pil;
11};
12
13#define SUN4D_MAX_BOARD 10
14#define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5)
15
16/* Map between the irq identifier used in hw to the
17 * irq_bucket. The map is sufficient large to hold
18 * the sun4d hw identifiers.
19 */
20extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ];
21
22
Sam Ravnborg0399bb52011-02-25 23:02:11 -080023/* sun4m specific type definitions */
24
25/* This maps direct to CPU specific interrupt registers */
26struct sun4m_irq_percpu {
27 u32 pending;
28 u32 clear;
29 u32 set;
30};
31
32/* This maps direct to global interrupt registers */
33struct sun4m_irq_global {
34 u32 pending;
35 u32 mask;
36 u32 mask_clear;
37 u32 mask_set;
38 u32 interrupt_target;
39};
40
41extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS];
42extern struct sun4m_irq_global __iomem *sun4m_irq_global;
43
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080044/*
Sam Ravnborg472bc4f2012-04-04 13:21:13 +020045 * Platform specific configuration
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080046 * The individual platforms assign their platform
47 * specifics in their init functions.
48 */
Sam Ravnborg472bc4f2012-04-04 13:21:13 +020049struct sparc_config {
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080050 void (*init_timers)(irq_handler_t);
Sam Ravnborg1d059952011-02-25 23:01:19 -080051 unsigned int (*build_device_irq)(struct platform_device *op,
52 unsigned int real_irq);
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080053};
Sam Ravnborg472bc4f2012-04-04 13:21:13 +020054extern struct sparc_config sparc_config;
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080055
Sam Ravnborg6baa9b22011-04-18 11:25:44 +000056unsigned int irq_alloc(unsigned int real_irq, unsigned int pil);
57void irq_link(unsigned int irq);
58void irq_unlink(unsigned int irq);
59void handler_irq(unsigned int pil, struct pt_regs *regs);
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080060
Al Viro0f516812007-07-21 19:19:38 -070061/* Dave Redman (djhr@tadpole.co.uk)
62 * changed these to function pointers.. it saves cycles and will allow
63 * the irq dependencies to be split into different files at a later date
64 * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
65 * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
66 * Changed these to btfixup entities... It saves cycles :)
67 */
68
Al Viro32231a62007-07-21 19:18:57 -070069BTFIXUPDEF_CALL(void, clear_clock_irq, void)
Al Viro32231a62007-07-21 19:18:57 -070070BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
71
Al Viro32231a62007-07-21 19:18:57 -070072static inline void clear_clock_irq(void)
73{
74 BTFIXUP_CALL(clear_clock_irq)();
75}
76
Al Viro32231a62007-07-21 19:18:57 -070077static inline void load_profile_irq(int cpu, int limit)
78{
79 BTFIXUP_CALL(load_profile_irq)(cpu, limit);
80}
81
Al Viro32231a62007-07-21 19:18:57 -070082#ifdef CONFIG_SMP
83BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
84BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
85BTFIXUPDEF_CALL(void, set_irq_udt, int)
86
87#define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
88#define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
89#define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
Daniel Hellstrom55dd23e2011-05-02 00:08:54 +000090
91/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
Kjetil Oftedal38f7f8f2011-08-29 00:16:28 +020092#define SUN4D_IPI_IRQ 13
Daniel Hellstrom55dd23e2011-05-02 00:08:54 +000093
94extern void sun4d_ipi_interrupt(void);
95
Al Viro32231a62007-07-21 19:18:57 -070096#endif