aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-12-19 10:56:27 -0500
committerSebastian Reichel <sre@kernel.org>2015-01-20 07:58:27 -0500
commit0160817d10a97900b9ee08a8b8b2f5a148e2be0f (patch)
tree5831737bfb20182e2d960b1337ef83453e8ae296 /drivers/power
parent06efe0e54018cb19cf0807447dc3ac747ffcfd1c (diff)
power: reset: augment versatile driver for integrator
Augment the Versatile reset driver to also handle the core module reset sequence used on the Integrator/AP and Integrator/CP. Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Sebastian Reichel <sre@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/reset/arm-versatile-reboot.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/power/reset/arm-versatile-reboot.c b/drivers/power/reset/arm-versatile-reboot.c
index 5b08bffcf1a8..adea9d0c38e0 100644
--- a/drivers/power/reset/arm-versatile-reboot.c
+++ b/drivers/power/reset/arm-versatile-reboot.c
@@ -15,14 +15,21 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <asm/system_misc.h> 16#include <asm/system_misc.h>
17 17
18#define INTEGRATOR_HDR_CTRL_OFFSET 0x0C
19#define INTEGRATOR_HDR_LOCK_OFFSET 0x14
20#define INTEGRATOR_CM_CTRL_RESET (1 << 3)
21
18#define REALVIEW_SYS_LOCK_OFFSET 0x20 22#define REALVIEW_SYS_LOCK_OFFSET 0x20
19#define REALVIEW_SYS_LOCK_VAL 0xA05F
20#define REALVIEW_SYS_RESETCTL_OFFSET 0x40 23#define REALVIEW_SYS_RESETCTL_OFFSET 0x40
21 24
25/* Magic unlocking token used on all Versatile boards */
26#define VERSATILE_LOCK_VAL 0xA05F
27
22/* 28/*
23 * We detect the different syscon types from the compatible strings. 29 * We detect the different syscon types from the compatible strings.
24 */ 30 */
25enum versatile_reboot { 31enum versatile_reboot {
32 INTEGRATOR_REBOOT_CM,
26 REALVIEW_REBOOT_EB, 33 REALVIEW_REBOOT_EB,
27 REALVIEW_REBOOT_PB1176, 34 REALVIEW_REBOOT_PB1176,
28 REALVIEW_REBOOT_PB11MP, 35 REALVIEW_REBOOT_PB11MP,
@@ -36,6 +43,10 @@ static enum versatile_reboot versatile_reboot_type;
36 43
37static const struct of_device_id versatile_reboot_of_match[] = { 44static const struct of_device_id versatile_reboot_of_match[] = {
38 { 45 {
46 .compatible = "arm,core-module-integrator",
47 .data = (void *)INTEGRATOR_REBOOT_CM
48 },
49 {
39 .compatible = "arm,realview-eb-syscon", 50 .compatible = "arm,realview-eb-syscon",
40 .data = (void *)REALVIEW_REBOOT_EB, 51 .data = (void *)REALVIEW_REBOOT_EB,
41 }, 52 },
@@ -55,31 +66,46 @@ static const struct of_device_id versatile_reboot_of_match[] = {
55 .compatible = "arm,realview-pbx-syscon", 66 .compatible = "arm,realview-pbx-syscon",
56 .data = (void *)REALVIEW_REBOOT_PBX, 67 .data = (void *)REALVIEW_REBOOT_PBX,
57 }, 68 },
69 {},
58}; 70};
59 71
60static void versatile_reboot(enum reboot_mode mode, const char *cmd) 72static void versatile_reboot(enum reboot_mode mode, const char *cmd)
61{ 73{
62 /* Unlock the reset register */ 74 /* Unlock the reset register */
63 regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
64 REALVIEW_SYS_LOCK_VAL);
65 /* Then hit reset on the different machines */ 75 /* Then hit reset on the different machines */
66 switch (versatile_reboot_type) { 76 switch (versatile_reboot_type) {
77 case INTEGRATOR_REBOOT_CM:
78 regmap_write(syscon_regmap, INTEGRATOR_HDR_LOCK_OFFSET,
79 VERSATILE_LOCK_VAL);
80 regmap_update_bits(syscon_regmap,
81 INTEGRATOR_HDR_CTRL_OFFSET,
82 INTEGRATOR_CM_CTRL_RESET,
83 INTEGRATOR_CM_CTRL_RESET);
84 break;
67 case REALVIEW_REBOOT_EB: 85 case REALVIEW_REBOOT_EB:
86 regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
87 VERSATILE_LOCK_VAL);
68 regmap_write(syscon_regmap, 88 regmap_write(syscon_regmap,
69 REALVIEW_SYS_RESETCTL_OFFSET, 0x0008); 89 REALVIEW_SYS_RESETCTL_OFFSET, 0x0008);
70 break; 90 break;
71 case REALVIEW_REBOOT_PB1176: 91 case REALVIEW_REBOOT_PB1176:
92 regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
93 VERSATILE_LOCK_VAL);
72 regmap_write(syscon_regmap, 94 regmap_write(syscon_regmap,
73 REALVIEW_SYS_RESETCTL_OFFSET, 0x0100); 95 REALVIEW_SYS_RESETCTL_OFFSET, 0x0100);
74 break; 96 break;
75 case REALVIEW_REBOOT_PB11MP: 97 case REALVIEW_REBOOT_PB11MP:
76 case REALVIEW_REBOOT_PBA8: 98 case REALVIEW_REBOOT_PBA8:
99 regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
100 VERSATILE_LOCK_VAL);
77 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 101 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,
78 0x0000); 102 0x0000);
79 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 103 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,
80 0x0004); 104 0x0004);
81 break; 105 break;
82 case REALVIEW_REBOOT_PBX: 106 case REALVIEW_REBOOT_PBX:
107 regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
108 VERSATILE_LOCK_VAL);
83 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 109 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,
84 0x00f0); 110 0x00f0);
85 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 111 regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,