blob: b02026ad6e342d82da4347b0bd1e3e56ff3099eb [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sam Ravnborg1d059952011-02-25 23:01:19 -08002#include <linux/platform_device.h>
3
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
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020013#define SUN4M_HARD_INT(x) (0x000000001 << (x))
14#define SUN4M_SOFT_INT(x) (0x000010000 << (x))
15
Sam Ravnborg6baa9b22011-04-18 11:25:44 +000016#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 */
23extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ];
24
25
Sam Ravnborg0399bb52011-02-25 23:02:11 -080026/* sun4m specific type definitions */
27
28/* This maps direct to CPU specific interrupt registers */
29struct sun4m_irq_percpu {
30 u32 pending;
31 u32 clear;
32 u32 set;
33};
34
35/* This maps direct to global interrupt registers */
36struct sun4m_irq_global {
37 u32 pending;
38 u32 mask;
39 u32 mask_clear;
40 u32 mask_set;
41 u32 interrupt_target;
42};
43
44extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS];
45extern struct sun4m_irq_global __iomem *sun4m_irq_global;
46
Tkhai Kirill62f08282012-04-04 21:49:26 +020047/* 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 Ravnborgbbdc2662011-02-25 23:00:19 -080052/*
Sam Ravnborg472bc4f2012-04-04 13:21:13 +020053 * Platform specific configuration
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080054 * The individual platforms assign their platform
55 * specifics in their init functions.
56 */
Sam Ravnborg472bc4f2012-04-04 13:21:13 +020057struct sparc_config {
Tkhai Kirill62f08282012-04-04 21:49:26 +020058 void (*init_timers)(void);
Sam Ravnborg1d059952011-02-25 23:01:19 -080059 unsigned int (*build_device_irq)(struct platform_device *op,
60 unsigned int real_irq);
Tkhai Kirill62f08282012-04-04 21:49:26 +020061
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 Ravnborg08c93882012-05-14 17:30:35 +020073
74 void (*clear_clock_irq)(void);
75 void (*load_profile_irq)(int cpu, unsigned int limit);
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080076};
Sam Ravnborg472bc4f2012-04-04 13:21:13 +020077extern struct sparc_config sparc_config;
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080078
Sam Ravnborg6baa9b22011-04-18 11:25:44 +000079unsigned int irq_alloc(unsigned int real_irq, unsigned int pil);
80void irq_link(unsigned int irq);
81void irq_unlink(unsigned int irq);
82void handler_irq(unsigned int pil, struct pt_regs *regs);
Sam Ravnborgbbdc2662011-02-25 23:00:19 -080083
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020084unsigned long leon_get_irqmask(unsigned int irq);
Al Viro32231a62007-07-21 19:18:57 -070085
Sam Ravnborgfbb86382014-04-21 21:39:24 +020086/* irq_32.c */
87void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs);
88
Sam Ravnborg2b399172014-04-21 21:39:22 +020089/* sun4m_irq.c */
90void sun4m_nmi(struct pt_regs *regs);
91
Sam Ravnborg5ac75682014-04-21 21:39:23 +020092/* sun4d_irq.c */
93void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs);
94
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020095#ifdef CONFIG_SMP
Daniel Hellstrom55dd23e2011-05-02 00:08:54 +000096
97/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
Kjetil Oftedal38f7f8f2011-08-29 00:16:28 +020098#define SUN4D_IPI_IRQ 13
Daniel Hellstrom55dd23e2011-05-02 00:08:54 +000099
Sam Ravnborg2e74a742014-05-16 23:25:51 +0200100void sun4d_ipi_interrupt(void);
Daniel Hellstrom55dd23e2011-05-02 00:08:54 +0000101
Al Viro32231a62007-07-21 19:18:57 -0700102#endif