Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdb3592a authored by David S. Miller's avatar David S. Miller
Browse files

sparc64: Move reboot handling into seperate file and kill power reg programming.



We should always use prom_power_off().

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e822358a
Loading
Loading
Loading
Loading

arch/sparc/include/asm/reboot.h

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
#ifndef _SPARC64_REBOOT_H
#define _SPARC64_REBOOT_H

extern void machine_alt_power_off(void);

#endif /* _SPARC64_REBOOT_H */
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ EXTRA_CFLAGS := -Werror

extra-y		:= head.o init_task.o vmlinux.lds

obj-y		:= process.o setup.o cpu.o idprom.o \
obj-y		:= process.o setup.o cpu.o idprom.o reboot.o \
		   traps.o auxio.o una_asm.o sysfs.o iommu.o \
		   irq.o ptrace.o time.o sys_sparc.o signal.o \
		   unaligned.o central.o starfire.o \
+0 −37
Original line number Diff line number Diff line
@@ -7,21 +7,11 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/reboot.h>
#include <linux/of_device.h>

#include <asm/auxio.h>
#include <asm/prom.h>
#include <asm/io.h>
#include <asm/sstate.h>
#include <asm/reboot.h>

/*
 * sysctl - toggle power-off restriction for serial console 
 * systems in machine_power_off()
 */
int scons_pwroff = 1; 

static void __iomem *power_reg;

@@ -33,31 +23,6 @@ static irqreturn_t power_handler(int irq, void *dev_id)
	return IRQ_HANDLED;
}

static void (*poweroff_method)(void) = machine_alt_power_off;

void machine_power_off(void)
{
	sstate_poweroff();
	if (strcmp(of_console_device->type, "serial") || scons_pwroff) {
		if (power_reg) {
			/* Both register bits seem to have the
			 * same effect, so until I figure out
			 * what the difference is...
			 */
			writel(AUXIO_PCIO_CPWR_OFF | AUXIO_PCIO_SPWR_OFF, power_reg);
		} else {
			if (poweroff_method != NULL) {
				poweroff_method();
				/* not reached */
			}
		}
	}
	machine_halt();
}

void (*pm_power_off)(void) = machine_power_off;
EXPORT_SYMBOL(pm_power_off);

static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
{
	if (irq == 0xffffffff)
@@ -78,8 +43,6 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id
	printk(KERN_INFO "%s: Control reg at %lx\n",
	       op->node->name, res->start);

	poweroff_method = machine_halt;  /* able to use the standard halt */

	if (has_button_interrupt(irq, op->node)) {
		if (request_irq(irq,
				power_handler, 0, "power", NULL) < 0)
+0 −33
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
#include <linux/reboot.h>
#include <linux/delay.h>
#include <linux/compat.h>
#include <linux/tick.h>
@@ -31,7 +30,6 @@
#include <linux/elfcore.h>
#include <linux/sysrq.h>

#include <asm/oplib.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/page.h>
@@ -46,8 +44,6 @@
#include <asm/mmu_context.h>
#include <asm/unistd.h>
#include <asm/hypervisor.h>
#include <asm/sstate.h>
#include <asm/reboot.h>
#include <asm/syscalls.h>
#include <asm/irq_regs.h>
#include <asm/smp.h>
@@ -115,35 +111,6 @@ void cpu_idle(void)
	}
}

void machine_halt(void)
{
	sstate_halt();
	prom_halt();
	panic("Halt failed!");
}

void machine_alt_power_off(void)
{
	sstate_poweroff();
	prom_halt_power_off();
	panic("Power-off failed!");
}

void machine_restart(char * cmd)
{
	char *p;
	
	sstate_reboot();
	p = strchr (reboot_command, '\n');
	if (p) *p = 0;
	if (cmd)
		prom_reboot(cmd);
	if (*reboot_command)
		prom_reboot(reboot_command);
	prom_reboot("");
	panic("Reboot failed!");
}

#ifdef CONFIG_COMPAT
static void show_regwindow32(struct pt_regs *regs)
{
+56 −0
Original line number Diff line number Diff line
/* reboot.c: reboot/shutdown/halt/poweroff handling
 *
 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
 */
#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/module.h>
#include <linux/pm.h>

#include <asm/sstate.h>
#include <asm/oplib.h>
#include <asm/prom.h>

/* sysctl - toggle power-off restriction for serial console
 * systems in machine_power_off()
 */
int scons_pwroff = 1;

/* This isn't actually used, it exists merely to satisfy the
 * reference in kernel/sys.c
 */
void (*pm_power_off)(void) = machine_power_off;
EXPORT_SYMBOL(pm_power_off);

void machine_power_off(void)
{
	sstate_poweroff();
	if (strcmp(of_console_device->type, "serial") || scons_pwroff)
		prom_halt_power_off();

	prom_halt();
}

void machine_halt(void)
{
	sstate_halt();
	prom_halt();
	panic("Halt failed!");
}

void machine_restart(char *cmd)
{
	char *p;

	sstate_reboot();
	p = strchr(reboot_command, '\n');
	if (p)
		*p = 0;
	if (cmd)
		prom_reboot(cmd);
	if (*reboot_command)
		prom_reboot(reboot_command);
	prom_reboot("");
	panic("Reboot failed!");
}