aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2012-05-25 17:20:12 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-28 02:52:45 -0400
commit93bb32f632c90be00d9e5d69091ada201f619c18 (patch)
treed07b58d35aef8fdd3ae3cb3d60441bcfc965d71c
parentd87d8c11f347e743f0223d16c8ec57ef7e0274b2 (diff)
sparc32,leon: clean up leon.h
- Drop unused stuff accumulated over time - Drop non-leon stuff - Include almost all of the header unconditionally Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Daniel Hellstrom <daniel@gaisler.com> Cc: Konrad Eisele <konrad@gaisler.com>
-rw-r--r--arch/sparc/include/asm/leon.h67
-rw-r--r--arch/sparc/include/asm/pgtsrmmu.h1
-rw-r--r--arch/sparc/kernel/leon_kernel.c1
3 files changed, 4 insertions, 65 deletions
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index 07659124c140..00530a599c1f 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -8,8 +8,6 @@
8#ifndef LEON_H_INCLUDE 8#ifndef LEON_H_INCLUDE
9#define LEON_H_INCLUDE 9#define LEON_H_INCLUDE
10 10
11#ifdef CONFIG_SPARC_LEON
12
13/* mmu register access, ASI_LEON_MMUREGS */ 11/* mmu register access, ASI_LEON_MMUREGS */
14#define LEON_CNR_CTRL 0x000 12#define LEON_CNR_CTRL 0x000
15#define LEON_CNR_CTXP 0x100 13#define LEON_CNR_CTXP 0x100
@@ -62,15 +60,6 @@
62 60
63#ifndef __ASSEMBLY__ 61#ifndef __ASSEMBLY__
64 62
65/* do a virtual address read without cache */
66static inline unsigned long leon_readnobuffer_reg(unsigned long paddr)
67{
68 unsigned long retval;
69 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
70 "=r"(retval) : "r"(paddr), "i"(ASI_LEON_NOCACHE));
71 return retval;
72}
73
74/* do a physical address bypass write, i.e. for 0x80000000 */ 63/* do a physical address bypass write, i.e. for 0x80000000 */
75static inline void leon_store_reg(unsigned long paddr, unsigned long value) 64static inline void leon_store_reg(unsigned long paddr, unsigned long value)
76{ 65{
@@ -87,47 +76,16 @@ static inline unsigned long leon_load_reg(unsigned long paddr)
87 return retval; 76 return retval;
88} 77}
89 78
90static inline void leon_srmmu_disabletlb(void)
91{
92 unsigned int retval;
93 __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0),
94 "i"(ASI_LEON_MMUREGS));
95 retval |= LEON_CNR_CTRL_TLBDIS;
96 __asm__ __volatile__("sta %0, [%%g0] %2\n\t" : : "r"(retval), "r"(0),
97 "i"(ASI_LEON_MMUREGS) : "memory");
98}
99
100static inline void leon_srmmu_enabletlb(void)
101{
102 unsigned int retval;
103 __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0),
104 "i"(ASI_LEON_MMUREGS));
105 retval = retval & ~LEON_CNR_CTRL_TLBDIS;
106 __asm__ __volatile__("sta %0, [%%g0] %2\n\t" : : "r"(retval), "r"(0),
107 "i"(ASI_LEON_MMUREGS) : "memory");
108}
109
110/* macro access for leon_load_reg() and leon_store_reg() */ 79/* macro access for leon_load_reg() and leon_store_reg() */
111#define LEON3_BYPASS_LOAD_PA(x) (leon_load_reg((unsigned long)(x))) 80#define LEON3_BYPASS_LOAD_PA(x) (leon_load_reg((unsigned long)(x)))
112#define LEON3_BYPASS_STORE_PA(x, v) (leon_store_reg((unsigned long)(x), (unsigned long)(v))) 81#define LEON3_BYPASS_STORE_PA(x, v) (leon_store_reg((unsigned long)(x), (unsigned long)(v)))
113#define LEON3_BYPASS_ANDIN_PA(x, v) LEON3_BYPASS_STORE_PA(x, LEON3_BYPASS_LOAD_PA(x) & v)
114#define LEON3_BYPASS_ORIN_PA(x, v) LEON3_BYPASS_STORE_PA(x, LEON3_BYPASS_LOAD_PA(x) | v)
115#define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x)) 82#define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x))
116#define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v)) 83#define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v))
117#define LEON_REGLOAD_PA(x) leon_load_reg((unsigned long)(x)+LEON_PREGS)
118#define LEON_REGSTORE_PA(x, v) leon_store_reg((unsigned long)(x)+LEON_PREGS, (unsigned long)(v))
119#define LEON_REGSTORE_OR_PA(x, v) LEON_REGSTORE_PA(x, LEON_REGLOAD_PA(x) | (unsigned long)(v))
120#define LEON_REGSTORE_AND_PA(x, v) LEON_REGSTORE_PA(x, LEON_REGLOAD_PA(x) & (unsigned long)(v))
121
122/* macro access for leon_readnobuffer_reg() */
123#define LEON_BYPASSCACHE_LOAD_VA(x) leon_readnobuffer_reg((unsigned long)(x))
124 84
125extern void leon_init(void); 85extern void leon_init(void);
126extern void leon_switch_mm(void); 86extern void leon_switch_mm(void);
127extern void leon_init_IRQ(void); 87extern void leon_init_IRQ(void);
128 88
129extern unsigned long last_valid_pfn;
130
131static inline unsigned long sparc_leon3_get_dcachecfg(void) 89static inline unsigned long sparc_leon3_get_dcachecfg(void)
132{ 90{
133 unsigned int retval; 91 unsigned int retval;
@@ -230,9 +188,6 @@ static inline int sparc_leon3_cpuid(void)
230#error cannot determine LEON_PAGE_SIZE_LEON 188#error cannot determine LEON_PAGE_SIZE_LEON
231#endif 189#endif
232 190
233#define PAGE_MIN_SHIFT (12)
234#define PAGE_MIN_SIZE (1UL << PAGE_MIN_SHIFT)
235
236#define LEON3_XCCR_SETS_MASK 0x07000000UL 191#define LEON3_XCCR_SETS_MASK 0x07000000UL
237#define LEON3_XCCR_SSIZE_MASK 0x00f00000UL 192#define LEON3_XCCR_SSIZE_MASK 0x00f00000UL
238 193
@@ -258,15 +213,6 @@ struct leon3_cacheregs {
258 unsigned long dccr; /* 0x0c - Data Cache Configuration Register */ 213 unsigned long dccr; /* 0x0c - Data Cache Configuration Register */
259}; 214};
260 215
261/* struct that hold LEON2 cache configuration register
262 * & configuration register
263 */
264struct leon2_cacheregs {
265 unsigned long ccr, cfg;
266};
267
268#ifdef __KERNEL__
269
270#include <linux/interrupt.h> 216#include <linux/interrupt.h>
271 217
272struct device_node; 218struct device_node;
@@ -292,24 +238,15 @@ extern void leon_smp_done(void);
292extern void leon_boot_cpus(void); 238extern void leon_boot_cpus(void);
293extern int leon_boot_one_cpu(int i, struct task_struct *); 239extern int leon_boot_one_cpu(int i, struct task_struct *);
294void leon_init_smp(void); 240void leon_init_smp(void);
295extern void cpu_idle(void);
296extern void init_IRQ(void);
297extern void cpu_panic(void);
298extern int __leon_processor_id(void);
299void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); 241void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu);
300extern irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused); 242extern irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused);
301 243
302extern unsigned int real_irq_entry[];
303extern unsigned int smpleon_ipi[]; 244extern unsigned int smpleon_ipi[];
304extern unsigned int patchme_maybe_smp_msg[]; 245extern unsigned int linux_trap_ipi15_leon[];
305extern unsigned int t_nmi[], linux_trap_ipi15_leon[];
306extern unsigned int linux_trap_ipi15_sun4m[];
307extern int leon_ipi_irq; 246extern int leon_ipi_irq;
308 247
309#endif /* CONFIG_SMP */ 248#endif /* CONFIG_SMP */
310 249
311#endif /* __KERNEL__ */
312
313#endif /* __ASSEMBLY__ */ 250#endif /* __ASSEMBLY__ */
314 251
315/* macros used in leon_mm.c */ 252/* macros used in leon_mm.c */
@@ -317,7 +254,7 @@ extern int leon_ipi_irq;
317#define _pfn_valid(pfn) ((pfn < last_valid_pfn) && (pfn >= PFN(phys_base))) 254#define _pfn_valid(pfn) ((pfn < last_valid_pfn) && (pfn >= PFN(phys_base)))
318#define _SRMMU_PTE_PMASK_LEON 0xffffffff 255#define _SRMMU_PTE_PMASK_LEON 0xffffffff
319 256
320#else /* defined(CONFIG_SPARC_LEON) */ 257#ifndef CONFIG_SPARC_LEON
321 258
322/* nop definitions for !LEON case */ 259/* nop definitions for !LEON case */
323#define leon_init() do {} while (0) 260#define leon_init() do {} while (0)
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index cb828703a63a..394fe25e79d1 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
@@ -139,6 +139,7 @@
139 restore %g0, %g0, %g0; 139 restore %g0, %g0, %g0;
140 140
141#ifndef __ASSEMBLY__ 141#ifndef __ASSEMBLY__
142extern unsigned long last_valid_pfn;
142 143
143/* This makes sense. Honest it does - Anton */ 144/* This makes sense. Honest it does - Anton */
144/* XXX Yes but it's ugly as sin. FIXME. -KMW */ 145/* XXX Yes but it's ugly as sin. FIXME. -KMW */
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 77c1b916e4dd..e34e2c40c060 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -23,6 +23,7 @@
23#include <asm/smp.h> 23#include <asm/smp.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25 25
26#include "kernel.h"
26#include "prom.h" 27#include "prom.h"
27#include "irq.h" 28#include "irq.h"
28 29