summaryrefslogtreecommitdiffstats
path: root/drivers/power/reset/syscon-poweroff.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-05-05 08:20:52 +0200
committerIngo Molnar <mingo@kernel.org>2017-05-05 08:21:03 +0200
commit415812f2d6b856d33ede9bf4a2b95575dbbb3d4e (patch)
tree4daf9ca52f89ea59453538b406f584d47c77aff3 /drivers/power/reset/syscon-poweroff.c
parentx86/asm: Don't use RBP as a temporary register in csum_partial_copy_generic() (diff)
parentMerge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/... (diff)
downloadlinux-415812f2d6b856d33ede9bf4a2b95575dbbb3d4e.tar.xz
linux-415812f2d6b856d33ede9bf4a2b95575dbbb3d4e.zip
Merge branch 'linus' into x86/urgent, to pick up dependent commits
We are going to fix a bug introduced by a more recent commit, so refresh the tree. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/power/reset/syscon-poweroff.c')
-rw-r--r--drivers/power/reset/syscon-poweroff.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c
index b68338399e5e..f9f1cb54fbf9 100644
--- a/drivers/power/reset/syscon-poweroff.c
+++ b/drivers/power/reset/syscon-poweroff.c
@@ -28,12 +28,13 @@
static struct regmap *map;
static u32 offset;
+static u32 value;
static u32 mask;
static void syscon_poweroff(void)
{
/* Issue the poweroff */
- regmap_write(map, offset, mask);
+ regmap_update_bits(map, offset, mask, value);
mdelay(1000);
@@ -43,6 +44,7 @@ static void syscon_poweroff(void)
static int syscon_poweroff_probe(struct platform_device *pdev)
{
char symname[KSYM_NAME_LEN];
+ int mask_err, value_err;
map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap");
if (IS_ERR(map)) {
@@ -55,11 +57,22 @@ static int syscon_poweroff_probe(struct platform_device *pdev)
return -EINVAL;
}
- if (of_property_read_u32(pdev->dev.of_node, "mask", &mask)) {
- dev_err(&pdev->dev, "unable to read 'mask'");
+ value_err = of_property_read_u32(pdev->dev.of_node, "value", &value);
+ mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &mask);
+ if (value_err && mask_err) {
+ dev_err(&pdev->dev, "unable to read 'value' and 'mask'");
return -EINVAL;
}
+ if (value_err) {
+ /* support old binding */
+ value = mask;
+ mask = 0xFFFFFFFF;
+ } else if (mask_err) {
+ /* support value without mask*/
+ mask = 0xFFFFFFFF;
+ }
+
if (pm_power_off) {
lookup_symbol_name((ulong)pm_power_off, symname);
dev_err(&pdev->dev,