diff options
| author | Miles Bader <miles@lsi.nec.co.jp> | 2003-07-17 20:12:08 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-17 20:12:08 -0700 |
| commit | 46c376398a341a46cc85eefaba7f8f058cad0496 (patch) | |
| tree | 0dac228a8f205e739e65c10900637662acafbf78 /include | |
| parent | d20f8c749fa9d1d7b6257cc080666527522490d9 (diff) | |
[PATCH] Add v850 `sim85e2s' port, and cleanup v850e2 code
This patch adds support for the `sim85e2s' simulation of the NA85E2S
processor implementation. As part of this, cache-flushing support for
the common v850e2 cache implementation is added.
It also cleans up a bunch of code that was duplicated between different
v850e2 processors.
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-v850/anna.h | 34 | ||||
| -rw-r--r-- | include/asm-v850/fpga85e2c.h | 24 | ||||
| -rw-r--r-- | include/asm-v850/machdep.h | 3 | ||||
| -rw-r--r-- | include/asm-v850/sim85e2.h | 79 | ||||
| -rw-r--r-- | include/asm-v850/sim85e2c.h | 70 | ||||
| -rw-r--r-- | include/asm-v850/sim85e2s.h | 28 | ||||
| -rw-r--r-- | include/asm-v850/v850e2.h | 69 | ||||
| -rw-r--r-- | include/asm-v850/v850e2_cache.h | 74 |
8 files changed, 260 insertions, 121 deletions
diff --git a/include/asm-v850/anna.h b/include/asm-v850/anna.h index 1bb65a29c0b0..3be77d5ecfce 100644 --- a/include/asm-v850/anna.h +++ b/include/asm-v850/anna.h @@ -1,8 +1,8 @@ /* * include/asm-v850/anna.h -- Anna V850E2 evaluation cpu chip/board * - * Copyright (C) 2001,2002 NEC Corporation - * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org> + * Copyright (C) 2001,02,03 NEC Electronics Corporation + * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this @@ -14,8 +14,9 @@ #ifndef __V850_ANNA_H__ #define __V850_ANNA_H__ +#include <asm/v850e2.h> /* Based on V850E2 core. */ + -#define CPU_ARCH "v850e2" #define CPU_MODEL "v850e2/anna" #define CPU_MODEL_LONG "NEC V850E2/Anna" #define PLATFORM "anna" @@ -48,30 +49,6 @@ /* Anna specific control registers. */ -#define ANNA_CSC_ADDR(n) (0xFFFFF060 + (n) * 2) -#define ANNA_CSC(n) (*(volatile u16 *)ANNA_CSC_ADDR(n)) -#define ANNA_BPC_ADDR 0xFFFFF064 -#define ANNA_BPC (*(volatile u16 *)ANNA_BPC_ADDR) -#define ANNA_BSC_ADDR 0xFFFFF066 -#define ANNA_BSC (*(volatile u16 *)ANNA_BSC_ADDR) -#define ANNA_BEC_ADDR 0xFFFFF068 -#define ANNA_BEC (*(volatile u16 *)ANNA_BEC_ADDR) -#define ANNA_BHC_ADDR 0xFFFFF06A -#define ANNA_BHC (*(volatile u16 *)ANNA_BHC_ADDR) -#define ANNA_BCT_ADDR(n) (0xFFFFF480 + (n) * 2) -#define ANNA_BCT(n) (*(volatile u16 *)ANNA_BCT_ADDR(n)) -#define ANNA_DWC_ADDR(n) (0xFFFFF484 + (n) * 2) -#define ANNA_DWC(n) (*(volatile u16 *)ANNA_DWC_ADDR(n)) -#define ANNA_BCC_ADDR 0xFFFFF488 -#define ANNA_BCC (*(volatile u16 *)ANNA_BCC_ADDR) -#define ANNA_ASC_ADDR 0xFFFFF48A -#define ANNA_ASC (*(volatile u16 *)ANNA_ASC_ADDR) -#define ANNA_LBS_ADDR 0xFFFFF48E -#define ANNA_LBS (*(volatile u16 *)ANNA_LBS_ADDR) -#define ANNA_SCR3_ADDR 0xFFFFF4AC -#define ANNA_SCR3 (*(volatile u16 *)ANNA_SCR3_ADDR) -#define ANNA_RFS3_ADDR 0xFFFFF4AE -#define ANNA_RFS3 (*(volatile u16 *)ANNA_RFS3_ADDR) #define ANNA_ILBEN_ADDR 0xFFFFF7F2 #define ANNA_ILBEN (*(volatile u16 *)ANNA_ILBEN_ADDR) @@ -85,9 +62,6 @@ #define ANNA_PORT_PM(n) (*(volatile u8 *)ANNA_PORT_PM_ADDR(n)) -/* NB85E-style interrupt system. */ -#include <asm/nb85e_intc.h> - /* Hardware-specific interrupt numbers (in the kernel IRQ namespace). */ #define IRQ_INTP(n) (n) /* Pnnn (pin) interrupts 0-15 */ #define IRQ_INTP_NUM 16 diff --git a/include/asm-v850/fpga85e2c.h b/include/asm-v850/fpga85e2c.h index 77d7d22e5ee5..d32f04504b13 100644 --- a/include/asm-v850/fpga85e2c.h +++ b/include/asm-v850/fpga85e2c.h @@ -15,11 +15,10 @@ #ifndef __V850_FPGA85E2C_H__ #define __V850_FPGA85E2C_H__ - +#include <asm/v850e2.h> #include <asm/clinkage.h> -#define CPU_ARCH "v850e2" #define CPU_MODEL "v850e2/fpga85e2c" #define CPU_MODEL_LONG "NEC V850E2/NA85E2C" #define PLATFORM "fpga85e2c" @@ -42,27 +41,6 @@ #define CSDEV_ADDR(n) (0xFFE80110 + 2*(n)) #define CSDEV(n) (*(volatile unsigned char *)CSDEV_ADDR (n)) -/* The BSC register controls bus-sizing. Each memory area CSn uses a pair - of bits N*2 and N*2+1, where 00 means an 8-bit bus size, 01 16-bit, and - 10 32-bit. */ -#define BSC_ADDR 0xFFFFF066 -#define BSC (*(volatile unsigned short *)BSC_ADDR) - -#define DWC_ADDR(n) (0xFFFFF484 + 2*(n)) -#define DWC(n) (*(volatile unsigned short *)DWC_ADDR (n)) - -#define ASC_ADDR 0xFFFFF48A -#define ASC (*(volatile unsigned short *)ASC_ADDR) - -#define BTSC_ADDR 0xFFFFF070 -#define BTSC (*(volatile unsigned short *)BTSC_ADDR) - -#define BHC_ADDR 0xFFFFF06A -#define BHC (*(volatile unsigned short *)BHC_ADDR) - - -/* NB85E-style interrupt system. */ -#include <asm/nb85e_intc.h> /* Timer interrupts 0-3, interrupt at intervals from CLK/4096 to CLK/16384. */ #define IRQ_RPU(n) (60 + (n)) diff --git a/include/asm-v850/machdep.h b/include/asm-v850/machdep.h index 3befbff5c29d..98d8bf63970e 100644 --- a/include/asm-v850/machdep.h +++ b/include/asm-v850/machdep.h @@ -51,6 +51,9 @@ #ifdef CONFIG_V850E2_SIM85E2C #include <asm/sim85e2c.h> #endif +#ifdef CONFIG_V850E2_SIM85E2S +#include <asm/sim85e2s.h> +#endif #ifdef CONFIG_V850E2_FPGA85E2C #include <asm/fpga85e2c.h> #endif diff --git a/include/asm-v850/sim85e2.h b/include/asm-v850/sim85e2.h new file mode 100644 index 000000000000..8cfb5eb13303 --- /dev/null +++ b/include/asm-v850/sim85e2.h @@ -0,0 +1,79 @@ +/* + * include/asm-v850/sim85e2.h -- Machine-dependent defs for + * V850E2 RTL simulator + * + * Copyright (C) 2002,03 NEC Electronics Corporation + * Copyright (C) 2002,03 Miles Bader <miles@gnu.org> + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file COPYING in the main directory of this + * archive for more details. + * + * Written by Miles Bader <miles@gnu.org> + */ + +#ifndef __V850_SIM85E2_H__ +#define __V850_SIM85E2_H__ + + +#include <asm/v850e2.h> /* Based on V850E2 core. */ + + +/* Various memory areas supported by the simulator. + These should match the corresponding definitions in the linker script. */ + +/* `instruction RAM'; instruction fetches are much faster from IRAM than + from DRAM. */ +#define IRAM_ADDR 0 +#define IRAM_SIZE 0x00100000 /* 1MB */ +/* `data RAM', below and contiguous with the I/O space. + Data fetches are much faster from DRAM than from IRAM. */ +#define DRAM_ADDR 0xfff00000 +#define DRAM_SIZE 0x000ff000 /* 1020KB */ +/* `external ram'. Unlike the above RAM areas, this memory is cached, + so both instruction and data fetches should be (mostly) fast -- + however, currently only write-through caching is supported, so writes + to ERAM will be slow. */ +#define ERAM_ADDR 0x00100000 +#define ERAM_SIZE 0x07f00000 /* 127MB (max) */ +/* Dynamic RAM; uses memory controller. */ +#define SDRAM_ADDR 0x10000000 +#if 0 +#define SDRAM_SIZE 0x01000000 /* 16MB */ +#else +#define SDRAM_SIZE 0x00200000 /* Only use 2MB for testing */ +#endif + + +/* Simulator specific control registers. */ +/* NOTHAL controls whether the simulator will stop at a `halt' insn. */ +#define SIM85E2_NOTHAL_ADDR 0xffffff22 +#define SIM85E2_NOTHAL (*(volatile u8 *)SIM85E2_NOTHAL_ADDR) +/* The simulator will stop N cycles after N is written to SIMFIN. */ +#define SIM85E2_SIMFIN_ADDR 0xffffff24 +#define SIM85E2_SIMFIN (*(volatile u16 *)SIM85E2_SIMFIN_ADDR) + + +/* For <asm/irq.h> */ +#define NUM_CPU_IRQS 64 + + +/* For <asm/page.h> */ +#define PAGE_OFFSET SDRAM_ADDR + + +/* For <asm/entry.h> */ +/* `R0 RAM', used for a few miscellaneous variables that must be accessible + using a load instruction relative to R0. The sim85e2 simulator + actually puts 1020K of RAM from FFF00000 to FFFFF000, so we arbitarily + choose a small portion at the end of that. */ +#define R0_RAM_ADDR 0xFFFFE000 + + +/* For <asm/param.h> */ +#ifndef HZ +#define HZ 24 /* Minimum supported frequency. */ +#endif + + +#endif /* __V850_SIM85E2_H__ */ diff --git a/include/asm-v850/sim85e2c.h b/include/asm-v850/sim85e2c.h index 12b87873bdef..eee543ff3af8 100644 --- a/include/asm-v850/sim85e2c.h +++ b/include/asm-v850/sim85e2c.h @@ -15,78 +15,12 @@ #ifndef __V850_SIM85E2C_H__ #define __V850_SIM85E2C_H__ +/* Use generic sim85e2 settings, other than the various names. */ +#include <asm/sim85e2.h> -#define CPU_ARCH "v850e2" #define CPU_MODEL "v850e2" #define CPU_MODEL_LONG "NEC V850E2" #define PLATFORM "sim85e2c" #define PLATFORM_LONG "SIM85E2C V850E2 simulator" - -/* Various memory areas supported by the simulator. - These should match the corresponding definitions in the linker script. */ - -/* `instruction RAM'; instruction fetches are much faster from IRAM than - from DRAM. */ -#define IRAM_ADDR 0 -#define IRAM_SIZE 0x00100000 /* 1MB */ -/* `data RAM', below and contiguous with the I/O space. - Data fetches are much faster from DRAM than from IRAM. */ -#define DRAM_ADDR 0xfff00000 -#define DRAM_SIZE 0x000ff000 /* 1020KB */ -/* `external ram'. Unlike the above RAM areas, this memory is cached, - so both instruction and data fetches should be (mostly) fast -- - however, currently only write-through caching is supported, so writes - to ERAM will be slow. */ -#define ERAM_ADDR 0x00100000 -#define ERAM_SIZE 0x07f00000 /* 127MB (max) */ - - -/* CPU core control registers; these should be expanded and moved into - separate header files when we support some other processors based on - the same E2 core. */ -/* Bus Transaction Control Register */ -#define NA85E2C_CACHE_BTSC_ADDR 0xfffff070 -#define NA85E2C_CACHE_BTSC (*(volatile unsigned short *)NA85E2C_CACHE_BTSC_ADDR) -#define NA85E2C_CACHE_BTSC_ICM 0x1 /* icache enable */ -#define NA85E2C_CACHE_BTSC_DCM0 0x4 /* dcache enable, bit 0 */ -#define NA85E2C_CACHE_BTSC_DCM1 0x8 /* dcache enable, bit 1 */ -/* Cache Configuration Register */ -#define NA85E2C_BUSM_BHC_ADDR 0xfffff06a -#define NA85E2C_BUSM_BHC (*(volatile unsigned short *)NA85E2C_BUSM_BHC_ADDR) - -/* Simulator specific control registers. */ -/* NOTHAL controls whether the simulator will stop at a `halt' insn. */ -#define NOTHAL_ADDR 0xffffff22 -#define NOTHAL (*(volatile unsigned char *)NOTHAL_ADDR) -/* The simulator will stop N cycles after N is written to SIMFIN. */ -#define SIMFIN_ADDR 0xffffff24 -#define SIMFIN (*(volatile unsigned short *)SIMFIN_ADDR) - - -/* The simulator has an nb85e-style interrupt system. */ -#include <asm/nb85e_intc.h> - -/* For <asm/irq.h> */ -#define NUM_CPU_IRQS 64 - - -/* For <asm/page.h> */ -#define PAGE_OFFSET DRAM_ADDR - - -/* For <asm/entry.h> */ -/* `R0 RAM', used for a few miscellaneous variables that must be accessible - using a load instruction relative to R0. The sim85e2c simulator - actually puts 1020K of RAM from FFF00000 to FFFFF000, so we arbitarily - choose a small portion at the end of that. */ -#define R0_RAM_ADDR 0xFFFFE000 - - -/* For <asm/param.h> */ -#ifndef HZ -#define HZ 24 /* Minimum supported frequency. */ -#endif - - #endif /* __V850_SIM85E2C_H__ */ diff --git a/include/asm-v850/sim85e2s.h b/include/asm-v850/sim85e2s.h new file mode 100644 index 000000000000..ee066d5d3c51 --- /dev/null +++ b/include/asm-v850/sim85e2s.h @@ -0,0 +1,28 @@ +/* + * include/asm-v850/sim85e2s.h -- Machine-dependent defs for + * V850E2 RTL simulator + * + * Copyright (C) 2003 NEC Electronics Corporation + * Copyright (C) 2003 Miles Bader <miles@gnu.org> + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file COPYING in the main directory of this + * archive for more details. + * + * Written by Miles Bader <miles@gnu.org> + */ + +#ifndef __V850_SIM85E2S_H__ +#define __V850_SIM85E2S_H__ + +#include <asm/sim85e2.h> /* Use generic sim85e2 settings. */ +#if 0 +#include <asm/v850e2_cache.h> /* + cache */ +#endif + +#define CPU_MODEL "v850e2" +#define CPU_MODEL_LONG "NEC V850E2" +#define PLATFORM "sim85e2s" +#define PLATFORM_LONG "SIM85E2S V850E2 simulator" + +#endif /* __V850_SIM85E2S_H__ */ diff --git a/include/asm-v850/v850e2.h b/include/asm-v850/v850e2.h new file mode 100644 index 000000000000..48680408ab7e --- /dev/null +++ b/include/asm-v850/v850e2.h @@ -0,0 +1,69 @@ +/* + * include/asm-v850/v850e2.h -- Machine-dependent defs for V850E2 CPUs + * + * Copyright (C) 2002,03 NEC Electronics Corporation + * Copyright (C) 2002,03 Miles Bader <miles@gnu.org> + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file COPYING in the main directory of this + * archive for more details. + * + * Written by Miles Bader <miles@gnu.org> + */ + +#ifndef __V850_V850E2_H__ +#define __V850_V850E2_H__ + +#include <asm/v850e_intc.h> /* v850e-style interrupt system. */ + + +#define CPU_ARCH "v850e2" + + +/* Control registers. */ + +/* Chip area select control */ +#define V850E2_CSC_ADDR(n) (0xFFFFF060 + (n) * 2) +#define V850E2_CSC(n) (*(volatile u16 *)V850E2_CSC_ADDR(n)) +/* I/O area select control */ +#define V850E2_BPC_ADDR 0xFFFFF064 +#define V850E2_BPC (*(volatile u16 *)V850E2_BPC_ADDR) +/* Bus size configuration */ +#define V850E2_BSC_ADDR 0xFFFFF066 +#define V850E2_BSC (*(volatile u16 *)V850E2_BSC_ADDR) +/* Endian configuration */ +#define V850E2_BEC_ADDR 0xFFFFF068 +#define V850E2_BEC (*(volatile u16 *)V850E2_BEC_ADDR) +/* Cache configuration */ +#define V850E2_BHC_ADDR 0xFFFFF06A +#define V850E2_BHC (*(volatile u16 *)V850E2_BHC_ADDR) +/* NPB strobe-wait configuration */ +#define V850E2_VSWC_ADDR 0xFFFFF06E +#define V850E2_VSWC (*(volatile u16 *)V850E2_VSWC_ADDR) +/* Bus cycle type */ +#define V850E2_BCT_ADDR(n) (0xFFFFF480 + (n) * 2) +#define V850E2_BCT(n) (*(volatile u16 *)V850E2_BCT_ADDR(n)) +/* Data wait control */ +#define V850E2_DWC_ADDR(n) (0xFFFFF484 + (n) * 2) +#define V850E2_DWC(n) (*(volatile u16 *)V850E2_DWC_ADDR(n)) +/* Bus cycle control */ +#define V850E2_BCC_ADDR 0xFFFFF488 +#define V850E2_BCC (*(volatile u16 *)V850E2_BCC_ADDR) +/* Address wait control */ +#define V850E2_ASC_ADDR 0xFFFFF48A +#define V850E2_ASC (*(volatile u16 *)V850E2_ASC_ADDR) +/* Local bus sizing control */ +#define V850E2_LBS_ADDR 0xFFFFF48E +#define V850E2_LBS (*(volatile u16 *)V850E2_LBS_ADDR) +/* Line buffer control */ +#define V850E2_LBC_ADDR(n) (0xFFFFF490 + (n) * 2) +#define V850E2_LBC(n) (*(volatile u16 *)V850E2_LBC_ADDR(n)) +/* SDRAM configuration */ +#define V850E2_SCR_ADDR(n) (0xFFFFF4A0 + (n) * 4) +#define V850E2_SCR(n) (*(volatile u16 *)V850E2_SCR_ADDR(n)) +/* SDRAM refresh cycle control */ +#define V850E2_RFS_ADDR(n) (0xFFFFF4A2 + (n) * 4) +#define V850E2_RFS(n) (*(volatile u16 *)V850E2_RFS_ADDR(n)) + + +#endif /* __V850_V850E2_H__ */ diff --git a/include/asm-v850/v850e2_cache.h b/include/asm-v850/v850e2_cache.h new file mode 100644 index 000000000000..61acda1023e8 --- /dev/null +++ b/include/asm-v850/v850e2_cache.h @@ -0,0 +1,74 @@ +/* + * include/asm-v850/v850e2_cache_cache.h -- Cache control for V850E2 + * cache memories + * + * Copyright (C) 2003 NEC Electronics Corporation + * Copyright (C) 2003 Miles Bader <miles@gnu.org> + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file COPYING in the main directory of this + * archive for more details. + * + * Written by Miles Bader <miles@gnu.org> + */ + +#ifndef __V850_V850E2_CACHE_H__ +#define __V850_V850E2_CACHE_H__ + +#include <asm/types.h> + + +/* Cache control registers. */ + +/* Bus Transaction Control */ +#define V850E2_CACHE_BTSC_ADDR 0xFFFFF070 +#define V850E2_CACHE_BTSC (*(volatile u16 *)V850E2_CACHE_BTSC_ADDR) +#define V850E2_CACHE_BTSC_ICM 0x0001 /* icache enable */ +#define V850E2_CACHE_BTSC_DCM0 0x0004 /* dcache enable, bit 0 */ +#define V850E2_CACHE_BTSC_DCM1 0x0008 /* dcache enable, bit 1 */ +#define V850E2_CACHE_BTSC_DCM_WT /* write-through */ \ + V850E2_CACHE_BTSC_DCM0 +#ifdef CONFIG_V850E2_V850E2S +# define V850E2_CACHE_BTSC_DCM_WB_NO_ALLOC /* write-back, non-alloc */ \ + V850E2_CACHE_BTSC_DCM1 +# define V850E2_CACHE_BTSC_DCM_WB_ALLOC /* write-back, non-alloc */ \ + (V850E2_CACHE_BTSC_DCM1 | V850E2_CACHE_BTSC_DCM0) +# define V850E2_CACHE_BTSC_ISEQ 0x0010 /* icache `address sequence mode' */ +# define V850E2_CACHE_BTSC_DSEQ 0x0020 /* dcache `address sequence mode' */ +# define V850E2_CACHE_BTSC_IRFC 0x0030 +# define V850E2_CACHE_BTSC_ILCD 0x4000 +# define V850E2_CACHE_BTSC_VABE 0x8000 +#endif /* CONFIG_V850E2_V850E2S */ + +/* Cache operation start address register (low-bits). */ +#define V850E2_CACHE_CADL_ADDR 0xFFFFF074 +#define V850E2_CACHE_CADL (*(volatile u16 *)V850E2_CACHE_CADL_ADDR) +/* Cache operation start address register (high-bits). */ +#define V850E2_CACHE_CADH_ADDR 0xFFFFF076 +#define V850E2_CACHE_CADH (*(volatile u16 *)V850E2_CACHE_CADH_ADDR) +/* Cache operation count register. */ +#define V850E2_CACHE_CCNT_ADDR 0xFFFFF078 +#define V850E2_CACHE_CCNT (*(volatile u16 *)V850E2_CACHE_CCNT_ADDR) +/* Cache operation specification register. */ +#define V850E2_CACHE_COPR_ADDR 0xFFFFF07A +#define V850E2_CACHE_COPR (*(volatile u16 *)V850E2_CACHE_COPR_ADDR) +#define V850E2_CACHE_COPR_STRT 0x0001 /* start cache operation */ +#define V850E2_CACHE_COPR_LBSL 0x0100 /* 0 = icache, 1 = dcache */ +#define V850E2_CACHE_COPR_WSLE 0x0200 /* operate on cache way */ +#define V850E2_CACHE_COPR_WSL(way) ((way) * 0x0400) /* way select */ +#define V850E2_CACHE_COPR_CFC(op) ((op) * 0x1000) /* cache function code */ + + +/* Size of a cache line in bytes. */ +#define V850E2_CACHE_LINE_SIZE_BITS 4 +#define V850E2_CACHE_LINE_SIZE (1 << V850E2_CACHE_LINE_SIZE_BITS) + +/* The size of each cache `way' in lines. */ +#define V850E2_CACHE_WAY_SIZE 256 + + +/* For <asm/cache.h> */ +#define L1_CACHE_BYTES V850E2_CACHE_LINE_SIZE + + +#endif /* __V850_V850E2_CACHE_H__ */ |
