提交 86cc0ef8 编写于 作者: T Tony Prisk 提交者: Arnd Bergmann

ARM:vt8500: Convert to use .restart and remove arch_reset()

Removed system.h as it only contained an inline for arch_reset()
Changed the existing board files to use .restart in there machine
descriptions.

Added device tree support for the restart controller.
Device tree support for mach-vt8500 is still a work-in-progress.
Signed-off-by: NTony Prisk <linux@prisktech.co.nz>
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
上级 c26abeb7
obj-y += devices.o gpio.o irq.o timer.o obj-y += devices.o gpio.o irq.o timer.o restart.o
obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o
obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/restart.h>
#include "devices.h" #include "devices.h"
...@@ -62,6 +63,7 @@ void __init bv07_init(void) ...@@ -62,6 +63,7 @@ void __init bv07_init(void)
else else
printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n"); printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n");
wmt_setup_restart();
vt8500_set_resources(); vt8500_set_resources();
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
vt8500_gpio_init(); vt8500_gpio_init();
...@@ -69,6 +71,7 @@ void __init bv07_init(void) ...@@ -69,6 +71,7 @@ void __init bv07_init(void)
MACHINE_START(BV07, "Benign BV07 Mini Netbook") MACHINE_START(BV07, "Benign BV07 Mini Netbook")
.atag_offset = 0x100, .atag_offset = 0x100,
.restart = wmt_restart,
.reserve = vt8500_reserve_mem, .reserve = vt8500_reserve_mem,
.map_io = vt8500_map_io, .map_io = vt8500_map_io,
.init_irq = vt8500_init_irq, .init_irq = vt8500_init_irq,
......
/* linux/arch/arm/mach-vt8500/restart.h
*
* Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
*
* 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.
*
*/
void wmt_setup_restart(void);
void wmt_restart(char mode, const char *cmd);
/*
* arch/arm/mach-vt8500/include/mach/system.h
*
*/
#include <asm/io.h>
/* PM Software Reset request register */
#define VT8500_PMSR_VIRT 0xf8130060
static inline void arch_reset(char mode, const char *cmd)
{
writel(1, VT8500_PMSR_VIRT);
}
/* linux/arch/arm/mach-vt8500/restart.c
*
* Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
*
* 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 <asm/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
#define LEGACY_PMC_BASE 0xD8130000
#define WMT_PRIZM_PMSR_REG 0x60
static void __iomem *pmc_base;
void wmt_setup_restart(void)
{
struct device_node *np;
/*
* Check if Power Mgmt Controller node is present in device tree. If no
* device tree node, use the legacy PMSR value (valid for all current
* SoCs).
*/
np = of_find_compatible_node(NULL, NULL, "wmt,prizm-pmc");
if (np) {
pmc_base = of_iomap(np, 0);
if (!pmc_base)
pr_err("%s:of_iomap(pmc) failed\n", __func__);
of_node_put(np);
} else {
pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
if (!pmc_base) {
pr_err("%s:ioremap(rstc) failed\n", __func__);
return;
}
}
}
void wmt_restart(char mode, const char *cmd)
{
if (pmc_base)
writel(1, pmc_base + WMT_PRIZM_PMSR_REG);
}
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/restart.h>
#include "devices.h" #include "devices.h"
...@@ -61,7 +62,7 @@ void __init wm8505_7in_init(void) ...@@ -61,7 +62,7 @@ void __init wm8505_7in_init(void)
pm_power_off = &vt8500_power_off; pm_power_off = &vt8500_power_off;
else else
printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n"); printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n");
wmt_setup_restart();
wm8505_set_resources(); wm8505_set_resources();
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
vt8500_gpio_init(); vt8500_gpio_init();
...@@ -69,6 +70,7 @@ void __init wm8505_7in_init(void) ...@@ -69,6 +70,7 @@ void __init wm8505_7in_init(void)
MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook") MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook")
.atag_offset = 0x100, .atag_offset = 0x100,
.restart = wmt_restart,
.reserve = wm8505_reserve_mem, .reserve = wm8505_reserve_mem,
.map_io = wm8505_map_io, .map_io = wm8505_map_io,
.init_irq = wm8505_init_irq, .init_irq = wm8505_init_irq,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册