LEON SPARC V8 processor support for linux-2.6.10
PATCH 1/7 LEON SPARC V8 processor support for linux-2.6.10
linux-2.6.10: Kernel patches:
[1/7] diff2.6.10_include_asm_sparc.diff: diff for include/asm-sparc
include/asm-sparc/amba.h renamed from linux-2.6.10/include/asm-sparc/amba.h +193 -0
@@ -0,0 +1,193 @@ +/* +* Copyright (C) 2004 Konrad Eisele ([email protected]), Gaisler Research +*/ + +#ifndef _LEON3_AMBA_H__ +#define _LEON3_AMBA_H__ + +/* +* AMBA Plag & Play Bus Driver Macros +* +* Macros used for AMBA Plug & Play bus scanning +* +* COPYRIGHT (c) 2004. +* Gaisler Research +* +* The license and distribution terms for this file may be +* found in the file LICENSE in this distribution or at +* http://www.rtems.com/license/LICENSE. +* +*/ + + +#define LEON3_IO_AREA 0xfff00000 +#define LEON3_CONF_AREA 0xff000 +#define LEON3_AHB_SLAVE_CONF_AREA (1 << 11) + +#define LEON3_AHB_CONF_WORDS 8 +#define LEON3_APB_CONF_WORDS 2 +#define LEON3_AHB_MASTERS 8 +#define LEON3_AHB_SLAVES 8 +#define LEON3_APB_SLAVES 16 +#define LEON3_APBUARTS 8 + +/* Vendor codes */ +#define VENDOR_GAISLER 1 +#define VENDOR_PENDER 2 +#define VENDOR_ESA 4 +#define VENDOR_OPENCORES 8 + +/* Gaisler Research device id's */ +#define GAISLER_LEON3 0x003 +#define GAISLER_LEON3DSU 0x004 +#define GAISLER_ETHAHB 0x005 +#define GAISLER_APBMST 0x006 +#define GAISLER_AHBUART 0x007 +#define GAISLER_SRCTRL 0x008 +#define GAISLER_SDCTRL 0x009 +#define GAISLER_APBUART 0x00C +#define GAISLER_IRQMP 0x00D +#define GAISLER_AHBRAM 0x00E +#define GAISLER_GPTIMER 0x011 +#define GAISLER_PCITRG 0x012 +#define GAISLER_PCISBRG 0x013 +#define GAISLER_PCIFBRG 0x014 +#define GAISLER_PCITRACE 0x015 +#define GAISLER_PCIDMA 0x016 +#define GAISLER_AHBTRACE 0x017 +#define GAISLER_ETHDSU 0x018 + +#define GAISLER_L2TIME 0xffd/* internal device: leon2 timer */ +#define GAISLER_L2C 0xffe/* internal device: leon2compat */ +#define GAISLER_PLUGPLAY 0xfff/* internal device: plug & play configarea */ + + +#ifndef __ASSEMBLER__ + +extern inline char *gaisler_device_str (int id) { +switch (id) { +case GAISLER_LEON3 :return "GAISLER_LEON3" ; +case GAISLER_LEON3DSU :return "GAISLER_LEON3DSU" ; +case GAISLER_ETHAHB :return "GAISLER_ETHAHB" ; +case GAISLER_APBMST :return "GAISLER_APBMST" ; +case GAISLER_AHBUART :return "GAISLER_AHBUART" ; +case GAISLER_SRCTRL :return "GAISLER_SRCTRL" ; +case GAISLER_SDCTRL :return "GAISLER_SDCTRL" ; +case GAISLER_APBUART :return "GAISLER_APBUART" ; +case GAISLER_IRQMP :return "GAISLER_IRQMP" ; +case GAISLER_AHBRAM :return "GAISLER_AHBRAM" ; +case GAISLER_GPTIMER :return "GAISLER_GPTIMER" ; +case GAISLER_PCITRG :return "GAISLER_PCITRG" ; +case GAISLER_PCISBRG :return "GAISLER_PCISBRG" ; +case GAISLER_PCIFBRG :return "GAISLER_PCIFBRG" ; +case GAISLER_PCITRACE :return "GAISLER_PCITRACE" ; +case GAISLER_AHBTRACE :return "GAISLER_AHBTRACE" ; +case GAISLER_ETHDSU :return "GAISLER_ETHDSU" ; + +case GAISLER_L2TIME :return "GAISLER_L2TIME" ; +case GAISLER_L2C :return "GAISLER_L2C" ; +case GAISLER_PLUGPLAY :return "GAISLER_PLUGPLAY" ; + +default :break ; + } +return 0 ; +} + +#endif + +/* European Space Agency device id's */ +#define ESA_LEON2 0x2 +#define ESA_MCTRL 0xF + + +#ifndef __ASSEMBLER__ + +extern inline char *esa_device_str (int id) { +switch (id) { +case ESA_LEON2 :return "ESA_LEON2" ; +case ESA_MCTRL :return "ESA_MCTRL" ; +default :break ; + } +return 0 ; +} + +#endif + +/* Opencores device id's */ +#define OPENCORES_PCIBR 0x4 +#define OPENCORES_ETHMAC 0x5 + + +#ifndef __ASSEMBLER__ + +extern inline char *opencores_device_str (int id) { +switch (id) { +case OPENCORES_PCIBR :return "OPENCORES_PCIBR" ; +case OPENCORES_ETHMAC :return "OPENCORES_ETHMAC" ; +default :break ; + } +return 0 ; +} + +extern inline char *device_id2str (int vendor,int id) { +switch (vendor) { +case VENDOR_GAISLER :return gaisler_device_str (id); +case VENDOR_ESA :return esa_device_str (id); +case VENDOR_OPENCORES :return opencores_device_str (id); +case VENDOR_PENDER : +default :break ; + } +return 0 ; +} + +extern inline char *vendor_id2str (int vendor) { +switch (vendor) { +case VENDOR_GAISLER :return "VENDOR_GAISLER" ; +case VENDOR_ESA :return "VENDOR_ESA" ; +case VENDOR_OPENCORES :return "VENDOR_OPENCORES" ; +case VENDOR_PENDER :return "VENDOR_PENDER" ; +default :break ; + } +return 0 ; +} + +#endif + +/* Vendor codes */ + + + +/* +* +* Macros for manipulating Configuration registers +* +*/ + +#define LEON3_BYPASS_LOAD_PA (x) (leon_load_reg ((unsigned long)(x))) +#define LEON3_BYPASS_STORE_PA (x,v) (leon_store_reg ((unsigned long)(x),(unsigned long)(v))) + +#define amba_get_confword (tab, index, word) (LEON3_BYPASS_LOAD_PA((tab).addr[(index)]+(word))) + +#define amba_vendor (x) (((x) >> 24) & 0xff) + +#define amba_device (x) (((x) >> 12) & 0xfff) + +#define amba_ahb_get_membar (tab, index, nr) (LEON3_BYPASS_LOAD_PA((tab).addr[(index)]+4+(nr))) + +#define amba_apb_get_membar (tab, index) (LEON3_BYPASS_LOAD_PA((tab).addr[(index)]+1)) + +#define amba_membar_start (mbar) (((mbar) & 0xfff00000) & (((mbar) & 0xfff0) << 16)) + +#define amba_iobar_start (base, iobar) ((base) | ((((iobar) & 0xfff00000)>>12) & (((iobar) & 0xfff0)<<4)) ) + +#define amba_irq (conf) ((conf) & 0xf) + +#define amba_membar_type (mbar) ((mbar) & 0xf) + +#define AMBA_TYPE_APBIO 0x1 +#define AMBA_TYPE_MEM 0x2 +#define AMBA_TYPE_AHBIO 0x3 + +#define AMBA_TYPE_AHBIO_ADDR (addr) (LEON3_IO_AREA | ((addr) >> 12)) +#endif +
include/asm-sparc/asi.h renamed from linux-2.6.10/include/asm-sparc/asi.h +6 -0
@@ -108,4 +108,10 @@#define ASI_M_ACTION 0x4c/* Breakpoint Action Register (GNU/Viking) */ +/* FIXME: non-standard Leon ASI definition */ +#ifdef CONFIG_LEON +#undef ASI_M_MMUREGS +#define ASI_M_MMUREGS 0x19 +#endif /* CONFIG_LEON */ +#endif /* _SPARC_ASI_H */
include/asm-sparc/leon.h renamed from linux-2.6.10/include/asm-sparc/leon.h +270 -0
270 lines not on this page · raw message
include/asm-sparc/leon3.h renamed from linux-2.6.10/include/asm-sparc/leon3.h +123 -0
123 lines not on this page · raw message
include/asm-sparc/machines.h renamed from linux-2.6.10/include/asm-sparc/machines.h +5 -1
@@ -15,7 +15,7 @@/* 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 16extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES ];
@@ -32,6 +32,7 @@#define SM_ARCH_MASK 0xf0#define SM_SUN4 0x20 +#define M_LEON2 0x30#define SM_SUN4C 0x50#define SM_SUN4M 0x70#define SM_SUN4M_OBP 0x80
@@ -43,6 +44,9 @@#define SM_4_330 0x03/* Sun 4/300 series */ #define SM_4_470 0x04/* Sun 4/400 series */ +/* Leon machines */ +#define M_LEON2_SOC 0x01/* Leon2 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 */
include/asm-sparc/system.h renamed from linux-2.6.10/include/asm-sparc/system.h +1 -0
@@ -29,6 +29,7 @@ sun4u =0x05 ,/* V8 ploos ploos */ sun_unknown =0x06 , ap1000 =0x07 ,/* almost a sun4m */ + sparc_leon = 0x08, /* Leon2 SoC */ };/* Really, userland should not be looking at any of this... */
include/asm-sparc/vaddrs.h renamed from linux-2.6.10/include/asm-sparc/vaddrs.h +4 -0
@@ -17,7 +17,11 @@#define SRMMU_NOCACHE_VADDR (KERNBASE + SRMMU_MAXMEM)/* = 0x0fc000000 */ /* XXX Empiricals - this needs to go away - KMW */ +#if defined(CONFIG_LEON ) || defined(CONFIG_LEON_3 ) +#define SRMMU_MIN_NOCACHE_PAGES (128) +#else #define SRMMU_MIN_NOCACHE_PAGES (550) +#endif #define SRMMU_MAX_NOCACHE_PAGES (1280)/* The following constant is used in mm/srmmu.c::srmmu_nocache_calcsize()
On Maw, 2005-01-04 at 19:03, Jiri Gaisler wrote
Quoted 3 lines
+ * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE.
Legalese hat on
Please don't do this. Suppose the file changes or the site goes away. Include a copy of the license in the patch set directly.
linux-2.6.10: Kernel patches, updated.
[1/7] diff2.6.10_include_asm_sparc.diff: diff for include/asm-sparc
Quoted 14 lines · Alan Cox
On Maw, 2005-01-04 at 19:03, Jiri Gaisler wrote
Quoted 3 lines
+ * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE.Legalese hat on
Please don't do this. Suppose the file changes or the site goes away. Include a copy of the license in the patch set directly.
.
Signature · 4 lines
-------------------------------------------------------------------------- Gaisler Research, 1:a Långgatan 19, 413 27 Goteborg, Sweden, +46-317758650 fax: +46-31421407 email: [email protected], home page: www.gaisler.com --------------------------------------------------------------------------
include/asm-sparc/amba.h renamed from linux-2.6.10/include/asm-sparc/amba.h +178 -0
@@ -0,0 +1,178 @@ +/* +* Copyright (C) Gaisler Research, 2004 (Konrad Eisele <[email protected]>) +*/ + +#ifndef _LEON3_AMBA_H__ +#define _LEON3_AMBA_H__ + +#define LEON3_IO_AREA 0xfff00000 +#define LEON3_CONF_AREA 0xff000 +#define LEON3_AHB_SLAVE_CONF_AREA (1 << 11) + +#define LEON3_AHB_CONF_WORDS 8 +#define LEON3_APB_CONF_WORDS 2 +#define LEON3_AHB_MASTERS 8 +#define LEON3_AHB_SLAVES 8 +#define LEON3_APB_SLAVES 16 +#define LEON3_APBUARTS 8 + +/* Vendor codes */ +#define VENDOR_GAISLER 1 +#define VENDOR_PENDER 2 +#define VENDOR_ESA 4 +#define VENDOR_OPENCORES 8 + +/* Gaisler Research device id's */ +#define GAISLER_LEON3 0x003 +#define GAISLER_LEON3DSU 0x004 +#define GAISLER_ETHAHB 0x005 +#define GAISLER_APBMST 0x006 +#define GAISLER_AHBUART 0x007 +#define GAISLER_SRCTRL 0x008 +#define GAISLER_SDCTRL 0x009 +#define GAISLER_APBUART 0x00C +#define GAISLER_IRQMP 0x00D +#define GAISLER_AHBRAM 0x00E +#define GAISLER_GPTIMER 0x011 +#define GAISLER_PCITRG 0x012 +#define GAISLER_PCISBRG 0x013 +#define GAISLER_PCIFBRG 0x014 +#define GAISLER_PCITRACE 0x015 +#define GAISLER_PCIDMA 0x016 +#define GAISLER_AHBTRACE 0x017 +#define GAISLER_ETHDSU 0x018 + +#define GAISLER_L2TIME 0xffd/* internal device: leon2 timer */ +#define GAISLER_L2C 0xffe/* internal device: leon2compat */ +#define GAISLER_PLUGPLAY 0xfff/* internal device: plug & play configarea */ + + +#ifndef __ASSEMBLER__ + +extern inline char *gaisler_device_str (int id) { +switch (id) { +case GAISLER_LEON3 :return "GAISLER_LEON3" ; +case GAISLER_LEON3DSU :return "GAISLER_LEON3DSU" ; +case GAISLER_ETHAHB :return "GAISLER_ETHAHB" ; +case GAISLER_APBMST :return "GAISLER_APBMST" ; +case GAISLER_AHBUART :return "GAISLER_AHBUART" ; +case GAISLER_SRCTRL :return "GAISLER_SRCTRL" ; +case GAISLER_SDCTRL :return "GAISLER_SDCTRL" ; +case GAISLER_APBUART :return "GAISLER_APBUART" ; +case GAISLER_IRQMP :return "GAISLER_IRQMP" ; +case GAISLER_AHBRAM :return "GAISLER_AHBRAM" ; +case GAISLER_GPTIMER :return "GAISLER_GPTIMER" ; +case GAISLER_PCITRG :return "GAISLER_PCITRG" ; +case GAISLER_PCISBRG :return "GAISLER_PCISBRG" ; +case GAISLER_PCIFBRG :return "GAISLER_PCIFBRG" ; +case GAISLER_PCITRACE :return "GAISLER_PCITRACE" ; +case GAISLER_AHBTRACE :return "GAISLER_AHBTRACE" ; +case GAISLER_ETHDSU :return "GAISLER_ETHDSU" ; + +case GAISLER_L2TIME :return "GAISLER_L2TIME" ; +case GAISLER_L2C :return "GAISLER_L2C" ; +case GAISLER_PLUGPLAY :return "GAISLER_PLUGPLAY" ; + +default :break ; + } +return 0 ; +} + +#endif + +/* European Space Agency device id's */ +#define ESA_LEON2 0x2 +#define ESA_MCTRL 0xF + + +#ifndef __ASSEMBLER__ + +extern inline char *esa_device_str (int id) { +switch (id) { +case ESA_LEON2 :return "ESA_LEON2" ; +case ESA_MCTRL :return "ESA_MCTRL" ; +default :break ; + } +return 0 ; +} + +#endif + +/* Opencores device id's */ +#define OPENCORES_PCIBR 0x4 +#define OPENCORES_ETHMAC 0x5 + + +#ifndef __ASSEMBLER__ + +extern inline char *opencores_device_str (int id) { +switch (id) { +case OPENCORES_PCIBR :return "OPENCORES_PCIBR" ; +case OPENCORES_ETHMAC :return "OPENCORES_ETHMAC" ; +default :break ; + } +return 0 ; +} + +extern inline char *device_id2str (int vendor,int id) { +switch (vendor) { +case VENDOR_GAISLER :return gaisler_device_str (id); +case VENDOR_ESA :return esa_device_str (id); +case VENDOR_OPENCORES :return opencores_device_str (id); +case VENDOR_PENDER : +default :break ; + } +return 0 ; +} + +extern inline char *vendor_id2str (int vendor) { +switch (vendor) { +case VENDOR_GAISLER :return "VENDOR_GAISLER" ; +case VENDOR_ESA :return "VENDOR_ESA" ; +case VENDOR_OPENCORES :return "VENDOR_OPENCORES" ; +case VENDOR_PENDER :return "VENDOR_PENDER" ; +default :break ; + } +return 0 ; +} + +#endif + +/* Vendor codes */ + + + +/* +* +* Macros for manipulating Configuration registers +* +*/ + +#define LEON3_BYPASS_LOAD_PA (x) (leon_load_reg ((unsigned long)(x))) +#define LEON3_BYPASS_STORE_PA (x,v) (leon_store_reg ((unsigned long)(x),(unsigned long)(v))) + +#define amba_get_confword (tab, index, word) (LEON3_BYPASS_LOAD_PA((tab).addr[(index)]+(word))) + +#define amba_vendor (x) (((x) >> 24) & 0xff) + +#define amba_device (x) (((x) >> 12) & 0xfff) + +#define amba_ahb_get_membar (tab, index, nr) (LEON3_BYPASS_LOAD_PA((tab).addr[(index)]+4+(nr))) + +#define amba_apb_get_membar (tab, index) (LEON3_BYPASS_LOAD_PA((tab).addr[(index)]+1)) + +#define amba_membar_start (mbar) (((mbar) & 0xfff00000) & (((mbar) & 0xfff0) << 16)) + +#define amba_iobar_start (base, iobar) ((base) | ((((iobar) & 0xfff00000)>>12) & (((iobar) & 0xfff0)<<4)) ) + +#define amba_irq (conf) ((conf) & 0xf) + +#define amba_membar_type (mbar) ((mbar) & 0xf) + +#define AMBA_TYPE_APBIO 0x1 +#define AMBA_TYPE_MEM 0x2 +#define AMBA_TYPE_AHBIO 0x3 + +#define AMBA_TYPE_AHBIO_ADDR (addr) (LEON3_IO_AREA | ((addr) >> 12)) +#endif +
include/asm-sparc/asi.h renamed from linux-2.6.10/include/asm-sparc/asi.h +6 -0
@@ -108,4 +108,10 @@#define ASI_M_ACTION 0x4c/* Breakpoint Action Register (GNU/Viking) */ +/* FIXME: non-standard Leon ASI definition */ +#ifdef CONFIG_LEON +#undef ASI_M_MMUREGS +#define ASI_M_MMUREGS 0x19 +#endif /* CONFIG_LEON */ +#endif /* _SPARC_ASI_H */
include/asm-sparc/leon.h renamed from linux-2.6.10/include/asm-sparc/leon.h +270 -0
270 lines not on this page · raw message
include/asm-sparc/leon3.h renamed from linux-2.6.10/include/asm-sparc/leon3.h +123 -0
123 lines not on this page · raw message
include/asm-sparc/machines.h renamed from linux-2.6.10/include/asm-sparc/machines.h +5 -1
@@ -15,7 +15,7 @@/* 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 16extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES ];
@@ -32,6 +32,7 @@#define SM_ARCH_MASK 0xf0#define SM_SUN4 0x20 +#define M_LEON2 0x30#define SM_SUN4C 0x50#define SM_SUN4M 0x70#define SM_SUN4M_OBP 0x80
@@ -43,6 +44,9 @@#define SM_4_330 0x03/* Sun 4/300 series */ #define SM_4_470 0x04/* Sun 4/400 series */ +/* Leon machines */ +#define M_LEON2_SOC 0x01/* Leon2 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 */
include/asm-sparc/system.h renamed from linux-2.6.10/include/asm-sparc/system.h +1 -0
@@ -29,6 +29,7 @@ sun4u =0x05 ,/* V8 ploos ploos */ sun_unknown =0x06 , ap1000 =0x07 ,/* almost a sun4m */ + sparc_leon = 0x08, /* Leon2 SoC */ };/* Really, userland should not be looking at any of this... */
include/asm-sparc/vaddrs.h renamed from linux-2.6.10/include/asm-sparc/vaddrs.h +4 -0
@@ -17,7 +17,11 @@#define SRMMU_NOCACHE_VADDR (KERNBASE + SRMMU_MAXMEM)/* = 0x0fc000000 */ /* XXX Empiricals - this needs to go away - KMW */ +#if defined(CONFIG_LEON ) || defined(CONFIG_LEON_3 ) +#define SRMMU_MIN_NOCACHE_PAGES (128) +#else #define SRMMU_MIN_NOCACHE_PAGES (550) +#endif #define SRMMU_MAX_NOCACHE_PAGES (1280)/* The following constant is used in mm/srmmu.c::srmmu_nocache_calcsize()