aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-frv
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-frv')
-rw-r--r--include/asm-frv/bitops.h96
-rw-r--r--include/asm-frv/cpu-irqs.h54
-rw-r--r--include/asm-frv/hardirq.h5
-rw-r--r--include/asm-frv/irq-routing.h70
-rw-r--r--include/asm-frv/irq.h26
-rw-r--r--include/asm-frv/mb93091-fpga-irqs.h6
-rw-r--r--include/asm-frv/mb93093-fpga-irqs.h6
-rw-r--r--include/asm-frv/mb93493-irqs.h6
-rw-r--r--include/asm-frv/mb93493-regs.h2
-rw-r--r--include/asm-frv/pgtable.h8
10 files changed, 138 insertions, 141 deletions
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index 980ae1b0cd28..1f70d47148bd 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -157,23 +157,105 @@ static inline int __test_bit(int nr, const volatile void * addr)
157 __constant_test_bit((nr),(addr)) : \ 157 __constant_test_bit((nr),(addr)) : \
158 __test_bit((nr),(addr))) 158 __test_bit((nr),(addr)))
159 159
160#include <asm-generic/bitops/ffs.h>
161#include <asm-generic/bitops/__ffs.h>
162#include <asm-generic/bitops/find.h> 160#include <asm-generic/bitops/find.h>
163 161
164/* 162/**
165 * fls: find last bit set. 163 * fls - find last bit set
164 * @x: the word to search
165 *
166 * This is defined the same way as ffs:
167 * - return 32..1 to indicate bit 31..0 most significant bit set
168 * - return 0 to indicate no bits set
166 */ 169 */
167#define fls(x) \ 170#define fls(x) \
168({ \ 171({ \
169 int bit; \ 172 int bit; \
170 \ 173 \
171 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x)); \ 174 asm(" subcc %1,gr0,gr0,icc0 \n" \
175 " ckne icc0,cc4 \n" \
176 " cscan.p %1,gr0,%0 ,cc4,#1 \n" \
177 " csub %0,%0,%0 ,cc4,#0 \n" \
178 " csub %2,%0,%0 ,cc4,#1 \n" \
179 : "=&r"(bit) \
180 : "r"(x), "r"(32) \
181 : "icc0", "cc4" \
182 ); \
172 \ 183 \
173 bit ? 33 - bit : bit; \ 184 bit; \
174}) 185})
175 186
176#include <asm-generic/bitops/fls64.h> 187/**
188 * fls64 - find last bit set in a 64-bit value
189 * @n: the value to search
190 *
191 * This is defined the same way as ffs:
192 * - return 64..1 to indicate bit 63..0 most significant bit set
193 * - return 0 to indicate no bits set
194 */
195static inline __attribute__((const))
196int fls64(u64 n)
197{
198 union {
199 u64 ll;
200 struct { u32 h, l; };
201 } _;
202 int bit, x, y;
203
204 _.ll = n;
205
206 asm(" subcc.p %3,gr0,gr0,icc0 \n"
207 " subcc %4,gr0,gr0,icc1 \n"
208 " ckne icc0,cc4 \n"
209 " ckne icc1,cc5 \n"
210 " norcr cc4,cc5,cc6 \n"
211 " csub.p %0,%0,%0 ,cc6,1 \n"
212 " orcr cc5,cc4,cc4 \n"
213 " andcr cc4,cc5,cc4 \n"
214 " cscan.p %3,gr0,%0 ,cc4,0 \n"
215 " setlos #64,%1 \n"
216 " cscan.p %4,gr0,%0 ,cc4,1 \n"
217 " setlos #32,%2 \n"
218 " csub.p %1,%0,%0 ,cc4,0 \n"
219 " csub %2,%0,%0 ,cc4,1 \n"
220 : "=&r"(bit), "=r"(x), "=r"(y)
221 : "0r"(_.h), "r"(_.l)
222 : "icc0", "icc1", "cc4", "cc5", "cc6"
223 );
224 return bit;
225
226}
227
228/**
229 * ffs - find first bit set
230 * @x: the word to search
231 *
232 * - return 32..1 to indicate bit 31..0 most least significant bit set
233 * - return 0 to indicate no bits set
234 */
235static inline __attribute__((const))
236int ffs(int x)
237{
238 /* Note: (x & -x) gives us a mask that is the least significant
239 * (rightmost) 1-bit of the value in x.
240 */
241 return fls(x & -x);
242}
243
244/**
245 * __ffs - find first bit set
246 * @x: the word to search
247 *
248 * - return 31..0 to indicate bit 31..0 most least significant bit set
249 * - if no bits are set in x, the result is undefined
250 */
251static inline __attribute__((const))
252int __ffs(unsigned long x)
253{
254 int bit;
255 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x & -x));
256 return 31 - bit;
257}
258
177#include <asm-generic/bitops/sched.h> 259#include <asm-generic/bitops/sched.h>
178#include <asm-generic/bitops/hweight.h> 260#include <asm-generic/bitops/hweight.h>
179 261
diff --git a/include/asm-frv/cpu-irqs.h b/include/asm-frv/cpu-irqs.h
index 5cd691e1f8c4..478f3498fcfe 100644
--- a/include/asm-frv/cpu-irqs.h
+++ b/include/asm-frv/cpu-irqs.h
@@ -14,36 +14,6 @@
14 14
15#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
16 16
17#include <asm/irq-routing.h>
18
19#define IRQ_BASE_CPU (NR_IRQ_ACTIONS_PER_GROUP * 0)
20
21/* IRQ IDs presented to drivers */
22enum {
23 IRQ_CPU__UNUSED = IRQ_BASE_CPU,
24 IRQ_CPU_UART0,
25 IRQ_CPU_UART1,
26 IRQ_CPU_TIMER0,
27 IRQ_CPU_TIMER1,
28 IRQ_CPU_TIMER2,
29 IRQ_CPU_DMA0,
30 IRQ_CPU_DMA1,
31 IRQ_CPU_DMA2,
32 IRQ_CPU_DMA3,
33 IRQ_CPU_DMA4,
34 IRQ_CPU_DMA5,
35 IRQ_CPU_DMA6,
36 IRQ_CPU_DMA7,
37 IRQ_CPU_EXTERNAL0,
38 IRQ_CPU_EXTERNAL1,
39 IRQ_CPU_EXTERNAL2,
40 IRQ_CPU_EXTERNAL3,
41 IRQ_CPU_EXTERNAL4,
42 IRQ_CPU_EXTERNAL5,
43 IRQ_CPU_EXTERNAL6,
44 IRQ_CPU_EXTERNAL7,
45};
46
47/* IRQ to level mappings */ 17/* IRQ to level mappings */
48#define IRQ_GDBSTUB_LEVEL 15 18#define IRQ_GDBSTUB_LEVEL 15
49#define IRQ_UART_LEVEL 13 19#define IRQ_UART_LEVEL 13
@@ -82,6 +52,30 @@ enum {
82#define IRQ_XIRQ6_LEVEL 7 52#define IRQ_XIRQ6_LEVEL 7
83#define IRQ_XIRQ7_LEVEL 8 53#define IRQ_XIRQ7_LEVEL 8
84 54
55/* IRQ IDs presented to drivers */
56#define IRQ_CPU__UNUSED IRQ_BASE_CPU
57#define IRQ_CPU_UART0 (IRQ_BASE_CPU + IRQ_UART0_LEVEL)
58#define IRQ_CPU_UART1 (IRQ_BASE_CPU + IRQ_UART1_LEVEL)
59#define IRQ_CPU_TIMER0 (IRQ_BASE_CPU + IRQ_TIMER0_LEVEL)
60#define IRQ_CPU_TIMER1 (IRQ_BASE_CPU + IRQ_TIMER1_LEVEL)
61#define IRQ_CPU_TIMER2 (IRQ_BASE_CPU + IRQ_TIMER2_LEVEL)
62#define IRQ_CPU_DMA0 (IRQ_BASE_CPU + IRQ_DMA0_LEVEL)
63#define IRQ_CPU_DMA1 (IRQ_BASE_CPU + IRQ_DMA1_LEVEL)
64#define IRQ_CPU_DMA2 (IRQ_BASE_CPU + IRQ_DMA2_LEVEL)
65#define IRQ_CPU_DMA3 (IRQ_BASE_CPU + IRQ_DMA3_LEVEL)
66#define IRQ_CPU_DMA4 (IRQ_BASE_CPU + IRQ_DMA4_LEVEL)
67#define IRQ_CPU_DMA5 (IRQ_BASE_CPU + IRQ_DMA5_LEVEL)
68#define IRQ_CPU_DMA6 (IRQ_BASE_CPU + IRQ_DMA6_LEVEL)
69#define IRQ_CPU_DMA7 (IRQ_BASE_CPU + IRQ_DMA7_LEVEL)
70#define IRQ_CPU_EXTERNAL0 (IRQ_BASE_CPU + IRQ_XIRQ0_LEVEL)
71#define IRQ_CPU_EXTERNAL1 (IRQ_BASE_CPU + IRQ_XIRQ1_LEVEL)
72#define IRQ_CPU_EXTERNAL2 (IRQ_BASE_CPU + IRQ_XIRQ2_LEVEL)
73#define IRQ_CPU_EXTERNAL3 (IRQ_BASE_CPU + IRQ_XIRQ3_LEVEL)
74#define IRQ_CPU_EXTERNAL4 (IRQ_BASE_CPU + IRQ_XIRQ4_LEVEL)
75#define IRQ_CPU_EXTERNAL5 (IRQ_BASE_CPU + IRQ_XIRQ5_LEVEL)
76#define IRQ_CPU_EXTERNAL6 (IRQ_BASE_CPU + IRQ_XIRQ6_LEVEL)
77#define IRQ_CPU_EXTERNAL7 (IRQ_BASE_CPU + IRQ_XIRQ7_LEVEL)
78
85#endif /* !__ASSEMBLY__ */ 79#endif /* !__ASSEMBLY__ */
86 80
87#endif /* _ASM_CPU_IRQS_H */ 81#endif /* _ASM_CPU_IRQS_H */
diff --git a/include/asm-frv/hardirq.h b/include/asm-frv/hardirq.h
index 7581b5a7559a..fc47515822a2 100644
--- a/include/asm-frv/hardirq.h
+++ b/include/asm-frv/hardirq.h
@@ -26,5 +26,10 @@ typedef struct {
26#error SMP not available on FR-V 26#error SMP not available on FR-V
27#endif /* CONFIG_SMP */ 27#endif /* CONFIG_SMP */
28 28
29extern atomic_t irq_err_count;
30static inline void ack_bad_irq(int irq)
31{
32 atomic_inc(&irq_err_count);
33}
29 34
30#endif 35#endif
diff --git a/include/asm-frv/irq-routing.h b/include/asm-frv/irq-routing.h
deleted file mode 100644
index ac3ab900a1dc..000000000000
--- a/include/asm-frv/irq-routing.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/* irq-routing.h: multiplexed IRQ routing
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_IRQ_ROUTING_H
13#define _ASM_IRQ_ROUTING_H
14
15#ifndef __ASSEMBLY__
16
17#include <linux/spinlock.h>
18#include <asm/irq.h>
19
20struct irq_source;
21struct irq_level;
22
23/*
24 * IRQ action distribution sets
25 */
26struct irq_group {
27 int first_irq; /* first IRQ distributed here */
28 void (*control)(struct irq_group *group, int index, int on);
29
30 struct irqaction *actions[NR_IRQ_ACTIONS_PER_GROUP]; /* IRQ action chains */
31 struct irq_source *sources[NR_IRQ_ACTIONS_PER_GROUP]; /* IRQ sources */
32 int disable_cnt[NR_IRQ_ACTIONS_PER_GROUP]; /* disable counts */
33};
34
35/*
36 * IRQ source manager
37 */
38struct irq_source {
39 struct irq_source *next;
40 struct irq_level *level;
41 const char *muxname;
42 volatile void __iomem *muxdata;
43 unsigned long irqmask;
44
45 void (*doirq)(struct irq_source *source);
46};
47
48/*
49 * IRQ level management (per CPU IRQ priority / entry vector)
50 */
51struct irq_level {
52 int usage;
53 int disable_count;
54 unsigned long flags; /* current IRQF_DISABLED and IRQF_SHARED settings */
55 spinlock_t lock;
56 struct irq_source *sources;
57};
58
59extern struct irq_level frv_irq_levels[16];
60extern struct irq_group *irq_groups[NR_IRQ_GROUPS];
61
62extern void frv_irq_route(struct irq_source *source, int irqlevel);
63extern void frv_irq_route_external(struct irq_source *source, int irq);
64extern void frv_irq_set_group(struct irq_group *group);
65extern void distribute_irqs(struct irq_group *group, unsigned long irqmask);
66extern void route_cpu_irqs(void);
67
68#endif /* !__ASSEMBLY__ */
69
70#endif /* _ASM_IRQ_ROUTING_H */
diff --git a/include/asm-frv/irq.h b/include/asm-frv/irq.h
index 58b619215a50..8fefd6b827aa 100644
--- a/include/asm-frv/irq.h
+++ b/include/asm-frv/irq.h
@@ -1,6 +1,6 @@
1/* irq.h: FRV IRQ definitions 1/* irq.h: FRV IRQ definitions
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -12,32 +12,22 @@
12#ifndef _ASM_IRQ_H_ 12#ifndef _ASM_IRQ_H_
13#define _ASM_IRQ_H_ 13#define _ASM_IRQ_H_
14 14
15
16/*
17 * the system has an on-CPU PIC and another PIC on the FPGA and other PICs on other peripherals,
18 * so we do some routing in irq-routing.[ch] to reduce the number of false-positives seen by
19 * drivers
20 */
21
22/* this number is used when no interrupt has been assigned */ 15/* this number is used when no interrupt has been assigned */
23#define NO_IRQ (-1) 16#define NO_IRQ (-1)
24 17
25#define NR_IRQ_LOG2_ACTIONS_PER_GROUP 5 18#define NR_IRQS 48
26#define NR_IRQ_ACTIONS_PER_GROUP (1 << NR_IRQ_LOG2_ACTIONS_PER_GROUP) 19#define IRQ_BASE_CPU (0 * 16)
27#define NR_IRQ_GROUPS 4 20#define IRQ_BASE_FPGA (1 * 16)
28#define NR_IRQS (NR_IRQ_ACTIONS_PER_GROUP * NR_IRQ_GROUPS) 21#define IRQ_BASE_MB93493 (2 * 16)
29 22
30/* probe returns a 32-bit IRQ mask:-/ */ 23/* probe returns a 32-bit IRQ mask:-/ */
31#define MIN_PROBE_IRQ (NR_IRQS - 32) 24#define MIN_PROBE_IRQ (NR_IRQS - 32)
32 25
26#ifndef __ASSEMBLY__
33static inline int irq_canonicalize(int irq) 27static inline int irq_canonicalize(int irq)
34{ 28{
35 return irq; 29 return irq;
36} 30}
37 31#endif
38extern void disable_irq_nosync(unsigned int irq);
39extern void disable_irq(unsigned int irq);
40extern void enable_irq(unsigned int irq);
41
42 32
43#endif /* _ASM_IRQ_H_ */ 33#endif /* _ASM_IRQ_H_ */
diff --git a/include/asm-frv/mb93091-fpga-irqs.h b/include/asm-frv/mb93091-fpga-irqs.h
index 341bfc52a0eb..19778c5ba9d6 100644
--- a/include/asm-frv/mb93091-fpga-irqs.h
+++ b/include/asm-frv/mb93091-fpga-irqs.h
@@ -12,11 +12,9 @@
12#ifndef _ASM_MB93091_FPGA_IRQS_H 12#ifndef _ASM_MB93091_FPGA_IRQS_H
13#define _ASM_MB93091_FPGA_IRQS_H 13#define _ASM_MB93091_FPGA_IRQS_H
14 14
15#ifndef __ASSEMBLY__ 15#include <asm/irq.h>
16
17#include <asm/irq-routing.h>
18 16
19#define IRQ_BASE_FPGA (NR_IRQ_ACTIONS_PER_GROUP * 1) 17#ifndef __ASSEMBLY__
20 18
21/* IRQ IDs presented to drivers */ 19/* IRQ IDs presented to drivers */
22enum { 20enum {
diff --git a/include/asm-frv/mb93093-fpga-irqs.h b/include/asm-frv/mb93093-fpga-irqs.h
index 1e0f11c2fcdb..590266b1a6d3 100644
--- a/include/asm-frv/mb93093-fpga-irqs.h
+++ b/include/asm-frv/mb93093-fpga-irqs.h
@@ -12,11 +12,9 @@
12#ifndef _ASM_MB93093_FPGA_IRQS_H 12#ifndef _ASM_MB93093_FPGA_IRQS_H
13#define _ASM_MB93093_FPGA_IRQS_H 13#define _ASM_MB93093_FPGA_IRQS_H
14 14
15#ifndef __ASSEMBLY__ 15#include <asm/irq.h>
16
17#include <asm/irq-routing.h>
18 16
19#define IRQ_BASE_FPGA (NR_IRQ_ACTIONS_PER_GROUP * 1) 17#ifndef __ASSEMBLY__
20 18
21/* IRQ IDs presented to drivers */ 19/* IRQ IDs presented to drivers */
22enum { 20enum {
diff --git a/include/asm-frv/mb93493-irqs.h b/include/asm-frv/mb93493-irqs.h
index 15096e731325..82c7aeddd333 100644
--- a/include/asm-frv/mb93493-irqs.h
+++ b/include/asm-frv/mb93493-irqs.h
@@ -12,11 +12,9 @@
12#ifndef _ASM_MB93493_IRQS_H 12#ifndef _ASM_MB93493_IRQS_H
13#define _ASM_MB93493_IRQS_H 13#define _ASM_MB93493_IRQS_H
14 14
15#ifndef __ASSEMBLY__ 15#include <asm/irq.h>
16
17#include <asm/irq-routing.h>
18 16
19#define IRQ_BASE_MB93493 (NR_IRQ_ACTIONS_PER_GROUP * 2) 17#ifndef __ASSEMBLY__
20 18
21/* IRQ IDs presented to drivers */ 19/* IRQ IDs presented to drivers */
22enum { 20enum {
diff --git a/include/asm-frv/mb93493-regs.h b/include/asm-frv/mb93493-regs.h
index c54aa9d14468..8a1f6aac8cf1 100644
--- a/include/asm-frv/mb93493-regs.h
+++ b/include/asm-frv/mb93493-regs.h
@@ -15,6 +15,7 @@
15#include <asm/mb-regs.h> 15#include <asm/mb-regs.h>
16#include <asm/mb93493-irqs.h> 16#include <asm/mb93493-irqs.h>
17 17
18#define __addr_MB93493(X) ((volatile unsigned long *)(__region_CS3 + (X)))
18#define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); }) 19#define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); })
19 20
20#define __set_MB93493(X,V) \ 21#define __set_MB93493(X,V) \
@@ -26,6 +27,7 @@ do { \
26#define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V)) 27#define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V))
27#define MB93493_STSR_EN 28#define MB93493_STSR_EN
28 29
30#define __addr_MB93493_IQSR(X) __addr_MB93493(0x3d0 + (X) * 4)
29#define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4) 31#define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4)
30#define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V)) 32#define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V))
31 33
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 7af7485e889e..2fb3c6f05e03 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -217,7 +217,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
217} 217}
218 218
219#define pgd_page(pgd) (pud_page((pud_t){ pgd })) 219#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
220#define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) 220#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
221 221
222/* 222/*
223 * allocating and freeing a pud is trivial: the 1-entry pud is 223 * allocating and freeing a pud is trivial: the 1-entry pud is
@@ -246,7 +246,7 @@ static inline void pud_clear(pud_t *pud) { }
246#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) 246#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
247 247
248#define pud_page(pud) (pmd_page((pmd_t){ pud })) 248#define pud_page(pud) (pmd_page((pmd_t){ pud }))
249#define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) 249#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
250 250
251/* 251/*
252 * (pmds are folded into pgds so this doesn't get actually called, 252 * (pmds are folded into pgds so this doesn't get actually called,
@@ -362,7 +362,7 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address)
362#define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) 362#define pmd_bad(x) (pmd_val(x) & xAMPRx_SS)
363#define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) 363#define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0)
364 364
365#define pmd_page_kernel(pmd) \ 365#define pmd_page_vaddr(pmd) \
366 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 366 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
367 367
368#ifndef CONFIG_DISCONTIGMEM 368#ifndef CONFIG_DISCONTIGMEM
@@ -458,7 +458,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
458#define pte_index(address) \ 458#define pte_index(address) \
459 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 459 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
460#define pte_offset_kernel(dir, address) \ 460#define pte_offset_kernel(dir, address) \
461 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) 461 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
462 462
463#if defined(CONFIG_HIGHPTE) 463#if defined(CONFIG_HIGHPTE)
464#define pte_offset_map(dir, address) \ 464#define pte_offset_map(dir, address) \