Clean up lasat reset functions Signed-off-by: Yoichi Yuasa <yoichi_yuasa@xxxxxxxxxxxxxx> diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/lasat/reset.c mips/arch/mips/lasat/reset.c --- mips-orig/arch/mips/lasat/reset.c 2007-12-13 10:20:15.537626250 +0900 +++ mips/arch/mips/lasat/reset.c 2007-12-13 10:17:32.751452750 +0900 @@ -17,18 +17,21 @@ * * Reset the LASAT board. */ -#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/irqflags.h> #include <linux/pm.h> +#include <asm/bootinfo.h> #include <asm/reboot.h> -#include <asm/system.h> #include <asm/lasat/lasat.h> -#include "picvue.h" #include "prom.h" -static void lasat_machine_restart(char *command); -static void lasat_machine_halt(void); +#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef +#define LASAT_SERVICEMODE_MAGIC_2 0xfedeabba + +static void __iomem *reset_reg; /* Used to set machine to boot in service mode via /proc interface */ int lasat_boot_to_service; @@ -38,10 +41,13 @@ static void lasat_machine_restart(char * local_irq_disable(); if (lasat_boot_to_service) { - *(volatile unsigned int *)0xa0000024 = 0xdeadbeef; - *(volatile unsigned int *)0xa00000fc = 0xfedeabba; + writel(LASAT_SERVICEMODE_MAGIC_1, + (void __iomem *)KSEG1ADDR(0x24)); + writel(LASAT_SERVICEMODE_MAGIC_2, + (void __iomem *)KSEG1ADDR(0xfc)); } - *lasat_misc->reset_reg = 0xbedead; + + writel(0xbedead, reset_reg); for (;;) ; } @@ -53,9 +59,25 @@ static void lasat_machine_halt(void) for (;;) ; } -void lasat_reboot_setup(void) +static int lasat_reboot_setup(void) { + switch (mips_machtype) { + case MACH_LASAT_100: + reset_reg = (void __iomem *)KSEG1ADDR(0x1c840000); + break; + case MACH_LASAT_200: + reset_reg = (void __iomem *)KSEG1ADDR(0x11080000); + break; + default: + printk(KERN_ERR "Unknown LASAT board\n"); + return -EINVAL; + } + _machine_restart = lasat_machine_restart; _machine_halt = lasat_machine_halt; pm_power_off = lasat_machine_halt; + + return 0; } + +arch_initcall(lasat_reboot_setup); diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/lasat/setup.c mips/arch/mips/lasat/setup.c --- mips-orig/arch/mips/lasat/setup.c 2007-12-13 10:20:15.553627250 +0900 +++ mips/arch/mips/lasat/setup.c 2007-12-13 10:17:32.755453000 +0900 @@ -46,20 +46,6 @@ #include "prom.h" -extern void lasat_reboot_setup(void); - -struct lasat_misc lasat_misc_info[N_MACHTYPES] = { - { - .reset_reg = (void *)KSEG1ADDR(0x1c840000), - .flash_wp_reg = (void *)KSEG1ADDR(0x1c800000), 2 - }, { - .reset_reg = (void *)KSEG1ADDR(0x11080000), - .flash_wp_reg = (void *)KSEG1ADDR(0x11000000), 6 - } -}; - -struct lasat_misc *lasat_misc; - #ifdef CONFIG_DS1603 static struct ds_defs ds_defs[N_MACHTYPES] = { { (void *)DS1603_REG_100, (void *)DS1603_REG_100, @@ -121,7 +107,7 @@ void __init plat_time_init(void) void __init plat_mem_setup(void) { int i; - lasat_misc = &lasat_misc_info[mips_machtype]; + #ifdef CONFIG_PICVUE picvue = &pvc_defs[mips_machtype]; #endif @@ -131,8 +117,6 @@ void __init plat_mem_setup(void) atomic_notifier_chain_register(&panic_notifier_list, &lasat_panic_block[i]); - lasat_reboot_setup(); - #ifdef CONFIG_DS1603 ds1603 = &ds_defs[mips_machtype]; #endif diff -pruN -X mips/Documentation/dontdiff mips-orig/include/asm-mips/lasat/lasat.h mips/include/asm-mips/lasat/lasat.h --- mips-orig/include/asm-mips/lasat/lasat.h 2007-12-13 10:20:15.569628250 +0900 +++ mips/include/asm-mips/lasat/lasat.h 2007-12-13 10:17:32.755453000 +0900 @@ -24,12 +24,6 @@ #ifndef _LANGUAGE_ASSEMBLY -extern struct lasat_misc { - volatile u32 *reset_reg; - volatile u32 *flash_wp_reg; - u32 flash_wp_bit; -} *lasat_misc; - enum lasat_mtdparts { LASAT_MTD_BOOTLOADER, LASAT_MTD_SERVICE, @@ -242,9 +236,6 @@ static inline void lasat_ndelay(unsigned #endif /* !defined (_LANGUAGE_ASSEMBLY) */ -#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef -#define LASAT_SERVICEMODE_MAGIC_2 0xfedeabba - /* Lasat 200 boards */ #define Vrc5074_PHYS_BASE 0x1fa00000 #define Vrc5074_BASE (KSEG1ADDR(Vrc5074_PHYS_BASE))