aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2013-12-01 03:04:57 -0500
committerChris Zankel <chris@zankel.net>2014-01-14 13:19:58 -0500
commit26a8e96a8b37e8070fa9dcb1b7490cf4d4492d50 (patch)
tree5104a9c1e12dd3728b05db5b21b5033bd7b648d2 /arch/xtensa
parentbae07f8a9dfaf6268f2fba5522b70bce6fc7d718 (diff)
xtensa: add MX irqchip
MX is an interrupt distributor used in some SMP-capable xtensa configurations. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/include/asm/irq.h1
-rw-r--r--arch/xtensa/include/asm/mxregs.h46
-rw-r--r--arch/xtensa/include/asm/processor.h20
-rw-r--r--arch/xtensa/kernel/irq.c8
4 files changed, 75 insertions, 0 deletions
diff --git a/arch/xtensa/include/asm/irq.h b/arch/xtensa/include/asm/irq.h
index 16464f2f8ecc..7d194d462150 100644
--- a/arch/xtensa/include/asm/irq.h
+++ b/arch/xtensa/include/asm/irq.h
@@ -50,5 +50,6 @@ int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
50 unsigned long *out_hwirq, unsigned int *out_type); 50 unsigned long *out_hwirq, unsigned int *out_type);
51int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw); 51int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw);
52unsigned xtensa_map_ext_irq(unsigned ext_irq); 52unsigned xtensa_map_ext_irq(unsigned ext_irq);
53unsigned xtensa_get_ext_irq_no(unsigned irq);
53 54
54#endif /* _XTENSA_IRQ_H */ 55#endif /* _XTENSA_IRQ_H */
diff --git a/arch/xtensa/include/asm/mxregs.h b/arch/xtensa/include/asm/mxregs.h
new file mode 100644
index 000000000000..73dcc5456f68
--- /dev/null
+++ b/arch/xtensa/include/asm/mxregs.h
@@ -0,0 +1,46 @@
1/*
2 * Xtensa MX interrupt distributor
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2008 - 2013 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_MXREGS_H
12#define _XTENSA_MXREGS_H
13
14/*
15 * RER/WER at, as Read/write external register
16 * at: value
17 * as: address
18 *
19 * Address Value
20 * 00nn 0...0p..p Interrupt Routing, route IRQ n to processor p
21 * 01pp 0...0d..d 16 bits (d) 'ored' as single IPI to processor p
22 * 0180 0...0m..m Clear enable specified by mask (m)
23 * 0184 0...0m..m Set enable specified by mask (m)
24 * 0190 0...0x..x 8-bit IPI partition register
25 * VVVVVVVVPPPPUUUUUUUUUUUUUUUUU
26 * V (10-bit) Release/Version
27 * P ( 4-bit) Number of cores - 1
28 * U (18-bit) ID
29 * 01a0 i.......i 32-bit ConfigID
30 * 0200 0...0m..m RunStall core 'n'
31 * 0220 c Cache coherency enabled
32 */
33
34#define MIROUT(irq) (0x000 + (irq))
35#define MIPICAUSE(cpu) (0x100 + (cpu))
36#define MIPISET(cause) (0x140 + (cause))
37#define MIENG 0x180
38#define MIENGSET 0x184
39#define MIASG 0x188 /* Read Global Assert Register */
40#define MIASGSET 0x18c /* Set Global Addert Regiter */
41#define MIPIPART 0x190
42#define SYSCFGID 0x1a0
43#define MPSCORE 0x200
44#define CCON 0x220
45
46#endif /* _XTENSA_MXREGS_H */
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index 7e409a5b0ec5..abb59708a3b7 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -191,5 +191,25 @@ extern unsigned long get_wchan(struct task_struct *p);
191#define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);}) 191#define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);})
192#define get_sr(sr) ({unsigned int v; RSR(v,sr); v; }) 192#define get_sr(sr) ({unsigned int v; RSR(v,sr); v; })
193 193
194#ifndef XCHAL_HAVE_EXTERN_REGS
195#define XCHAL_HAVE_EXTERN_REGS 0
196#endif
197
198#if XCHAL_HAVE_EXTERN_REGS
199
200static inline void set_er(unsigned long value, unsigned long addr)
201{
202 asm volatile ("wer %0, %1" : : "a" (value), "a" (addr) : "memory");
203}
204
205static inline unsigned long get_er(unsigned long addr)
206{
207 register unsigned long value;
208 asm volatile ("rer %0, %1" : "=a" (value) : "a" (addr) : "memory");
209 return value;
210}
211
212#endif /* XCHAL_HAVE_EXTERN_REGS */
213
194#endif /* __ASSEMBLY__ */ 214#endif /* __ASSEMBLY__ */
195#endif /* _XTENSA_PROCESSOR_H */ 215#endif /* _XTENSA_PROCESSOR_H */
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 3cef58e28332..7d49730f4056 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -123,6 +123,14 @@ unsigned xtensa_map_ext_irq(unsigned ext_irq)
123 return XCHAL_NUM_INTERRUPTS; 123 return XCHAL_NUM_INTERRUPTS;
124} 124}
125 125
126unsigned xtensa_get_ext_irq_no(unsigned irq)
127{
128 unsigned mask = (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
129 XCHAL_INTTYPE_MASK_EXTERN_LEVEL) &
130 ((1u << irq) - 1);
131 return hweight32(mask);
132}
133
126void __init init_IRQ(void) 134void __init init_IRQ(void)
127{ 135{
128#ifdef CONFIG_OF 136#ifdef CONFIG_OF