Skip to content
Snippets Groups Projects
Commit 3ca543f3 authored by Goran Ferenc's avatar Goran Ferenc Committed by David 'Digit' Turner
Browse files

MIPS: Attach ranchu machine reset and power-off routines


If "reboot" or "reboot -p" are requested from the emulator, these
routines will be triggered which in return should reset or power-off the
machine.

In order to enable this power management device, appropriate device tree node
"goldfish_reset" is expected in the device tree to acquire device memory map
location.

This simple device contains only one register, which holds commands to be performed.
    GORESET: 0x42 command for reboot
    GOPOWEROFF: 0x43 command for shutdown

Change-Id: I151b518a3982cb6c871dedf566846fa07c9304c6
Signed-off-by: default avatarGoran Ferenc <goran.ferenc@imgtec.com>
parent 5ef86344
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ obj-$(CONFIG_GOLDFISH) += goldfish-platform.o ...@@ -10,6 +10,7 @@ obj-$(CONFIG_GOLDFISH) += goldfish-platform.o
obj-$(CONFIG_GOLDFISH) += goldfish-interrupt.o obj-$(CONFIG_GOLDFISH) += goldfish-interrupt.o
obj-$(CONFIG_GOLDFISH) += goldfish-time.o obj-$(CONFIG_GOLDFISH) += goldfish-time.o
obj-$(CONFIG_GOLDFISH) += pm.o obj-$(CONFIG_GOLDFISH) += pm.o
obj-$(CONFIG_GOLDFISH) += goldfish-reset.o
obj-$(CONFIG_MIPS_GOLDFISH_SWITCH) += switch.o obj-$(CONFIG_MIPS_GOLDFISH_SWITCH) += switch.o
......
/* arch/mips/goldfish/goldfish-reset.c
*
* Goldfish Machine Reset Routines
*
* Copyright (C) 2007 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/init.h>
#include <linux/pm.h>
#include <linux/io.h>
#include <linux/of.h>
#include <asm/idle.h>
#include <asm/reboot.h>
#include <asm/mips-boards/generic.h>
#define GORESET 0x42
#define GOSHUTDOWN 0x43
static struct device_node *dn;
static uint32_t base;
static unsigned int __iomem *softres_reg;
static void mips_machine_restart(char *command)
{
writel(GORESET, softres_reg);
}
static void mips_machine_halt(void)
{
writel(GOSHUTDOWN, softres_reg);
}
static int __init mips_reboot_setup(void)
{
if ((dn = of_find_node_by_name(NULL, "goldfish_reset")) == NULL) {
printk(KERN_WARNING "mips_reboot_setup() failed to "
"fetch device node \'goldfish_reset\'!\n");
return -1;
}
if (of_property_read_u32(dn, "reg", &base) < 0) {
printk(KERN_WARNING "mips_reboot_setup() failed to "
"fetch device base address property \'reg\'! %x\n", base);
return -1;
}
softres_reg = ioremap(base, sizeof(unsigned int));
_machine_restart = mips_machine_restart;
_machine_halt = mips_machine_halt;
pm_power_off = mips_machine_halt;
return 0;
}
arch_initcall(mips_reboot_setup);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment