diff options
author | Anders Berg <anders.berg@lsi.com> | 2014-05-23 05:08:38 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2014-05-23 12:18:45 -0400 |
commit | 4a315e3457e008e0570c392822ae98cdf7761227 (patch) | |
tree | 6e602fd67651e433571db36df7c2c86a1ffbfd85 | |
parent | 2baa4559ab7c934b3b6ced33e6e369081f27e7df (diff) |
power: reset: Add Axxia system reset driver
Add Axxia (AXM55xx) SoC system reset driver. This driver handles only system
reboot (and not power-off).
Signed-off-by: Anders Berg <anders.berg@lsi.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | Documentation/devicetree/bindings/power_supply/axxia-reset.txt | 20 | ||||
-rw-r--r-- | drivers/power/reset/Kconfig | 8 | ||||
-rw-r--r-- | drivers/power/reset/Makefile | 1 | ||||
-rw-r--r-- | drivers/power/reset/axxia-reset.c | 88 |
4 files changed, 117 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/power_supply/axxia-reset.txt b/Documentation/devicetree/bindings/power_supply/axxia-reset.txt new file mode 100644 index 000000000000..47e720d249d2 --- /dev/null +++ b/Documentation/devicetree/bindings/power_supply/axxia-reset.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | Axxia Restart Driver | ||
2 | |||
3 | This driver can do reset of the Axxia SoC. It uses the registers in the syscon | ||
4 | block to initiate a chip reset. | ||
5 | |||
6 | Required Properties: | ||
7 | -compatible: "lsi,axm55xx-reset" | ||
8 | -syscon: phandle to the syscon node. | ||
9 | |||
10 | Example: | ||
11 | |||
12 | syscon: syscon@2010030000 { | ||
13 | compatible = "lsi,axxia-syscon", "syscon"; | ||
14 | reg = <0x20 0x10030000 0 0x2000>; | ||
15 | }; | ||
16 | |||
17 | reset: reset@2010031000 { | ||
18 | compatible = "lsi,axm55xx-reset"; | ||
19 | syscon = <&syscon>; | ||
20 | }; | ||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index fa0e4e057b99..49b46e6ca959 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig | |||
@@ -12,6 +12,14 @@ config POWER_RESET_AS3722 | |||
12 | help | 12 | help |
13 | This driver supports turning off board via a ams AS3722 power-off. | 13 | This driver supports turning off board via a ams AS3722 power-off. |
14 | 14 | ||
15 | config POWER_RESET_AXXIA | ||
16 | bool "LSI Axxia reset driver" | ||
17 | depends on POWER_RESET && ARCH_AXXIA | ||
18 | help | ||
19 | This driver supports restart for Axxia SoC. | ||
20 | |||
21 | Say Y if you have an Axxia family SoC. | ||
22 | |||
15 | config POWER_RESET_GPIO | 23 | config POWER_RESET_GPIO |
16 | bool "GPIO power-off driver" | 24 | bool "GPIO power-off driver" |
17 | depends on OF_GPIO && POWER_RESET | 25 | depends on OF_GPIO && POWER_RESET |
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index a5b4a77d1a41..16c0516e5a19 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o | 1 | obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o |
2 | obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o | ||
2 | obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o | 3 | obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o |
3 | obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o | 4 | obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o |
4 | obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o | 5 | obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o |
diff --git a/drivers/power/reset/axxia-reset.c b/drivers/power/reset/axxia-reset.c new file mode 100644 index 000000000000..3b1f8d601784 --- /dev/null +++ b/drivers/power/reset/axxia-reset.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Reset driver for Axxia devices | ||
3 | * | ||
4 | * Copyright (C) 2014 LSI | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 and | ||
8 | * only version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/mfd/syscon.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/reboot.h> | ||
25 | #include <linux/regmap.h> | ||
26 | |||
27 | #include <asm/system_misc.h> | ||
28 | |||
29 | |||
30 | #define SC_CRIT_WRITE_KEY 0x1000 | ||
31 | #define SC_LATCH_ON_RESET 0x1004 | ||
32 | #define SC_RESET_CONTROL 0x1008 | ||
33 | #define RSTCTL_RST_ZERO (1<<3) | ||
34 | #define RSTCTL_RST_FAB (1<<2) | ||
35 | #define RSTCTL_RST_CHIP (1<<1) | ||
36 | #define RSTCTL_RST_SYS (1<<0) | ||
37 | #define SC_EFUSE_INT_STATUS 0x180c | ||
38 | #define EFUSE_READ_DONE (1<<31) | ||
39 | |||
40 | static struct regmap *syscon; | ||
41 | |||
42 | static void do_axxia_restart(enum reboot_mode reboot_mode, const char *cmd) | ||
43 | { | ||
44 | /* Access Key (0xab) */ | ||
45 | regmap_write(syscon, SC_CRIT_WRITE_KEY, 0xab); | ||
46 | /* Select internal boot from 0xffff0000 */ | ||
47 | regmap_write(syscon, SC_LATCH_ON_RESET, 0x00000040); | ||
48 | /* Assert ResetReadDone (to avoid hanging in boot ROM) */ | ||
49 | regmap_write(syscon, SC_EFUSE_INT_STATUS, EFUSE_READ_DONE); | ||
50 | /* Assert chip reset */ | ||
51 | regmap_update_bits(syscon, SC_RESET_CONTROL, | ||
52 | RSTCTL_RST_CHIP, RSTCTL_RST_CHIP); | ||
53 | } | ||
54 | |||
55 | static int axxia_reset_probe(struct platform_device *pdev) | ||
56 | { | ||
57 | struct device *dev = &pdev->dev; | ||
58 | |||
59 | syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); | ||
60 | if (IS_ERR(syscon)) { | ||
61 | pr_err("%s: syscon lookup failed\n", dev->of_node->name); | ||
62 | return PTR_ERR(syscon); | ||
63 | } | ||
64 | |||
65 | arm_pm_restart = do_axxia_restart; | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static const struct of_device_id of_axxia_reset_match[] = { | ||
71 | { .compatible = "lsi,axm55xx-reset", }, | ||
72 | {}, | ||
73 | }; | ||
74 | MODULE_DEVICE_TABLE(of, of_axxia_reset_match); | ||
75 | |||
76 | static struct platform_driver axxia_reset_driver = { | ||
77 | .probe = axxia_reset_probe, | ||
78 | .driver = { | ||
79 | .name = "axxia-reset", | ||
80 | .of_match_table = of_match_ptr(of_axxia_reset_match), | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static int __init axxia_reset_init(void) | ||
85 | { | ||
86 | return platform_driver_register(&axxia_reset_driver); | ||
87 | } | ||
88 | device_initcall(axxia_reset_init); | ||