--- zzzz-none-000/linux-2.4.17/arch/mips/mips-boards/generic/reset.c 2001-04-14 03:26:07.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/arch/mips/mips-boards/generic/reset.c 2004-11-24 13:22:35.000000000 +0000 @@ -28,7 +28,18 @@ #include #if defined(CONFIG_MIPS_ATLAS) #include -#endif +#endif /* CONFIG_MIPS_ATLAS */ + +#if defined(CONFIG_MIPS_AVALANCHE_SOC) +#include + +#define AVALANCHE_RST_SWRCR (1<<0) /* System software reset */ +#define AVALANCHE_GO_RESET 1 +#define AVALANCHE_GO_IDLE 1 +#define AVALANCHE_GO_STBY 2 +#define AVALANCHE_GO_HALT 3 + +#endif /* CONFIG_MIPS_AVALANCHE_SOC */ static void mips_machine_restart(char *command); static void mips_machine_halt(void); @@ -38,16 +49,38 @@ static void mips_machine_restart(char *command) { +#if defined(CONFIG_MIPS_AVALANCHE_SOC) + + avalanche_sys_reset(AVALANCHE_GO_RESET); + + { + __asm__ __volatile( + ".set noreorder\n\t" + ".set mips3\n\t" + "li $2,0xbfc00000\n\t" + "jr $2\n\t" + "nop\n\t" + ".set mips0\n\t" + ".set reorder\n\t"); + } + +#else /* !CONFIG_MIPS_AVALANCHE_SOC */ volatile unsigned int *softres_reg = (void *)SOFTRES_REG; *softres_reg = GORESET; +#endif /* CONFIG_MIPS_AVALANCHE_SOC */ } static void mips_machine_halt(void) { +#if defined(CONFIG_MIPS_AVALANCHE_SOC) + + avalanche_set_global_power_mode(AVALANCHE_GO_HALT); +#else volatile unsigned int *softres_reg = (void *)SOFTRES_REG; *softres_reg = GORESET; +#endif /* CONFIG_MIPS_AVALANCHE_SOC */ } #if defined(CONFIG_MIPS_ATLAS) @@ -59,6 +92,13 @@ } #endif +#if defined(CONFIG_MIPS_AVALANCHE_SOC) +static void avalanche_machine_power_off(void) +{ + avalanche_set_global_power_mode(AVALANCHE_GO_STBY); +} +#endif /* CONFIG_MIPS_AVALANCHE_SOC */ + void mips_reboot_setup(void) { _machine_restart = mips_machine_restart; @@ -69,4 +109,7 @@ #if defined(CONFIG_MIPS_MALTA) _machine_power_off = mips_machine_halt; #endif +#if defined(CONFIG_MIPS_AVALANCHE_SOC) + _machine_power_off = avalanche_machine_power_off; +#endif /* CONFIG_MIPS_AVALANCHE_SOC */ }