LEON SPARC V8 processor support for linux-2.6.10
PATCH 2/7 LEON SPARC V8 processor support for linux-2.6.10
linux-2.6.10: Kernel patches:
[2/7] diff2.6.10_arch_sparc.diff: diff for arch/sparc
arch/sparc/Kconfig renamed from linux-2.6.10/arch/sparc/Kconfig +19 -0
@@ -223,6 +223,25 @@ a kernel compiled with this option will run only on sun4. (And the current version will probably work only on sun4/330.) +config LEON + bool "Running on SoC 'Leon', the open source sparc VHDL model" + help + Say Y here if you want to run linux on the Leon System-on-a-Chip + platform. For information go to www.gaisler.com. Download the VHDL + source and use the instruction level Leon sparc-simulator "tsim" which + is free for private use. + +if LEON + +config LEON_3 + bool "Running on grlib's Leon3 " + help + Say Y here if you are running on a Leon3 from grlib + (download from www.gaisler.com). + +endif + + if !SUN4 config PCI
arch/sparc/kernel/Makefile renamed from linux-2.6.10/arch/sparc/kernel/Makefile +1 -1
@@ -6,7 +6,7 @@ EXTRA_AFLAGS := -ansi -IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o +IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o leon_irq.o obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \ process.o signal.o ioport.o setup.o idprom.o \ sys_sparc.o sunos_asm.o systbls.o \
arch/sparc/kernel/auxio.c renamed from linux-2.6.10/arch/sparc/kernel/auxio.c +1 -0
@@ -29,6 +29,7 @@switch (sparc_cpu_model) {case sun4d:case sun4: +case sparc_leon:return ;default :break ;
arch/sparc/kernel/cpu.c renamed from linux-2.6.10/arch/sparc/kernel/cpu.c +11 -2
@@ -73,6 +73,9 @@ { 5, 6, "reserved"}, { 5, 7, "No FPU"}, { 9, 3, "Fujitsu or Weitek on-chip FPU"}, +/* Leon */ + { 0xf, 0, "Meiko FPU"}, + { 0xf, 1, "GRFPU"}, };#define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info))
@@ -117,7 +120,9 @@ { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"}, - { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"}, +/* Leon */ + { 0xf, 2, "Gaisler Research - Leon2 SoC"}, + { 0xf, 3, "Gaisler Research - Leon3 SoC"}, };#define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info))
@@ -134,10 +139,14 @@ psr_impl = ((get_psr ()>>28 )&0xf ); psr_vers = ((get_psr ()>>24 )&0xf ); +#ifdef CONFIG_LEON + psr_impl =0xf ;/* hardcoded ids for older models/simulators */ + psr_vers =2 ; +#endif psr =get_psr ();put_psr (psr |PSR_EF ); - fpu_vers = ((get_fsr ()>>17 )&0x7 ); + fpu_vers = (get_psr () &PSR_EF ) ? ((get_fsr ()>>17 )&0x7 ) :7 ;put_psr (psr);for (i =0 ; i<NSPARCCHIPS ; i++) {
arch/sparc/kernel/head.S renamed from linux-2.6.10/arch/sparc/kernel/head.S +4 -0
@@ -835,6 +835,8 @@ cmp %l1, ' ' be 1f + cmp %l1, '2' ! leon2 or compatible + be 1f cmp %l1, 'c' be 1f cmp %l1, 'm'
@@ -857,6 +859,8 @@ be sun4m_init cmp %l1, 'd' ! Let us see how the beast will die be sun4d_init + cmp %l1, '2' ! leon2 or compatible + be sun4c_continue_boot nop /* Jump into mmu context zero. */
arch/sparc/kernel/idprom.c renamed from linux-2.6.10/arch/sparc/kernel/idprom.c +2 -0
@@ -31,6 +31,8 @@ { "Sun 4/200 Series", (SM_SUN4 | SM_4_260) }, { "Sun 4/300 Series", (SM_SUN4 | SM_4_330) }, { "Sun 4/400 Series", (SM_SUN4 | SM_4_470) }, +/* Now Leon */ +{ "Leon2 System-on-a-Chip", (M_LEON2 | M_LEON2_SOC) },/* Now, Sun4c's */ { "Sun4c SparcStation 1", (SM_SUN4C | SM_4C_SS1) }, { "Sun4c SparcStation IPC", (SM_SUN4C | SM_4C_IPC) },
arch/sparc/kernel/irq.c renamed from linux-2.6.10/arch/sparc/kernel/irq.c +5 -0
@@ -579,6 +579,7 @@extern void sun4c_init_IRQ (void );extern void sun4m_init_IRQ (void );extern void sun4d_init_IRQ (void ); +extern void leon_init_IRQ (void );switch (sparc_cpu_model) {case sun4c:
@@ -586,6 +587,10 @@sun4c_init_IRQ ();break ; +case sparc_leon: +leon_init_IRQ (); +break ; +case sun4m:#ifdef CONFIG_PCI pcic_probe ();
arch/sparc/kernel/leon_irq.c renamed from linux-2.6.10/arch/sparc/kernel/leon_irq.c +223 -0
223 lines not on this page · raw message
arch/sparc/kernel/setup.c renamed from linux-2.6.10/arch/sparc/kernel/setup.c +22 -0
@@ -257,6 +257,13 @@int i;unsigned long highest_paddr; +#ifdef CONFIG_LEON_3 +amba_init (); +#ifdef CONFIG_GRLIB_GAISLER_APBUART +console_print_LEON ("Booting Linux\n" ); +#endif +#endif + sparc_ttable = (struct tt_entry *) &start;/* Initialize PROM console and command line. */
@@ -272,6 +279,7 @@if (!strcmp (&cputypval,"sun4d" )) { sparc_cpu_model=sun4d; }if (!strcmp (&cputypval,"sun4e" )) { sparc_cpu_model=sun4e; }if (!strcmp (&cputypval,"sun4u" )) { sparc_cpu_model=sun4u; } +if (!strcmp (&cputypval,"leon2" )) { sparc_cpu_model=sparc_leon; }#ifdef CONFIG_SUN4 if (sparc_cpu_model != sun4) {
@@ -279,6 +287,13 @@ prom_halt(); }#endif +#if defined(CONFIG_LEON ) || defined(CONFIG_LEON_3 ) +/* FIXME: psr ids, asi codes, min nocache pages */ +if (sparc_cpu_model != sparc_leon) { +prom_printf ("This kernel is for Leon architecture only.\n" ); +prom_halt (); + } +#endif printk ("ARCH: " );switch (sparc_cpu_model) {case sun4:
@@ -299,6 +314,9 @@case sun4u:printk ("SUN4U\n" );break ; +case sparc_leon: +printk ("LEON\n" ); +break ;default :printk ("UNKNOWN!\n" );break ;
@@ -309,6 +327,10 @@#elif defined(CONFIG_PROM_CONSOLE ) conswitchp = &prom_con;#endif +#ifdef CONFIG_LEON_3 +amba_prinf_config (); +#endif +boot_flags_init (*cmdline_p);idprom_init ();
arch/sparc/kernel/time.c renamed from linux-2.6.10/arch/sparc/kernel/time.c +26 -0
@@ -43,6 +43,7 @@#include <asm/sun4paddr.h> #include <asm/page.h> #include <asm/pcic.h> +#include <asm/leon.h> extern unsigned long wall_jiffies;
@@ -300,6 +301,9 @@case sun4d: node =prom_getchild (bootbus =prom_searchsiblings (prom_getchild (cpuunit =prom_searchsiblings (node,"cpu-unit" )),"bootbus" ));break ; +case sparc_leon: + node =0 ; +return ;default :prom_printf ("CLOCK: Unsupported architecture!\n" );prom_halt ();
@@ -384,6 +388,11 @@clock_probe ();sparc_init_timers (timer_interrupt); + +if (sparc_cpu_model == sparc_leon) { +local_irq_enable (); +return ; + }#ifdef CONFIG_SUN4 if (idprom->id_machtype == (SM_SUN4 |SM_4_330 )) {
@@ -458,8 +467,25 @@sbus_time_init (); } +#ifdef CONFIG_LEON_3 +extern volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;/* drivers/amba/amba.c:amba_init() */ +extern volatile LEON3_GpTimer_Regs_Map *LEON3_GpTimer_Regs; +extern unsigned long LEON3_GpTimer_Irq;/* drivers/amba.c:amba_init() */ +#endif +extern __inline__unsigned long do_gettimeoffset (void ) { + if (sparc_cpu_model == sparc_leon) +#if defined(CONFIG_LEON ) || defined(CONFIG_LEON_3 ) +#ifdef CONFIG_LEON_3 +return ((LEON_REGLOAD_PA (&LEON3_GpTimer_Regs ->e[0 ].rld)&LEON_TCNT0_MASK ) - + (LEON_REGLOAD_PA (&LEON3_GpTimer_Regs ->e[0 ].val)&LEON_TCNT0_MASK )) >>2 ; +#else +return ((LEON_REGLOAD_PA (LEON_TRLD0 )&LEON_TCNT0_MASK ) - + (LEON_REGLOAD_PA (LEON_TCNT0 )&LEON_TCNT0_MASK )) >>2 ; +#endif +#endif +return (*master_l10_counter >>10 ) &0x1fffff ; }
arch/sparc/kernel/traps.c renamed from linux-2.6.10/arch/sparc/kernel/traps.c +3 -0
@@ -26,6 +26,9 @@#include <asm/kdebug.h> #include <asm/unistd.h> #include <asm/traps.h> +#if defined(CONFIG_LEON ) || defined(CONFIG_LEON_3 ) +#include <asm/leon.h> +#endif /* #define TRAP_DEBUG */
arch/sparc/mm/Makefile renamed from linux-2.6.10/arch/sparc/mm/Makefile +4 -0
@@ -21,3 +21,7 @@ else obj-y += sun4c.o endif + +ifdef CONFIG_LEON +obj-y += leon.o +endif
arch/sparc/mm/init.c renamed from linux-2.6.10/arch/sparc/mm/init.c +15 -0
@@ -32,6 +32,7 @@#include <asm/vaddrs.h> #include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */ #include <asm/tlb.h> +#include <asm/leon.h> DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -324,6 +325,7 @@break ;case sun4m:case sun4d: +case sparc_leon:srmmu_paging_init (); sparc_unmapped_base =0x50000000 ;BTFIXUPSET_SETHI (sparc_unmapped_base,0x50000000 );
@@ -335,6 +337,19 @@prom_halt (); }; + +#ifdef CONFIG_OPEN_ETH +if (sparc_cpu_model == sparc_leon) { +/* until driver/net/open_eth.c is rewritten to access ethermac core's +* registers with asi BYPASS, using sun's DVMA_VADDR range */ +void srmmu_allocate_ptable_skeleton (unsigned long start,unsigned long end); + +srmmu_allocate_ptable_skeleton (DVMA_VADDR ,DVMA_END ); +sparc_mapiorange (0 ,0xb0000000 ,LEON_VA_ETHERMAC ,PAGE_SIZE ); + + } +#endif +/* Initialize the protection map with non-constant, MMU dependent values. */ protection_map[0 ] =PAGE_NONE ; protection_map[1 ] =PAGE_READONLY ;
arch/sparc/mm/leon.c renamed from linux-2.6.10/arch/sparc/mm/leon.c +168 -0
168 lines not on this page · raw message
arch/sparc/mm/loadmmu.c renamed from linux-2.6.10/arch/sparc/mm/loadmmu.c +1 -0
@@ -36,6 +36,7 @@break ;case sun4m:case sun4d: +case sparc_leon:ld_mmu_srmmu ();break ;default :
arch/sparc/mm/srmmu.c renamed from linux-2.6.10/arch/sparc/mm/srmmu.c +151 -2
193 lines not on this page · raw message