Hi Ralf, This patch has updated reset operations for cobalt. Yoichi Signed-off-by: Yoichi Yuasa <yoichi_yuasa@xxxxxxxxxxxxxx> diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/cobalt/reset.c mips/arch/mips/cobalt/reset.c --- mips-orig/arch/mips/cobalt/reset.c 2006-10-12 10:28:55.612126500 +0900 +++ mips/arch/mips/cobalt/reset.c 2006-10-12 10:32:39.698131000 +0900 @@ -8,17 +8,33 @@ * Copyright (C) 1995, 1996, 1997 by Ralf Baechle * Copyright (C) 2001 by Liam Davies (ldavies@xxxxxxxx) */ -#include <linux/sched.h> -#include <linux/mm.h> -#include <asm/cacheflush.h> +#include <linux/init.h> +#include <linux/jiffies.h> +#include <linux/pm.h> + #include <asm/io.h> -#include <asm/processor.h> #include <asm/reboot.h> -#include <asm/system.h> -#include <asm/mipsregs.h> -#include <asm/mach-cobalt/cobalt.h> -void cobalt_machine_halt(void) +#define COBALT_LED_PORT (void __iomem *)CKSEG1ADDR(0x1c000000) +# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */ +# define COBALT_LED_BAR_RIGHT (1 << 1) /* Qube */ +# define COBALT_LED_WEB (1 << 2) /* RaQ */ +# define COBALT_LED_POWER_OFF (1 << 3) /* RaQ */ +# define COBALT_LED_RESET 0x0f + +#define COBALT_KEY_PORT \ + ((~readl((void __iomem *)CKSEG1ADDR(0x1d000000)) >> 24) & \ + COBALT_KEY_MASK) +# define COBALT_KEY_CLEAR (1 << 1) +# define COBALT_KEY_LEFT (1 << 2) +# define COBALT_KEY_UP (1 << 3) +# define COBALT_KEY_DOWN (1 << 4) +# define COBALT_KEY_RIGHT (1 << 5) +# define COBALT_KEY_ENTER (1 << 6) +# define COBALT_KEY_SELECT (1 << 7) +# define COBALT_KEY_MASK 0xfe + +static void cobalt_machine_halt(void) { int state, last, diff; unsigned long mark; @@ -34,22 +50,23 @@ void cobalt_machine_halt(void) for (state = 0;;) { state ^= COBALT_LED_POWER_OFF; - COBALT_LED_PORT = state; + writeb(state, COBALT_LED_PORT); diff = COBALT_KEY_PORT ^ last; last ^= diff; - if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) - COBALT_LED_PORT = COBALT_LED_RESET; + if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && + !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) + writeb(COBALT_LED_RESET, COBALT_LED_PORT); for (mark = jiffies; jiffies - mark < HZ;) ; } } -void cobalt_machine_restart(char *command) +static void cobalt_machine_restart(char *command) { - COBALT_LED_PORT = COBALT_LED_RESET; + writeb(COBALT_LED_RESET, COBALT_LED_PORT); /* we should never get here */ cobalt_machine_halt(); @@ -58,8 +75,19 @@ void cobalt_machine_restart(char *comman /* * This triggers the luser mode device driver for the power switch ;-) */ -void cobalt_machine_power_off(void) +static void cobalt_machine_power_off(void) { printk("You can switch the machine off now.\n"); cobalt_machine_halt(); } + +static int __init cobalt_reset_init(void) +{ + _machine_restart = cobalt_machine_restart; + _machine_halt = cobalt_machine_halt; + pm_power_off = cobalt_machine_power_off; + + return 0; +} + +arch_initcall(cobalt_reset_init); diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/cobalt/setup.c mips/arch/mips/cobalt/setup.c --- mips-orig/arch/mips/cobalt/setup.c 2006-10-12 10:32:51.726882750 +0900 +++ mips/arch/mips/cobalt/setup.c 2006-10-12 10:34:09.171722750 +0900 @@ -12,7 +12,6 @@ #include <linux/interrupt.h> #include <linux/pci.h> #include <linux/init.h> -#include <linux/pm.h> #include <linux/serial.h> #include <linux/serial_core.h> @@ -21,14 +20,10 @@ #include <asm/io.h> #include <asm/irq.h> #include <asm/processor.h> -#include <asm/reboot.h> #include <asm/gt64120.h> #include <asm/mach-cobalt/cobalt.h> -extern void cobalt_machine_restart(char *command); -extern void cobalt_machine_halt(void); -extern void cobalt_machine_power_off(void); extern void cobalt_early_console(void); int cobalt_board_id; @@ -82,10 +77,6 @@ void __init plat_mem_setup(void) unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0); int i; - _machine_restart = cobalt_machine_restart; - _machine_halt = cobalt_machine_halt; - pm_power_off = cobalt_machine_power_off; - set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE)); ioport_resource.end = 0xffff; diff -pruN -X mips/Documentation/dontdiff mips-orig/include/asm-mips/mach-cobalt/cobalt.h mips/include/asm-mips/mach-cobalt/cobalt.h --- mips-orig/include/asm-mips/mach-cobalt/cobalt.h 2006-10-12 10:32:50.006775250 +0900 +++ mips/include/asm-mips/mach-cobalt/cobalt.h 2006-10-12 10:32:39.698131000 +0900 @@ -71,23 +71,6 @@ GT_WRITE(GT_PCI0_CFGADDR_OFS, (0x80000000 | (PCI_SLOT (devfn) << 11) | \ (PCI_FUNC (devfn) << 8) | (where))) -#define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000)) -# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */ -# define COBALT_LED_BAR_RIGHT (1 << 1) /* Qube */ -# define COBALT_LED_WEB (1 << 2) /* RaQ */ -# define COBALT_LED_POWER_OFF (1 << 3) /* RaQ */ -# define COBALT_LED_RESET 0x0f - -#define COBALT_KEY_PORT ((~*(volatile unsigned int *) CKSEG1ADDR(0x1d000000) >> 24) & COBALT_KEY_MASK) -# define COBALT_KEY_CLEAR (1 << 1) -# define COBALT_KEY_LEFT (1 << 2) -# define COBALT_KEY_UP (1 << 3) -# define COBALT_KEY_DOWN (1 << 4) -# define COBALT_KEY_RIGHT (1 << 5) -# define COBALT_KEY_ENTER (1 << 6) -# define COBALT_KEY_SELECT (1 << 7) -# define COBALT_KEY_MASK 0xfe - #define COBALT_UART ((volatile unsigned char *) CKSEG1ADDR(0x1c800000)) #endif /* __ASM_COBALT_H */