]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sparc,leon: Introduce the sparc-leon CPU type.
authorKonrad Eisele <konrad@gaisler.com>
Mon, 17 Aug 2009 00:13:31 +0000 (00:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Aug 2009 01:32:10 +0000 (18:32 -0700)
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>
13 files changed:
arch/sparc/include/asm/machines.h
arch/sparc/include/asm/pgtsrmmu.h
arch/sparc/include/asm/prom.h
arch/sparc/include/asm/system_32.h
arch/sparc/kernel/Makefile
arch/sparc/kernel/cpu.c
arch/sparc/kernel/head_32.S
arch/sparc/kernel/idprom.c
arch/sparc/kernel/irq_32.c
arch/sparc/kernel/setup_32.c
arch/sparc/mm/Makefile
arch/sparc/mm/init_32.c
arch/sparc/mm/loadmmu.c

index c28c2f2487940436f97b45073683fa4ab57cc8b4..cd9c099567e41dc89f8c50fc218fc60107aa46de 100644 (file)
@@ -15,7 +15,7 @@ struct Sun_Machine_Models {
 /* Current number of machines we know about that has an IDPROM
  * machtype entry including one entry for the 0x80 OBP machines.
  */
-#define NUM_SUN_MACHINES   15
+#define NUM_SUN_MACHINES   16
 
 /* The machine type in the idprom area looks like this:
  *
@@ -30,6 +30,7 @@ struct Sun_Machine_Models {
 
 #define SM_ARCH_MASK  0xf0
 #define SM_SUN4       0x20
+#define  M_LEON       0x30
 #define SM_SUN4C      0x50
 #define SM_SUN4M      0x70
 #define SM_SUN4M_OBP  0x80
@@ -41,6 +42,9 @@ struct Sun_Machine_Models {
 #define SM_4_330      0x03    /* Sun 4/300 series */
 #define SM_4_470      0x04    /* Sun 4/400 series */
 
+/* Leon machines */
+#define M_LEON3_SOC   0x02    /* Leon3 SoC */
+
 /* Sun4c machines                Full Name              - PROM NAME */
 #define SM_4C_SS1     0x01    /* Sun4c SparcStation 1   - Sun 4/60  */
 #define SM_4C_IPC     0x02    /* Sun4c SparcStation IPC - Sun 4/40  */
index 808555fc1d58bd6257adef1876b621df9e23426d..1407c07bdade6215eab5edc2cf3bbbe08544e379 100644 (file)
@@ -267,6 +267,7 @@ static inline void srmmu_flush_tlb_page(unsigned long page)
 
 }
 
+#ifndef CONFIG_SPARC_LEON
 static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
 {
        unsigned long retval;
@@ -278,6 +279,9 @@ static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
 
        return retval;
 }
+#else
+#define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK)
+#endif
 
 static inline int
 srmmu_get_pte (unsigned long addr)
index be8d7aaeb60d104563e4c88936da08d7c284828a..82a190d7efc1f1f2cc8bc3db60378a78507e7777 100644 (file)
@@ -118,5 +118,8 @@ extern struct device_node *of_console_device;
 extern char *of_console_path;
 extern char *of_console_options;
 
+extern void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp);
+extern char *build_full_name(struct device_node *dp);
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
index 751c8c17f5a037df797dbb148cf72d39f0521c93..890036b3689aa2e8ee58b083926469c1f555daa2 100644 (file)
@@ -32,6 +32,7 @@ enum sparc_cpu {
   sun4u       = 0x05, /* V8 ploos ploos */
   sun_unknown = 0x06,
   ap1000      = 0x07, /* almost a sun4m */
+  sparc_leon  = 0x08, /* Leon SoC */
 };
 
 /* Really, userland should not be looking at any of this... */
index 475ce4696acd915d90cbc2e91440cfa469dcff8b..b0041756c9f01674565471f18c60e3e18c60dfc9 100644 (file)
@@ -41,6 +41,8 @@ obj-y                   += of_device_common.o
 obj-y                   += of_device_$(BITS).o
 obj-$(CONFIG_SPARC64)   += prom_irqtrans.o
 
+obj-$(CONFIG_SPARC_LEON)+= leon_kernel.o
+
 obj-$(CONFIG_SPARC64)   += reboot.o
 obj-$(CONFIG_SPARC64)   += sysfs.o
 obj-$(CONFIG_SPARC64)   += iommu.o
index d85c3dc4953a931acde5fad87db15976a92e0904..1446df90ef85f8ced24f68b3c8d896b37cae2642 100644 (file)
@@ -312,7 +312,12 @@ void __cpuinit cpu_probe(void)
 
        psr = get_psr();
        put_psr(psr | PSR_EF);
+#ifdef CONFIG_SPARC_LEON
+       fpu_vers = 7;
+#else
        fpu_vers = ((get_fsr() >> 17) & 0x7);
+#endif
+
        put_psr(psr);
 
        set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
index 6b4d8acc4c83a1f4387dd0bd7ac8821eaf5716ee..439d82a95ac97be9ed08ebfc65993d0d09100550 100644 (file)
@@ -809,6 +809,11 @@ found_version:
                 nop
 
 got_prop:
+#ifdef CONFIG_SPARC_LEON
+               /* no cpu-type check is needed, it is a SPARC-LEON */
+               ba sun4c_continue_boot
+                nop
+#endif
                set     cputypval, %o2
                ldub    [%o2 + 0x4], %l1
 
index 57922f69c3f753fcac325b70c1757dd61554a3ea..52a15fe2db19766288da0625e788d528359f27c2 100644 (file)
@@ -31,6 +31,8 @@ static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
 { .name = "Sun 4/200 Series",        .id_machtype = (SM_SUN4 | SM_4_260) },
 { .name = "Sun 4/300 Series",        .id_machtype = (SM_SUN4 | SM_4_330) },
 { .name = "Sun 4/400 Series",        .id_machtype = (SM_SUN4 | SM_4_470) },
+/* Now Leon */
+{ .name = "Leon3 System-on-a-Chip",  .id_machtype = (M_LEON | M_LEON3_SOC) },
 /* Now, Sun4c's */
 { .name = "Sun4c SparcStation 1",    .id_machtype = (SM_SUN4C | SM_4C_SS1) },
 { .name = "Sun4c SparcStation IPC",  .id_machtype = (SM_SUN4C | SM_4C_IPC) },
index ad800b80c718285e046d47d8c652c54aa22049da..e1af4372832979eb363e3b3f6d2e54a3057d3b29 100644 (file)
@@ -45,6 +45,7 @@
 #include <asm/pcic.h>
 #include <asm/cacheflush.h>
 #include <asm/irq_regs.h>
+#include <asm/leon.h>
 
 #include "kernel.h"
 #include "irq.h"
@@ -661,6 +662,10 @@ void __init init_IRQ(void)
                sun4d_init_IRQ();
                break;
 
+       case sparc_leon:
+               leon_init_IRQ();
+               break;
+
        default:
                prom_printf("Cannot initialize IRQs on this Sun machine...");
                break;
index 998cadb4e7f2eb628c85a5d510ad0d613836ac18..16a47ffe03c1fe163d90d2ec1318e61852d6c5db 100644 (file)
@@ -235,6 +235,8 @@ void __init setup_arch(char **cmdline_p)
                sparc_cpu_model = sun4e;
        if (!strcmp(&cputypval,"sun4u"))
                sparc_cpu_model = sun4u;
+       if (!strncmp(&cputypval, "leon" , 4))
+               sparc_cpu_model = sparc_leon;
 
        printk("ARCH: ");
        switch(sparc_cpu_model) {
@@ -256,6 +258,9 @@ void __init setup_arch(char **cmdline_p)
        case sun4u:
                printk("SUN4U\n");
                break;
+       case sparc_leon:
+               printk("LEON\n");
+               break;
        default:
                printk("UNKNOWN!\n");
                break;
index 681abe0a45941a2c4f7f73f9cdc7393be24fc584..79836a7dd00c3ba78c446fd43a73edc9d9bd60ed 100644 (file)
@@ -11,6 +11,7 @@ obj-$(CONFIG_SPARC32)   += loadmmu.o
 obj-y                   += generic_$(BITS).o
 obj-$(CONFIG_SPARC32)   += extable.o btfixup.o srmmu.o iommu.o io-unit.o
 obj-$(CONFIG_SPARC32)   += hypersparc.o viking.o tsunami.o swift.o
+obj-$(CONFIG_SPARC_LEON)+= leon_mm.o
 
 # Only used by sparc64
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
index 26bb3919ff1fe216eda103883b9ee0aec2f8208e..54114ad0bdeeae01f48a292954d94238b206f787 100644 (file)
@@ -34,6 +34,7 @@
 #include <asm/pgalloc.h>       /* bug in asm-generic/tlb.h: check_pgt_cache */
 #include <asm/tlb.h>
 #include <asm/prom.h>
+#include <asm/leon.h>
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
@@ -326,6 +327,9 @@ void __init paging_init(void)
                sparc_unmapped_base = 0xe0000000;
                BTFIXUPSET_SETHI(sparc_unmapped_base, 0xe0000000);
                break;
+       case sparc_leon:
+               leon_init();
+               /* fall through */
        case sun4m:
        case sun4d:
                srmmu_paging_init();
index 652be05acbeaa97f26d564c9e786755cd4c4ab99..82ec8f666036bdcc45e6e3b92511a2833e57530c 100644 (file)
@@ -33,6 +33,7 @@ void __init load_mmu(void)
                break;
        case sun4m:
        case sun4d:
+       case sparc_leon:
                ld_mmu_srmmu();
                break;
        default: