Skip to content

Commit

Permalink
Drop code for CRISv10 CPU simulator
Browse files Browse the repository at this point in the history
That simulator is dead and redundant.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
  • Loading branch information
Jesper Nilsson committed Jan 15, 2014
1 parent e7672be commit e269a86
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 143 deletions.
6 changes: 0 additions & 6 deletions arch/cris/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ config ETRAX100LX_V2
help
Support version 2 of the ETRAX 100LX.

config SVINTO_SIM
bool "ETRAX-100LX-for-xsim-simulator"
select ARCH_USES_GETTIMEOFFSET
help
Support the xsim ETRAX Simulator.

config ETRAXFS
bool "ETRAX-FS-V32"
help
Expand Down
1 change: 0 additions & 1 deletion arch/cris/arch-v10/kernel/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# $Id: Makefile,v 1.6 2004/12/13 12:21:51 starvik Exp $
#
# Makefile for the linux kernel.
#
Expand Down
7 changes: 0 additions & 7 deletions arch/cris/arch-v10/kernel/debugport.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/delay.h>
#include <linux/tty.h>
#include <arch/svinto.h>
#include <asm/io.h> /* Get SIMCOUT. */

extern void reset_watchdog(void);

Expand Down Expand Up @@ -318,12 +317,6 @@ console_write(struct console *co, const char *buf, unsigned int len)
if (!port)
return;

#ifdef CONFIG_SVINTO_SIM
/* no use to simulate the serial debug output */
SIMCOUT(buf, len);
return;
#endif

console_write_direct(co, buf, len);
}

Expand Down
4 changes: 2 additions & 2 deletions arch/cris/arch-v10/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ IRQ1_interrupt:
ba _Rexit ; Return the standard way
nop
wdog:
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#if defined(CONFIG_ETRAX_WATCHDOG)
;; Check if we're waiting for reset to happen, as signalled by
;; hard_reset_now setting cause_of_death to a magic value. If so, just
;; get stuck until reset happens.
Expand Down Expand Up @@ -523,7 +523,7 @@ _watchdogmsg:
.ascii "Oops: bitten by watchdog\n\0"
.previous

#endif /* CONFIG_ETRAX_WATCHDOG and not CONFIG_SVINTO_SIM */
#endif /* CONFIG_ETRAX_WATCHDOG */

spurious_interrupt:
di
Expand Down
5 changes: 0 additions & 5 deletions arch/cris/arch-v10/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,11 @@ _inflash:
#endif

;; Set up waitstates etc according to kernel configuration.
#ifndef CONFIG_SVINTO_SIM
move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0
move.d $r0, [R_WAITSTATES]

move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0
move.d $r0, [R_BUS_CONFIG]
#endif

;; We need to initialze DRAM registers before we start using the DRAM

Expand Down Expand Up @@ -466,7 +464,6 @@ no_command_line:

move.d $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG

#ifndef CONFIG_SVINTO_SIM
move.d $r0,[R_GEN_CONFIG]

#if 0
Expand Down Expand Up @@ -701,8 +698,6 @@ no_command_line:
move.b $r0,[R_SERIAL3_TR_CTRL]
#endif

#endif /* CONFIG_SVINTO_SIM */

jump start_kernel ; jump into the C-function start_kernel in init/main.c

.data
Expand Down
18 changes: 4 additions & 14 deletions arch/cris/arch-v10/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Authors: Bjorn Wesen (bjornw@axis.com)
*
* This file contains the interrupt vectors and some
* This file contains the interrupt vectors and some
* helper functions
*
*/
Expand Down Expand Up @@ -182,19 +182,14 @@ void do_multiple_IRQ(struct pt_regs* regs)
setting the irq vector table.
*/

void __init
init_IRQ(void)
void __init init_IRQ(void)
{
int i;

/* clear all interrupt masks */

#ifndef CONFIG_SVINTO_SIM
*R_IRQ_MASK0_CLR = 0xffffffff;
*R_IRQ_MASK1_CLR = 0xffffffff;
*R_IRQ_MASK2_CLR = 0xffffffff;
#endif

*R_VECT_MASK_CLR = 0xffffffff;

for (i = 0; i < 256; i++)
Expand All @@ -211,25 +206,20 @@ init_IRQ(void)
executed by the associated break handler, rather than just a jump
address. therefore we need to setup a default breakpoint handler
for all breakpoints */

for (i = 0; i < 16; i++)
set_break_vector(i, do_sigtrap);

/* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */

/* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */
set_int_vector(15, multiple_interrupt);

/* 0 and 1 which are special breakpoint/NMI traps */

/* 0 and 1 which are special breakpoint/NMI traps */
set_int_vector(0, hwbreakpoint);
set_int_vector(1, IRQ1_interrupt);

/* and irq 14 which is the mmu bus fault handler */

set_int_vector(14, mmu_bus_fault);

/* setup the system-call trap, which is reached by BREAK 13 */

set_break_vector(13, system_call);

/* setup a breakpoint handler for debugging used for both user and
Expand Down
5 changes: 2 additions & 3 deletions arch/cris/arch-v10/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/fs.h>
#include <arch/svinto.h>
#include <linux/init.h>
#include <arch/system.h>
#include <linux/ptrace.h>
Expand Down Expand Up @@ -56,14 +55,14 @@ void hard_reset_now (void)
* code to know about it than the watchdog handler in entry.S and
* this code, implementing hard reset through the watchdog.
*/
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#if defined(CONFIG_ETRAX_WATCHDOG)
extern int cause_of_death;
#endif

printk("*** HARD RESET ***\n");
local_irq_disable();

#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#if defined(CONFIG_ETRAX_WATCHDOG)
cause_of_death = 0xbedead;
#else
/* Since we dont plan to keep on resetting the watchdog,
Expand Down
92 changes: 39 additions & 53 deletions arch/cris/arch-v10/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <arch/svinto.h>
#include <asm/types.h>
#include <asm/signal.h>
#include <asm/io.h>
Expand All @@ -34,7 +33,7 @@ unsigned long get_ns_in_jiffie(void)

local_irq_save(flags);
timer_count = *R_TIMER0_DATA;
presc_count = *R_TIM_PRESC_STATUS;
presc_count = *R_TIM_PRESC_STATUS;
/* presc_count might be wrapped */
t1 = *R_TIMER0_DATA;

Expand All @@ -50,7 +49,7 @@ unsigned long get_ns_in_jiffie(void)
presc_count = PRESCALE_VALUE - presc_count - PRESCALE_VALUE/2;
}

ns = ( (TIMER0_DIV - timer_count) * ((1000000000/HZ)/TIMER0_DIV )) +
ns = ( (TIMER0_DIV - timer_count) * ((1000000000/HZ)/TIMER0_DIV )) +
( (presc_count) * (1000000000/PRESCALE_FREQ));
return ns;
}
Expand Down Expand Up @@ -80,7 +79,7 @@ static u32 cris_v10_gettimeoffset(void)
* by the R_WATCHDOG register. The R_WATCHDOG register contains an enable bit
* and a 3-bit key value. The effect of writing to the R_WATCHDOG register is
* described in the table below:
*
*
* Watchdog Value written:
* state: To enable: To key: Operation:
* -------- ---------- ------- ----------
Expand All @@ -89,15 +88,15 @@ static u32 cris_v10_gettimeoffset(void)
* started 0 ~key Stop watchdog
* started 1 ~key Restart watchdog with key = ~key.
* started X new_key_val Change key to new_key_val.
*
*
* Note: '~' is the bitwise NOT operator.
*
*
*/

/* right now, starting the watchdog is the same as resetting it */
#define start_watchdog reset_watchdog

#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#ifdef CONFIG_ETRAX_WATCHDOG
static int watchdog_key = 0; /* arbitrary number */
#endif

Expand All @@ -107,10 +106,9 @@ static int watchdog_key = 0; /* arbitrary number */

#define WATCHDOG_MIN_FREE_PAGES 8

void
reset_watchdog(void)
void reset_watchdog(void)
{
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#if defined(CONFIG_ETRAX_WATCHDOG)
/* only keep watchdog happy as long as we have memory left! */
if(nr_free_pages() > WATCHDOG_MIN_FREE_PAGES) {
/* reset the watchdog with the inverse of the old key */
Expand All @@ -123,28 +121,23 @@ reset_watchdog(void)

/* stop the watchdog - we still need the correct key */

void
stop_watchdog(void)
void stop_watchdog(void)
{
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#ifdef CONFIG_ETRAX_WATCHDOG
watchdog_key ^= 0x7; /* invert key, which is 3 bits */
*R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, watchdog_key) |
IO_STATE(R_WATCHDOG, enable, stop);
#endif
#endif
}


extern void cris_do_profile(struct pt_regs *regs);

/*
* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "xtime_update()" routine every clocktick
*/

//static unsigned short myjiff; /* used by our debug routine print_timestamp */

extern void cris_do_profile(struct pt_regs *regs);

static inline irqreturn_t
timer_interrupt(int irq, void *dev_id)
static inline irqreturn_t timer_interrupt(int irq, void *dev_id)
{
struct pt_regs *regs = get_irq_regs();
/* acknowledge the timer irq */
Expand All @@ -160,20 +153,18 @@ timer_interrupt(int irq, void *dev_id)
IO_STATE( R_TIMER_CTRL, tm0, run) |
IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
#else
*R_TIMER_CTRL = r_timer_ctrl_shadow |
IO_STATE(R_TIMER_CTRL, i0, clr);
*R_TIMER_CTRL = r_timer_ctrl_shadow | IO_STATE(R_TIMER_CTRL, i0, clr);
#endif

/* reset watchdog otherwise it resets us! */
reset_watchdog();

/* Update statistics. */
update_process_times(user_mode(regs));

/* call the real timer interrupt handler */

xtime_update(1);

cris_do_profile(regs); /* Save profiling information */
return IRQ_HANDLED;
}
Expand All @@ -186,16 +177,15 @@ static struct irqaction irq2 = {
.name = "timer",
};

void __init
time_init(void)
{
void __init time_init(void)
{
arch_gettimeoffset = cris_v10_gettimeoffset;

/* probe for the RTC and read it if it exists
* Before the RTC can be probed the loops_per_usec variable needs
* to be initialized to make usleep work. A better value for
* loops_per_usec is calculated by the kernel later once the
* clock has started.
/* probe for the RTC and read it if it exists
* Before the RTC can be probed the loops_per_usec variable needs
* to be initialized to make usleep work. A better value for
* loops_per_usec is calculated by the kernel later once the
* clock has started.
*/
loops_per_usec = 50;

Expand All @@ -206,7 +196,7 @@ time_init(void)
* Remember that linux/timex.h contains #defines that rely on the
* timer settings below (hz and divide factor) !!!
*/

#ifdef USE_CASCADE_TIMERS
*R_TIMER_CTRL =
IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) |
Expand All @@ -217,8 +207,8 @@ time_init(void)
IO_STATE( R_TIMER_CTRL, i0, nop) |
IO_STATE( R_TIMER_CTRL, tm0, stop_ld) |
IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
*R_TIMER_CTRL = r_timer_ctrl_shadow =

*R_TIMER_CTRL = r_timer_ctrl_shadow =
IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) |
IO_FIELD( R_TIMER_CTRL, timerdiv0, 0) |
IO_STATE( R_TIMER_CTRL, i1, nop) |
Expand All @@ -228,18 +218,18 @@ time_init(void)
IO_STATE( R_TIMER_CTRL, tm0, run) |
IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
#else
*R_TIMER_CTRL =
IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) |
*R_TIMER_CTRL =
IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) |
IO_FIELD(R_TIMER_CTRL, timerdiv0, TIMER0_DIV) |
IO_STATE(R_TIMER_CTRL, i1, nop) |
IO_STATE(R_TIMER_CTRL, i1, nop) |
IO_STATE(R_TIMER_CTRL, tm1, stop_ld) |
IO_STATE(R_TIMER_CTRL, clksel1, c19k2Hz) |
IO_STATE(R_TIMER_CTRL, i0, nop) |
IO_STATE(R_TIMER_CTRL, tm0, stop_ld) |
IO_STATE(R_TIMER_CTRL, clksel0, flexible);

*R_TIMER_CTRL = r_timer_ctrl_shadow =
IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) |
IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) |
IO_FIELD(R_TIMER_CTRL, timerdiv0, TIMER0_DIV) |
IO_STATE(R_TIMER_CTRL, i1, nop) |
IO_STATE(R_TIMER_CTRL, tm1, run) |
Expand All @@ -251,16 +241,14 @@ time_init(void)
*R_TIMER_PRESCALE = PRESCALE_VALUE;
#endif

*R_IRQ_MASK0_SET =
IO_STATE(R_IRQ_MASK0_SET, timer0, set); /* unmask the timer irq */

/* now actually register the timer irq handler that calls timer_interrupt() */

/* unmask the timer irq */
*R_IRQ_MASK0_SET = IO_STATE(R_IRQ_MASK0_SET, timer0, set);

/* now actually register the irq handler that calls timer_interrupt() */
setup_irq(2, &irq2); /* irq 2 is the timer0 irq in etrax */

/* enable watchdog if we should use one */

#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
#if defined(CONFIG_ETRAX_WATCHDOG)
printk("Enabling watchdog...\n");
start_watchdog();

Expand All @@ -273,9 +261,7 @@ time_init(void)
driver or infrastructure support yet. */
asm ("setf m");

*R_IRQ_MASK0_SET =
IO_STATE(R_IRQ_MASK0_SET, watchdog_nmi, set);
*R_VECT_MASK_SET =
IO_STATE(R_VECT_MASK_SET, nmi, set);
*R_IRQ_MASK0_SET = IO_STATE(R_IRQ_MASK0_SET, watchdog_nmi, set);
*R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, nmi, set);
#endif
}
Loading

0 comments on commit e269a86

Please sign in to comment.