Commit 0fd7ef1fe0e6e70c7851ce65a2eb8a8d3f49147e

Authored by Konrad Eisele
Committed by David S. Miller
1 parent 97fb58fa9b

sparc,leon: Introduce the sparc-leon CPU type.

Add sparc_leon enum, M_LEON|M_LEON3_SOC machine. Add compilation of
leon.c in mm and kernel
if CONFIG_SPARC_LEON is defined. Add sparc_leon dependent
initialization to switch statements + head.S.

Signed-off-by: Konrad Eisele <konrad@gaisler.com>
Reviewed-by:   Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 13 changed files with 43 additions and 1 deletions Side-by-side Diff

arch/sparc/include/asm/machines.h
... ... @@ -15,7 +15,7 @@
15 15 /* Current number of machines we know about that has an IDPROM
16 16 * machtype entry including one entry for the 0x80 OBP machines.
17 17 */
18   -#define NUM_SUN_MACHINES 15
  18 +#define NUM_SUN_MACHINES 16
19 19  
20 20 /* The machine type in the idprom area looks like this:
21 21 *
... ... @@ -30,6 +30,7 @@
30 30  
31 31 #define SM_ARCH_MASK 0xf0
32 32 #define SM_SUN4 0x20
  33 +#define M_LEON 0x30
33 34 #define SM_SUN4C 0x50
34 35 #define SM_SUN4M 0x70
35 36 #define SM_SUN4M_OBP 0x80
... ... @@ -40,6 +41,9 @@
40 41 #define SM_4_110 0x02 /* Sun 4/100 series */
41 42 #define SM_4_330 0x03 /* Sun 4/300 series */
42 43 #define SM_4_470 0x04 /* Sun 4/400 series */
  44 +
  45 +/* Leon machines */
  46 +#define M_LEON3_SOC 0x02 /* Leon3 SoC */
43 47  
44 48 /* Sun4c machines Full Name - PROM NAME */
45 49 #define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */
arch/sparc/include/asm/pgtsrmmu.h
... ... @@ -267,6 +267,7 @@
267 267  
268 268 }
269 269  
  270 +#ifndef CONFIG_SPARC_LEON
270 271 static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
271 272 {
272 273 unsigned long retval;
... ... @@ -278,6 +279,9 @@
278 279  
279 280 return retval;
280 281 }
  282 +#else
  283 +#define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK)
  284 +#endif
281 285  
282 286 static inline int
283 287 srmmu_get_pte (unsigned long addr)
arch/sparc/include/asm/prom.h
... ... @@ -118,6 +118,9 @@
118 118 extern char *of_console_path;
119 119 extern char *of_console_options;
120 120  
  121 +extern void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp);
  122 +extern char *build_full_name(struct device_node *dp);
  123 +
121 124 #endif /* __KERNEL__ */
122 125 #endif /* _SPARC_PROM_H */
arch/sparc/include/asm/system_32.h
... ... @@ -32,6 +32,7 @@
32 32 sun4u = 0x05, /* V8 ploos ploos */
33 33 sun_unknown = 0x06,
34 34 ap1000 = 0x07, /* almost a sun4m */
  35 + sparc_leon = 0x08, /* Leon SoC */
35 36 };
36 37  
37 38 /* Really, userland should not be looking at any of this... */
arch/sparc/kernel/Makefile
... ... @@ -41,6 +41,8 @@
41 41 obj-y += of_device_$(BITS).o
42 42 obj-$(CONFIG_SPARC64) += prom_irqtrans.o
43 43  
  44 +obj-$(CONFIG_SPARC_LEON)+= leon_kernel.o
  45 +
44 46 obj-$(CONFIG_SPARC64) += reboot.o
45 47 obj-$(CONFIG_SPARC64) += sysfs.o
46 48 obj-$(CONFIG_SPARC64) += iommu.o
arch/sparc/kernel/cpu.c
... ... @@ -312,7 +312,12 @@
312 312  
313 313 psr = get_psr();
314 314 put_psr(psr | PSR_EF);
  315 +#ifdef CONFIG_SPARC_LEON
  316 + fpu_vers = 7;
  317 +#else
315 318 fpu_vers = ((get_fsr() >> 17) & 0x7);
  319 +#endif
  320 +
316 321 put_psr(psr);
317 322  
318 323 set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
arch/sparc/kernel/head_32.S
... ... @@ -809,6 +809,11 @@
809 809 nop
810 810  
811 811 got_prop:
  812 +#ifdef CONFIG_SPARC_LEON
  813 + /* no cpu-type check is needed, it is a SPARC-LEON */
  814 + ba sun4c_continue_boot
  815 + nop
  816 +#endif
812 817 set cputypval, %o2
813 818 ldub [%o2 + 0x4], %l1
814 819  
arch/sparc/kernel/idprom.c
... ... @@ -31,6 +31,8 @@
31 31 { .name = "Sun 4/200 Series", .id_machtype = (SM_SUN4 | SM_4_260) },
32 32 { .name = "Sun 4/300 Series", .id_machtype = (SM_SUN4 | SM_4_330) },
33 33 { .name = "Sun 4/400 Series", .id_machtype = (SM_SUN4 | SM_4_470) },
  34 +/* Now Leon */
  35 +{ .name = "Leon3 System-on-a-Chip", .id_machtype = (M_LEON | M_LEON3_SOC) },
34 36 /* Now, Sun4c's */
35 37 { .name = "Sun4c SparcStation 1", .id_machtype = (SM_SUN4C | SM_4C_SS1) },
36 38 { .name = "Sun4c SparcStation IPC", .id_machtype = (SM_SUN4C | SM_4C_IPC) },
arch/sparc/kernel/irq_32.c
... ... @@ -45,6 +45,7 @@
45 45 #include <asm/pcic.h>
46 46 #include <asm/cacheflush.h>
47 47 #include <asm/irq_regs.h>
  48 +#include <asm/leon.h>
48 49  
49 50 #include "kernel.h"
50 51 #include "irq.h"
... ... @@ -659,6 +660,10 @@
659 660  
660 661 case sun4d:
661 662 sun4d_init_IRQ();
  663 + break;
  664 +
  665 + case sparc_leon:
  666 + leon_init_IRQ();
662 667 break;
663 668  
664 669 default:
arch/sparc/kernel/setup_32.c
... ... @@ -235,6 +235,8 @@
235 235 sparc_cpu_model = sun4e;
236 236 if (!strcmp(&cputypval,"sun4u"))
237 237 sparc_cpu_model = sun4u;
  238 + if (!strncmp(&cputypval, "leon" , 4))
  239 + sparc_cpu_model = sparc_leon;
238 240  
239 241 printk("ARCH: ");
240 242 switch(sparc_cpu_model) {
... ... @@ -255,6 +257,9 @@
255 257 break;
256 258 case sun4u:
257 259 printk("SUN4U\n");
  260 + break;
  261 + case sparc_leon:
  262 + printk("LEON\n");
258 263 break;
259 264 default:
260 265 printk("UNKNOWN!\n");
arch/sparc/mm/Makefile
... ... @@ -11,6 +11,7 @@
11 11 obj-y += generic_$(BITS).o
12 12 obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o
13 13 obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o
  14 +obj-$(CONFIG_SPARC_LEON)+= leon_mm.o
14 15  
15 16 # Only used by sparc64
16 17 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
arch/sparc/mm/init_32.c
... ... @@ -34,6 +34,7 @@
34 34 #include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */
35 35 #include <asm/tlb.h>
36 36 #include <asm/prom.h>
  37 +#include <asm/leon.h>
37 38  
38 39 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
39 40  
... ... @@ -326,6 +327,9 @@
326 327 sparc_unmapped_base = 0xe0000000;
327 328 BTFIXUPSET_SETHI(sparc_unmapped_base, 0xe0000000);
328 329 break;
  330 + case sparc_leon:
  331 + leon_init();
  332 + /* fall through */
329 333 case sun4m:
330 334 case sun4d:
331 335 srmmu_paging_init();
arch/sparc/mm/loadmmu.c
... ... @@ -33,6 +33,7 @@
33 33 break;
34 34 case sun4m:
35 35 case sun4d:
  36 + case sparc_leon:
36 37 ld_mmu_srmmu();
37 38 break;
38 39 default: