Sam Ravnborg | 1d05995 | 2011-02-25 23:01:19 -0800 | [diff] [blame] | 1 | #include <linux/platform_device.h> |
| 2 | |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 3 | #include <asm/btfixup.h> |
David Howells | d550bbd | 2012-03-28 18:30:03 +0100 | [diff] [blame] | 4 | #include <asm/cpu_type.h> |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 5 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame] | 6 | struct irq_bucket { |
| 7 | struct irq_bucket *next; |
| 8 | unsigned int real_irq; |
| 9 | unsigned int irq; |
| 10 | unsigned int pil; |
| 11 | }; |
| 12 | |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame^] | 13 | #define SUN4M_HARD_INT(x) (0x000000001 << (x)) |
| 14 | #define SUN4M_SOFT_INT(x) (0x000010000 << (x)) |
| 15 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame] | 16 | #define SUN4D_MAX_BOARD 10 |
| 17 | #define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5) |
| 18 | |
| 19 | /* Map between the irq identifier used in hw to the |
| 20 | * irq_bucket. The map is sufficient large to hold |
| 21 | * the sun4d hw identifiers. |
| 22 | */ |
| 23 | extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ]; |
| 24 | |
| 25 | |
Sam Ravnborg | 0399bb5 | 2011-02-25 23:02:11 -0800 | [diff] [blame] | 26 | /* sun4m specific type definitions */ |
| 27 | |
| 28 | /* This maps direct to CPU specific interrupt registers */ |
| 29 | struct sun4m_irq_percpu { |
| 30 | u32 pending; |
| 31 | u32 clear; |
| 32 | u32 set; |
| 33 | }; |
| 34 | |
| 35 | /* This maps direct to global interrupt registers */ |
| 36 | struct sun4m_irq_global { |
| 37 | u32 pending; |
| 38 | u32 mask; |
| 39 | u32 mask_clear; |
| 40 | u32 mask_set; |
| 41 | u32 interrupt_target; |
| 42 | }; |
| 43 | |
| 44 | extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS]; |
| 45 | extern struct sun4m_irq_global __iomem *sun4m_irq_global; |
| 46 | |
Tkhai Kirill | 62f0828 | 2012-04-04 21:49:26 +0200 | [diff] [blame] | 47 | /* The following definitions describe the individual platform features: */ |
| 48 | #define FEAT_L10_CLOCKSOURCE (1 << 0) /* L10 timer is used as a clocksource */ |
| 49 | #define FEAT_L10_CLOCKEVENT (1 << 1) /* L10 timer is used as a clockevent */ |
| 50 | #define FEAT_L14_ONESHOT (1 << 2) /* L14 timer clockevent can oneshot */ |
| 51 | |
Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 52 | /* |
Sam Ravnborg | 472bc4f | 2012-04-04 13:21:13 +0200 | [diff] [blame] | 53 | * Platform specific configuration |
Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 54 | * The individual platforms assign their platform |
| 55 | * specifics in their init functions. |
| 56 | */ |
Sam Ravnborg | 472bc4f | 2012-04-04 13:21:13 +0200 | [diff] [blame] | 57 | struct sparc_config { |
Tkhai Kirill | 62f0828 | 2012-04-04 21:49:26 +0200 | [diff] [blame] | 58 | void (*init_timers)(void); |
Sam Ravnborg | 1d05995 | 2011-02-25 23:01:19 -0800 | [diff] [blame] | 59 | unsigned int (*build_device_irq)(struct platform_device *op, |
| 60 | unsigned int real_irq); |
Tkhai Kirill | 62f0828 | 2012-04-04 21:49:26 +0200 | [diff] [blame] | 61 | |
| 62 | /* generic clockevent features - see FEAT_* above */ |
| 63 | int features; |
| 64 | |
| 65 | /* clock rate used for clock event timer */ |
| 66 | int clock_rate; |
| 67 | |
| 68 | /* one period for clock source timer */ |
| 69 | unsigned int cs_period; |
| 70 | |
| 71 | /* function to obtain offsett for cs period */ |
| 72 | unsigned int (*get_cycles_offset)(void); |
Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 73 | }; |
Sam Ravnborg | 472bc4f | 2012-04-04 13:21:13 +0200 | [diff] [blame] | 74 | extern struct sparc_config sparc_config; |
Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 75 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame] | 76 | unsigned int irq_alloc(unsigned int real_irq, unsigned int pil); |
| 77 | void irq_link(unsigned int irq); |
| 78 | void irq_unlink(unsigned int irq); |
| 79 | void handler_irq(unsigned int pil, struct pt_regs *regs); |
Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 80 | |
Al Viro | 0f51681 | 2007-07-21 19:19:38 -0700 | [diff] [blame] | 81 | /* Dave Redman (djhr@tadpole.co.uk) |
| 82 | * changed these to function pointers.. it saves cycles and will allow |
| 83 | * the irq dependencies to be split into different files at a later date |
David S. Miller | ee906c9 | 2012-05-12 00:35:45 -0700 | [diff] [blame] | 84 | * sun4m_irq.c etc so we could reduce the kernel size. |
Al Viro | 0f51681 | 2007-07-21 19:19:38 -0700 | [diff] [blame] | 85 | * Jakub Jelinek (jj@sunsite.mff.cuni.cz) |
| 86 | * Changed these to btfixup entities... It saves cycles :) |
| 87 | */ |
| 88 | |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 89 | BTFIXUPDEF_CALL(void, clear_clock_irq, void) |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 90 | BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int) |
| 91 | |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 92 | static inline void clear_clock_irq(void) |
| 93 | { |
| 94 | BTFIXUP_CALL(clear_clock_irq)(); |
| 95 | } |
| 96 | |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 97 | static inline void load_profile_irq(int cpu, int limit) |
| 98 | { |
| 99 | BTFIXUP_CALL(load_profile_irq)(cpu, limit); |
| 100 | } |
| 101 | |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame^] | 102 | unsigned long leon_get_irqmask(unsigned int irq); |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 103 | |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame^] | 104 | #ifdef CONFIG_SMP |
Daniel Hellstrom | 55dd23e | 2011-05-02 00:08:54 +0000 | [diff] [blame] | 105 | |
| 106 | /* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ |
Kjetil Oftedal | 38f7f8f | 2011-08-29 00:16:28 +0200 | [diff] [blame] | 107 | #define SUN4D_IPI_IRQ 13 |
Daniel Hellstrom | 55dd23e | 2011-05-02 00:08:54 +0000 | [diff] [blame] | 108 | |
| 109 | extern void sun4d_ipi_interrupt(void); |
| 110 | |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 111 | #endif |