aboutsummaryrefslogtreecommitdiff
path: root/arch/v850/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/v850/kernel
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/v850/kernel')
-rw-r--r--arch/v850/kernel/Makefile40
-rw-r--r--arch/v850/kernel/anna-rom.ld16
-rw-r--r--arch/v850/kernel/anna.c208
-rw-r--r--arch/v850/kernel/anna.ld20
-rw-r--r--arch/v850/kernel/as85ep1-rom.ld21
-rw-r--r--arch/v850/kernel/as85ep1.c240
-rw-r--r--arch/v850/kernel/as85ep1.ld49
-rw-r--r--arch/v850/kernel/asm-consts.c61
-rw-r--r--arch/v850/kernel/bug.c142
-rw-r--r--arch/v850/kernel/entry.S1121
-rw-r--r--arch/v850/kernel/fpga85e2c.c171
-rw-r--r--arch/v850/kernel/fpga85e2c.ld62
-rw-r--r--arch/v850/kernel/gbus_int.c271
-rw-r--r--arch/v850/kernel/head.S128
-rw-r--r--arch/v850/kernel/highres_timer.c132
-rw-r--r--arch/v850/kernel/init_task.c49
-rw-r--r--arch/v850/kernel/intv.S87
-rw-r--r--arch/v850/kernel/irq.c744
-rw-r--r--arch/v850/kernel/ma.c70
-rw-r--r--arch/v850/kernel/mach.c17
-rw-r--r--arch/v850/kernel/mach.h56
-rw-r--r--arch/v850/kernel/me2.c74
-rw-r--r--arch/v850/kernel/memcons.c135
-rw-r--r--arch/v850/kernel/module.c237
-rw-r--r--arch/v850/kernel/process.c236
-rw-r--r--arch/v850/kernel/procfs.c67
-rw-r--r--arch/v850/kernel/ptrace.c282
-rw-r--r--arch/v850/kernel/rte_cb.c200
-rw-r--r--arch/v850/kernel/rte_cb_leds.c138
-rw-r--r--arch/v850/kernel/rte_cb_multi.c121
-rw-r--r--arch/v850/kernel/rte_ma1_cb-rom.ld14
-rw-r--r--arch/v850/kernel/rte_ma1_cb.c106
-rw-r--r--arch/v850/kernel/rte_ma1_cb.ld57
-rw-r--r--arch/v850/kernel/rte_mb_a_pci.c796
-rw-r--r--arch/v850/kernel/rte_me2_cb.c300
-rw-r--r--arch/v850/kernel/rte_me2_cb.ld30
-rw-r--r--arch/v850/kernel/rte_nb85e_cb-multi.ld57
-rw-r--r--arch/v850/kernel/rte_nb85e_cb.c82
-rw-r--r--arch/v850/kernel/rte_nb85e_cb.ld22
-rw-r--r--arch/v850/kernel/semaphore.c166
-rw-r--r--arch/v850/kernel/setup.c286
-rw-r--r--arch/v850/kernel/signal.c525
-rw-r--r--arch/v850/kernel/sim.c179
-rw-r--r--arch/v850/kernel/sim.ld13
-rw-r--r--arch/v850/kernel/sim85e2.c201
-rw-r--r--arch/v850/kernel/sim85e2.ld36
-rw-r--r--arch/v850/kernel/simcons.c166
-rw-r--r--arch/v850/kernel/syscalls.c197
-rw-r--r--arch/v850/kernel/teg.c63
-rw-r--r--arch/v850/kernel/time.c198
-rw-r--r--arch/v850/kernel/v850_ksyms.c78
-rw-r--r--arch/v850/kernel/v850e2_cache.c127
-rw-r--r--arch/v850/kernel/v850e_cache.c174
-rw-r--r--arch/v850/kernel/v850e_intc.c104
-rw-r--r--arch/v850/kernel/v850e_timer_d.c54
-rw-r--r--arch/v850/kernel/v850e_utils.c62
-rw-r--r--arch/v850/kernel/vmlinux.lds.S285
57 files changed, 9573 insertions, 0 deletions
diff --git a/arch/v850/kernel/Makefile b/arch/v850/kernel/Makefile
new file mode 100644
index 00000000000..3930482bddc
--- /dev/null
+++ b/arch/v850/kernel/Makefile
@@ -0,0 +1,40 @@
+#
+# arch/v850/kernel/Makefile
+#
+# 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 archive
+# for more details.
+#
+
+extra-y := head.o init_task.o vmlinux.lds
+
+obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \
+ signal.o irq.o mach.o ptrace.o bug.o
+obj-$(CONFIG_MODULES) += module.o v850_ksyms.o
+# chip-specific code
+obj-$(CONFIG_V850E_MA1) += ma.o
+obj-$(CONFIG_V850E_ME2) += me2.o
+obj-$(CONFIG_V850E_TEG) += teg.o
+obj-$(CONFIG_V850E_AS85EP1) += as85ep1.o
+obj-$(CONFIG_V850E2_ANNA) += anna.o
+# platform-specific code
+obj-$(CONFIG_V850E_SIM) += sim.o simcons.o
+obj-$(CONFIG_V850E2_SIM85E2) += sim85e2.o memcons.o
+obj-$(CONFIG_V850E2_FPGA85E2C) += fpga85e2c.o memcons.o
+obj-$(CONFIG_RTE_CB) += rte_cb.o rte_cb_leds.o
+obj-$(CONFIG_RTE_CB_MA1) += rte_ma1_cb.o
+obj-$(CONFIG_RTE_CB_ME2) += rte_me2_cb.o
+obj-$(CONFIG_RTE_CB_NB85E) += rte_nb85e_cb.o
+obj-$(CONFIG_RTE_CB_MULTI) += rte_cb_multi.o
+obj-$(CONFIG_RTE_MB_A_PCI) += rte_mb_a_pci.o
+obj-$(CONFIG_RTE_GBUS_INT) += gbus_int.o
+# feature-specific code
+obj-$(CONFIG_V850E_INTC) += v850e_intc.o
+obj-$(CONFIG_V850E_TIMER_D) += v850e_timer_d.o v850e_utils.o
+obj-$(CONFIG_V850E_CACHE) += v850e_cache.o
+obj-$(CONFIG_V850E2_CACHE) += v850e2_cache.o
+obj-$(CONFIG_V850E_HIGHRES_TIMER) += highres_timer.o
+obj-$(CONFIG_PROC_FS) += procfs.o
diff --git a/arch/v850/kernel/anna-rom.ld b/arch/v850/kernel/anna-rom.ld
new file mode 100644
index 00000000000..7c54e7e3f1b
--- /dev/null
+++ b/arch/v850/kernel/anna-rom.ld
@@ -0,0 +1,16 @@
+/* Linker script for the Midas labs Anna V850E2 evaluation board
+ (CONFIG_V850E2_ANNA), with kernel in ROM (CONFIG_ROM_KERNEL). */
+
+MEMORY {
+ /* 8MB of flash ROM. */
+ ROM : ORIGIN = 0, LENGTH = 0x00800000
+
+ /* 1MB of static RAM. This memory is mirrored 64 times. */
+ SRAM : ORIGIN = SRAM_ADDR, LENGTH = SRAM_SIZE
+ /* 64MB of DRAM. */
+ SDRAM : ORIGIN = SDRAM_ADDR, LENGTH = SDRAM_SIZE
+}
+
+SECTIONS {
+ ROMK_SECTIONS(ROM, SRAM)
+}
diff --git a/arch/v850/kernel/anna.c b/arch/v850/kernel/anna.c
new file mode 100644
index 00000000000..6aaeab5e8a4
--- /dev/null
+++ b/arch/v850/kernel/anna.c
@@ -0,0 +1,208 @@
+/*
+ * arch/v850/kernel/anna.c -- Anna V850E2 evaluation chip/board
+ *
+ * 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>
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/bootmem.h>
+#include <linux/major.h>
+#include <linux/irq.h>
+
+#include <asm/machdep.h>
+#include <asm/atomic.h>
+#include <asm/page.h>
+#include <asm/v850e_timer_d.h>
+#include <asm/v850e_uart.h>
+
+#include "mach.h"
+
+
+/* SRAM and SDRAM are vaguely contiguous (with a big hole in between; see
+ mach_reserve_bootmem for details); use both as one big area. */
+#define RAM_START SRAM_ADDR
+#define RAM_END (SDRAM_ADDR + SDRAM_SIZE)
+
+/* The bits of this port are connected to an 8-LED bar-graph. */
+#define LEDS_PORT 0
+
+
+static void anna_led_tick (void);
+
+
+void __init mach_early_init (void)
+{
+ ANNA_ILBEN = 0;
+
+ V850E2_CSC(0) = 0x402F;
+ V850E2_CSC(1) = 0x4000;
+ V850E2_BPC = 0;
+ V850E2_BSC = 0xAAAA;
+ V850E2_BEC = 0;
+
+#if 0
+ V850E2_BHC = 0xFFFF; /* icache all memory, dcache all */
+#else
+ V850E2_BHC = 0; /* cache no memory */
+#endif
+ V850E2_BCT(0) = 0xB088;
+ V850E2_BCT(1) = 0x0008;
+ V850E2_DWC(0) = 0x0027;
+ V850E2_DWC(1) = 0;
+ V850E2_BCC = 0x0006;
+ V850E2_ASC = 0;
+ V850E2_LBS = 0x0089;
+ V850E2_SCR(3) = 0x21A9;
+ V850E2_RFS(3) = 0x8121;
+
+ v850e_intc_disable_irqs ();
+}
+
+void __init mach_setup (char **cmdline)
+{
+ ANNA_PORT_PM (LEDS_PORT) = 0; /* Make all LED pins output pins. */
+ mach_tick = anna_led_tick;
+}
+
+void __init mach_get_physical_ram (unsigned long *ram_start,
+ unsigned long *ram_len)
+{
+ *ram_start = RAM_START;
+ *ram_len = RAM_END - RAM_START;
+}
+
+void __init mach_reserve_bootmem ()
+{
+ /* The space between SRAM and SDRAM is filled with duplicate
+ images of SRAM. Prevent the kernel from using them. */
+ reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
+ SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
+}
+
+void mach_gettimeofday (struct timespec *tv)
+{
+ tv->tv_sec = 0;
+ tv->tv_nsec = 0;
+}
+
+void __init mach_sched_init (struct irqaction *timer_action)
+{
+ /* Start hardware timer. */
+ v850e_timer_d_configure (0, HZ);
+ /* Install timer interrupt handler. */
+ setup_irq (IRQ_INTCMD(0), timer_action);
+}
+
+static struct v850e_intc_irq_init irq_inits[] = {
+ { "IRQ", 0, NUM_MACH_IRQS, 1, 7 },
+ { "PIN", IRQ_INTP(0), IRQ_INTP_NUM, 1, 4 },
+ { "CCC", IRQ_INTCCC(0), IRQ_INTCCC_NUM, 1, 5 },
+ { "CMD", IRQ_INTCMD(0), IRQ_INTCMD_NUM, 1, 5 },
+ { "DMA", IRQ_INTDMA(0), IRQ_INTDMA_NUM, 1, 2 },
+ { "DMXER", IRQ_INTDMXER,1, 1, 2 },
+ { "SRE", IRQ_INTSRE(0), IRQ_INTSRE_NUM, 3, 3 },
+ { "SR", IRQ_INTSR(0), IRQ_INTSR_NUM, 3, 4 },
+ { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
+ { 0 }
+};
+#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
+
+static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
+
+void __init mach_init_irqs (void)
+{
+ v850e_intc_init_irq_types (irq_inits, hw_itypes);
+}
+
+void machine_restart (char *__unused)
+{
+#ifdef CONFIG_RESET_GUARD
+ disable_reset_guard ();
+#endif
+ asm ("jmp r0"); /* Jump to the reset vector. */
+}
+
+EXPORT_SYMBOL(machine_restart);
+
+void machine_halt (void)
+{
+#ifdef CONFIG_RESET_GUARD
+ disable_reset_guard ();
+#endif
+ local_irq_disable (); /* Ignore all interrupts. */
+ ANNA_PORT_IO(LEDS_PORT) = 0xAA; /* Note that we halted. */
+ for (;;)
+ asm ("halt; nop; nop; nop; nop; nop");
+}
+
+EXPORT_SYMBOL(machine_halt);
+
+void machine_power_off (void)
+{
+ machine_halt ();
+}
+
+EXPORT_SYMBOL(machine_power_off);
+
+/* Called before configuring an on-chip UART. */
+void anna_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
+{
+ /* The Anna connects some general-purpose I/O pins on the CPU to
+ the RTS/CTS lines of UART 1's serial connection. I/O pins P07
+ and P37 are RTS and CTS respectively. */
+ if (chan == 1) {
+ ANNA_PORT_PM(0) &= ~0x80; /* P07 in output mode */
+ ANNA_PORT_PM(3) |= 0x80; /* P37 in input mode */
+ }
+}
+
+/* Minimum and maximum bounds for the moving upper LED boundary in the
+ clock tick display. We can't use the last bit because it's used for
+ UART0's CTS output. */
+#define MIN_MAX_POS 0
+#define MAX_MAX_POS 6
+
+/* There are MAX_MAX_POS^2 - MIN_MAX_POS^2 cycles in the animation, so if
+ we pick 6 and 0 as above, we get 49 cycles, which is when divided into
+ the standard 100 value for HZ, gives us an almost 1s total time. */
+#define TICKS_PER_FRAME \
+ (HZ / (MAX_MAX_POS * MAX_MAX_POS - MIN_MAX_POS * MIN_MAX_POS))
+
+static void anna_led_tick ()
+{
+ static unsigned counter = 0;
+
+ if (++counter == TICKS_PER_FRAME) {
+ static int pos = 0, max_pos = MAX_MAX_POS, dir = 1;
+
+ if (dir > 0 && pos == max_pos) {
+ dir = -1;
+ if (max_pos == MIN_MAX_POS)
+ max_pos = MAX_MAX_POS;
+ else
+ max_pos--;
+ } else {
+ if (dir < 0 && pos == 0)
+ dir = 1;
+
+ if (pos + dir <= max_pos) {
+ /* Each bit of port 0 has a LED. */
+ clear_bit (pos, &ANNA_PORT_IO(LEDS_PORT));
+ pos += dir;
+ set_bit (pos, &ANNA_PORT_IO(LEDS_PORT));
+ }
+ }
+
+ counter = 0;
+ }
+}
diff --git a/arch/v850/kernel/anna.ld b/arch/v850/kernel/anna.ld
new file mode 100644
index 00000000000..df7f80f2833
--- /dev/null
+++ b/arch/v850/kernel/anna.ld
@@ -0,0 +1,20 @@
+/* Linker script for the Midas labs Anna V850E2 evaluation board
+ (CONFIG_V850E2_ANNA). */
+
+MEMORY {
+ /* 256KB of internal memory (followed by one mirror). */
+ iMEM0 : ORIGIN = 0, LENGTH = 0x00040000
+ /* 256KB of internal memory (followed by one mirror). */
+ iMEM1 : ORIGIN = 0x00040000, LENGTH = 0x00040000
+
+ /* 1MB of static RAM. This memory is mirrored 64 times. */
+ SRAM : ORIGIN = SRAM_ADDR, LENGTH = SRAM_SIZE
+ /* 64MB of DRAM. */
+ SDRAM : ORIGIN = SDRAM_ADDR, LENGTH = SDRAM_SIZE
+}
+
+SECTIONS {
+ .intv : { INTV_CONTENTS } > iMEM0
+ .sram : { RAMK_KRAM_CONTENTS } > SRAM
+ .root : { ROOT_FS_CONTENTS } > SDRAM
+}
diff --git a/arch/v850/kernel/as85ep1-rom.ld b/arch/v850/kernel/as85ep1-rom.ld
new file mode 100644
index 00000000000..fe2a9a3ab52
--- /dev/null
+++ b/arch/v850/kernel/as85ep1-rom.ld
@@ -0,0 +1,21 @@
+/* Linker script for the NEC AS85EP1 V850E evaluation board
+ (CONFIG_V850E_AS85EP1), with kernel in ROM (CONFIG_ROM_KERNEL). */
+
+MEMORY {
+ /* 4MB of flash ROM. */
+ ROM : ORIGIN = 0, LENGTH = 0x00400000
+
+ /* 1MB of static RAM. */
+ SRAM : ORIGIN = SRAM_ADDR, LENGTH = SRAM_SIZE
+
+ /* About 58MB of DRAM. This can actually be at one of two
+ positions, determined by jumper JP3; we have to use the first
+ position because the second is partially out of processor
+ instruction addressing range (though in the second position
+ there's actually 64MB available). */
+ SDRAM : ORIGIN = SDRAM_ADDR, LENGTH = SDRAM_SIZE
+}
+
+SECTIONS {
+ ROMK_SECTIONS(ROM, SRAM)
+}
diff --git a/arch/v850/kernel/as85ep1.c b/arch/v850/kernel/as85ep1.c
new file mode 100644
index 00000000000..4059b1df11b
--- /dev/null
+++ b/arch/v850/kernel/as85ep1.c
@@ -0,0 +1,240 @@
+/*
+ * arch/v850/kernel/as85ep1.c -- AS85EP1 V850E evaluation chip/board
+ *
+ * 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>
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/bootmem.h>
+#include <linux/major.h>
+#include <linux/irq.h>
+
+#include <asm/machdep.h>
+#include <asm/atomic.h>
+#include <asm/page.h>
+#include <asm/v850e_timer_d.h>
+#include <asm/v850e_uart.h>
+
+#include "mach.h"
+
+
+/* SRAM and SDRAM are vaguely contiguous (with a big hole in between; see
+ mach_reserve_bootmem for details); use both as one big area. */
+#define RAM_START SRAM_ADDR
+#define RAM_END (SDRAM_ADDR + SDRAM_SIZE)
+
+/* The bits of this port are connected to an 8-LED bar-graph. */
+#define LEDS_PORT 4
+
+
+static void as85ep1_led_tick (void);
+
+extern char _intv_copy_src_start, _intv_copy_src_end;
+extern char _intv_copy_dst_start;
+
+
+void __init mach_early_init (void)
+{
+#ifndef CONFIG_ROM_KERNEL
+ const u32 *src;
+ register u32 *dst asm ("ep");
+#endif
+
+ AS85EP1_CSC(0) = 0x0403;
+ AS85EP1_BCT(0) = 0xB8B8;
+ AS85EP1_DWC(0) = 0x0104;
+ AS85EP1_BCC = 0x0012;
+ AS85EP1_ASC = 0;
+ AS85EP1_LBS = 0x00A9;
+
+ AS85EP1_PORT_PMC(6) = 0xFF; /* valid A0,A1,A20-A25 */
+ AS85EP1_PORT_PMC(7) = 0x0E; /* valid CS1-CS3 */
+ AS85EP1_PORT_PMC(9) = 0xFF; /* valid D16-D23 */
+ AS85EP1_PORT_PMC(10) = 0xFF; /* valid D24-D31 */
+
+ AS85EP1_RFS(1) = 0x800c;
+ AS85EP1_RFS(3) = 0x800c;
+ AS85EP1_SCR(1) = 0x20A9;
+ AS85EP1_SCR(3) = 0x20A9;
+
+#ifndef CONFIG_ROM_KERNEL
+ /* The early chip we have is buggy, and writing the interrupt
+ vectors into low RAM may screw up, so for non-ROM kernels, we
+ only rely on the reset vector being downloaded, and copy the
+ rest of the interrupt vectors into place here. The specific bug
+ is that writing address N, where (N & 0x10) == 0x10, will _also_
+ write to address (N - 0x10). We avoid this (effectively) by
+ writing in 16-byte chunks backwards from the end. */
+
+ AS85EP1_IRAMM = 0x3; /* "write-mode" for the internal instruction memory */
+
+ src = (u32 *)(((u32)&_intv_copy_src_end - 1) & ~0xF);
+ dst = (u32 *)&_intv_copy_dst_start
+ + (src - (u32 *)&_intv_copy_src_start);
+ do {
+ u32 t0 = src[0], t1 = src[1], t2 = src[2], t3 = src[3];
+ dst[0] = t0; dst[1] = t1; dst[2] = t2; dst[3] = t3;
+ dst -= 4;
+ src -= 4;
+ } while (src > (u32 *)&_intv_copy_src_start);
+
+ AS85EP1_IRAMM = 0x0; /* "read-mode" for the internal instruction memory */
+#endif /* !CONFIG_ROM_KERNEL */
+
+ v850e_intc_disable_irqs ();
+}
+
+void __init mach_setup (char **cmdline)
+{
+ AS85EP1_PORT_PMC (LEDS_PORT) = 0; /* Make the LEDs port an I/O port. */
+ AS85EP1_PORT_PM (LEDS_PORT) = 0; /* Make all the bits output pins. */
+ mach_tick = as85ep1_led_tick;
+}
+
+void __init mach_get_physical_ram (unsigned long *ram_start,
+ unsigned long *ram_len)
+{
+ *ram_start = RAM_START;
+ *ram_len = RAM_END - RAM_START;
+}
+
+/* Convenience macros. */
+#define SRAM_END (SRAM_ADDR + SRAM_SIZE)
+#define SDRAM_END (SDRAM_ADDR + SDRAM_SIZE)
+
+void __init mach_reserve_bootmem ()
+{
+ if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START)
+ /* We can't use the space between SRAM and SDRAM, so
+ prevent the kernel from trying. */
+ reserve_bootmem (SRAM_END, SDRAM_ADDR - SRAM_END);
+}
+
+void mach_gettimeofday (struct timespec *tv)
+{
+ tv->tv_sec = 0;
+ tv->tv_nsec = 0;
+}
+
+void __init mach_sched_init (struct irqaction *timer_action)
+{
+ /* Start hardware timer. */
+ v850e_timer_d_configure (0, HZ);
+ /* Install timer interrupt handler. */
+ setup_irq (IRQ_INTCMD(0), timer_action);
+}
+
+static struct v850e_intc_irq_init irq_inits[] = {
+ { "IRQ", 0, NUM_MACH_IRQS, 1, 7 },
+ { "CCC", IRQ_INTCCC(0), IRQ_INTCCC_NUM, 1, 5 },
+ { "CMD", IRQ_INTCMD(0), IRQ_INTCMD_NUM, 1, 5 },
+ { "SRE", IRQ_INTSRE(0), IRQ_INTSRE_NUM, 3, 3 },
+ { "SR", IRQ_INTSR(0), IRQ_INTSR_NUM, 3, 4 },
+ { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
+ { 0 }
+};
+#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
+
+static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
+
+void __init mach_init_irqs (void)
+{
+ v850e_intc_init_irq_types (irq_inits, hw_itypes);
+}
+
+void machine_restart (char *__unused)
+{
+#ifdef CONFIG_RESET_GUARD
+ disable_reset_guard ();
+#endif
+ asm ("jmp r0"); /* Jump to the reset vector. */
+}
+
+EXPORT_SYMBOL(machine_restart);
+
+void machine_halt (void)
+{
+#ifdef CONFIG_RESET_GUARD
+ disable_reset_guard ();
+#endif
+ local_irq_disable (); /* Ignore all interrupts. */
+ AS85EP1_PORT_IO (LEDS_PORT) = 0xAA; /* Note that we halted. */
+ for (;;)
+ asm ("halt; nop; nop; nop; nop; nop");
+}
+
+EXPORT_SYMBOL(machine_halt);
+
+void machine_power_off (void)
+{
+ machine_halt ();
+}
+
+EXPORT_SYMBOL(machine_power_off);
+
+/* Called before configuring an on-chip UART. */
+void as85ep1_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
+{
+ /* Make the shared uart/port pins be uart pins. */
+ AS85EP1_PORT_PMC(3) |= (0x5 << chan);
+
+ /* The AS85EP1 connects some general-purpose I/O pins on the CPU to
+ the RTS/CTS lines of UART 1's serial connection. I/O pins P53
+ and P54 are RTS and CTS respectively. */
+ if (chan == 1) {
+ /* Put P53 & P54 in I/O port mode. */
+ AS85EP1_PORT_PMC(5) &= ~0x18;
+ /* Make P53 an output, and P54 an input. */
+ AS85EP1_PORT_PM(5) |= 0x10;
+ }
+}
+
+/* Minimum and maximum bounds for the moving upper LED boundary in the
+ clock tick display. */
+#define MIN_MAX_POS 0
+#define MAX_MAX_POS 7
+
+/* There are MAX_MAX_POS^2 - MIN_MAX_POS^2 cycles in the animation, so if
+ we pick 6 and 0 as above, we get 49 cycles, which is when divided into
+ the standard 100 value for HZ, gives us an almost 1s total time. */
+#define TICKS_PER_FRAME \
+ (HZ / (MAX_MAX_POS * MAX_MAX_POS - MIN_MAX_POS * MIN_MAX_POS))
+
+static void as85ep1_led_tick ()
+{
+ static unsigned counter = 0;
+
+ if (++counter == TICKS_PER_FRAME) {
+ static int pos = 0, max_pos = MAX_MAX_POS, dir = 1;
+
+ if (dir > 0 && pos == max_pos) {
+ dir = -1;
+ if (max_pos == MIN_MAX_POS)
+ max_pos = MAX_MAX_POS;
+ else
+ max_pos--;
+ } else {
+ if (dir < 0 && pos == 0)
+ dir = 1;
+
+ if (pos + dir <= max_pos) {
+ /* Each bit of port 0 has a LED. */
+ set_bit (pos, &AS85EP1_PORT_IO(LEDS_PORT));
+ pos += dir;
+ clear_bit (pos, &AS85EP1_PORT_IO(LEDS_PORT));
+ }
+ }
+
+ counter = 0;
+ }
+}
diff --git a/arch/v850/kernel/as85ep1.ld b/arch/v850/kernel/as85ep1.ld
new file mode 100644
index 00000000000..ef2c4399063
--- /dev/null
+++ b/arch/v850/kernel/as85ep1.ld
@@ -0,0 +1,49 @@
+/* Linker script for the NEC AS85EP1 V850E evaluation board
+ (CONFIG_V850E_AS85EP1). */
+
+MEMORY {
+ /* 1MB of internal instruction memory. */
+ iMEM0 : ORIGIN = 0, LENGTH = 0x00100000
+
+ /* 1MB of static RAM. */
+ SRAM : ORIGIN = SRAM_ADDR, LENGTH = SRAM_SIZE
+
+ /* About 58MB of DRAM. This can actually be at one of two
+ positions, determined by jump JP3; we have to use the first
+ position because the second is partially out of processor
+ instruction addressing range (though in the second position
+ there's actually 64MB available). */
+ SDRAM : ORIGIN = SDRAM_ADDR, LENGTH = SDRAM_SIZE
+}
+
+SECTIONS {
+ .resetv : {
+ __intv_start = . ;
+ *(.intv.reset) /* Reset vector */
+ } > iMEM0
+
+ .sram : {
+ RAMK_KRAM_CONTENTS
+
+ /* We stick most of the interrupt vectors here; they'll be
+ copied into the proper location by the early init code (we
+ can't put them directly in the right place because of
+ hardware bugs). The vectors shouldn't need to be
+ relocated, so we don't have to use `> ... AT> ...' to
+ split the load/vm addresses (and we can't because of
+ problems with the loader). */
+ . = ALIGN (0x10) ;
+ __intv_copy_src_start = . ;
+ *(.intv.common) /* Vectors common to all v850e proc. */
+ *(.intv.mach) /* Machine-specific int. vectors. */
+ . = ALIGN (0x10) ;
+ __intv_copy_src_end = . ;
+ } > SRAM
+
+ /* Where we end up putting the vectors. */
+ __intv_copy_dst_start = 0x10 ;
+ __intv_copy_dst_end = __intv_copy_dst_start + (__intv_copy_src_end - __intv_copy_src_start) ;
+ __intv_end = __intv_copy_dst_end ;
+
+ .root : { ROOT_FS_CONTENTS } > SDRAM
+}
diff --git a/arch/v850/kernel/asm-consts.c b/arch/v850/kernel/asm-consts.c
new file mode 100644
index 00000000000..24f29136907
--- /dev/null
+++ b/arch/v850/kernel/asm-consts.c
@@ -0,0 +1,61 @@
+/*
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * We use the technique used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ */
+
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/kernel_stat.h>
+#include <linux/ptrace.h>
+#include <linux/hardirq.h>
+#include <asm/irq.h>
+#include <asm/errno.h>
+
+#define DEFINE(sym, val) \
+ asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+int main (void)
+{
+ /* offsets into the task struct */
+ DEFINE (TASK_STATE, offsetof (struct task_struct, state));
+ DEFINE (TASK_FLAGS, offsetof (struct task_struct, flags));
+ DEFINE (TASK_PTRACE, offseto