block: move down direct IO plugging
[linux/fpc-iii.git] / arch / arm / mach-vt8500 / restart.c
blob497e89a5e130db74fd50b519b2fbedb660733cb7
1 /* linux/arch/arm/mach-vt8500/restart.c
3 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <asm/io.h>
16 #include <linux/of.h>
17 #include <linux/of_address.h>
19 #define LEGACY_PMC_BASE 0xD8130000
20 #define WMT_PRIZM_PMSR_REG 0x60
22 static void __iomem *pmc_base;
24 void wmt_setup_restart(void)
26 struct device_node *np;
29 * Check if Power Mgmt Controller node is present in device tree. If no
30 * device tree node, use the legacy PMSR value (valid for all current
31 * SoCs).
33 np = of_find_compatible_node(NULL, NULL, "wmt,prizm-pmc");
34 if (np) {
35 pmc_base = of_iomap(np, 0);
37 if (!pmc_base)
38 pr_err("%s:of_iomap(pmc) failed\n", __func__);
40 of_node_put(np);
41 } else {
42 pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
43 if (!pmc_base) {
44 pr_err("%s:ioremap(rstc) failed\n", __func__);
45 return;
50 void wmt_restart(char mode, const char *cmd)
52 if (pmc_base)
53 writel(1, pmc_base + WMT_PRIZM_PMSR_REG);