LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 1/6] power/reset: arm-versatile: Register with kernel restart handler
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
@ 2015-01-25 20:30 ` Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 2/6] power/reset: at91: " Guenter Roeck
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-01-25 20:30 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, Guenter Roeck, David Woodhouse,
Dmitry Eremin-Solenikov, linux-kernel
Register with kernel restart handler instead of setting arm_pm_restart
directly. Select high priority since the restart handler is instantiated
through devicetree, indicating that it should be used if configured.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/arm-versatile-reboot.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/power/reset/arm-versatile-reboot.c b/drivers/power/reset/arm-versatile-reboot.c
index adea9d0..b208073 100644
--- a/drivers/power/reset/arm-versatile-reboot.c
+++ b/drivers/power/reset/arm-versatile-reboot.c
@@ -13,7 +13,6 @@
#include <linux/reboot.h>
#include <linux/regmap.h>
#include <linux/of.h>
-#include <asm/system_misc.h>
#define INTEGRATOR_HDR_CTRL_OFFSET 0x0C
#define INTEGRATOR_HDR_LOCK_OFFSET 0x14
@@ -69,7 +68,8 @@ static const struct of_device_id versatile_reboot_of_match[] = {
{},
};
-static void versatile_reboot(enum reboot_mode mode, const char *cmd)
+static int versatile_reboot(struct notifier_block *this, unsigned long mode,
+ void *cmd)
{
/* Unlock the reset register */
/* Then hit reset on the different machines */
@@ -113,12 +113,20 @@ static void versatile_reboot(enum reboot_mode mode, const char *cmd)
break;
}
dsb();
+
+ return NOTIFY_DONE;
}
+static struct notifier_block versatile_reboot_nb = {
+ .notifier_call = versatile_reboot,
+ .priority = 192,
+};
+
static int __init versatile_reboot_probe(void)
{
const struct of_device_id *reboot_id;
struct device_node *np;
+ int err;
np = of_find_matching_node_and_match(NULL, versatile_reboot_of_match,
&reboot_id);
@@ -130,7 +138,10 @@ static int __init versatile_reboot_probe(void)
if (IS_ERR(syscon_regmap))
return PTR_ERR(syscon_regmap);
- arm_pm_restart = versatile_reboot;
+ err = register_restart_handler(&versatile_reboot_nb);
+ if (err)
+ return err;
+
pr_info("versatile reboot driver registered\n");
return 0;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/6] power/reset: at91: Register with kernel restart handler
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
2015-01-25 20:30 ` [PATCH v2 1/6] power/reset: arm-versatile: Register with kernel restart handler Guenter Roeck
@ 2015-01-25 20:30 ` Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 3/6] power/reset: Remove sun6i reboot driver Guenter Roeck
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-01-25 20:30 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, Guenter Roeck, David Woodhouse,
Dmitry Eremin-Solenikov, linux-kernel
Register with kernel restart handler instead of setting arm_pm_restart
directly. Register with high priority since the driver unconditionally
overwrites other restart handlers if instantiated.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/at91-reset.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 69a75d99..13584e2 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -17,8 +17,6 @@
#include <linux/platform_device.h>
#include <linux/reboot.h>
-#include <asm/system_misc.h>
-
#include <soc/at91/at91sam9_ddrsdr.h>
#include <soc/at91/at91sam9_sdramc.h>
@@ -54,7 +52,8 @@ static void __iomem *at91_ramc_base[2], *at91_rstc_base;
* reset register it can be left driving the data bus and
* killing the chance of a subsequent boot from NAND
*/
-static void at91sam9260_restart(enum reboot_mode mode, const char *cmd)
+static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
+ void *cmd)
{
asm volatile(
/* Align to cache lines */
@@ -76,9 +75,12 @@ static void at91sam9260_restart(enum reboot_mode mode, const char *cmd)
"r" (1),
"r" (AT91_SDRAMC_LPCB_POWER_DOWN),
"r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST));
+
+ return NOTIFY_DONE;
}
-static void at91sam9g45_restart(enum reboot_mode mode, const char *cmd)
+static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
+ void *cmd)
{
asm volatile(
/*
@@ -117,6 +119,8 @@ static void at91sam9g45_restart(enum reboot_mode mode, const char *cmd)
"r" (AT91_DDRSDRC_LPCB_POWER_DOWN),
"r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST)
: "r0");
+
+ return NOTIFY_DONE;
}
static void __init at91_reset_status(struct platform_device *pdev)
@@ -161,6 +165,10 @@ static struct of_device_id at91_reset_of_match[] = {
{ /* sentinel */ }
};
+static struct notifier_block at91_restart_nb = {
+ .priority = 192,
+};
+
static int at91_reset_of_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
@@ -183,9 +191,8 @@ static int at91_reset_of_probe(struct platform_device *pdev)
}
match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
- arm_pm_restart = match->data;
-
- return 0;
+ at91_restart_nb.notifier_call = match->data;
+ return register_restart_handler(&at91_restart_nb);
}
static int at91_reset_platform_probe(struct platform_device *pdev)
@@ -212,10 +219,11 @@ static int at91_reset_platform_probe(struct platform_device *pdev)
}
match = platform_get_device_id(pdev);
- arm_pm_restart = (void (*)(enum reboot_mode, const char*))
- match->driver_data;
+ at91_restart_nb.notifier_call =
+ (int (*)(struct notifier_block *,
+ unsigned long, void *)) match->driver_data;
- return 0;
+ return register_restart_handler(&at91_restart_nb);
}
static int at91_reset_probe(struct platform_device *pdev)
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/6] power/reset: Remove sun6i reboot driver
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
2015-01-25 20:30 ` [PATCH v2 1/6] power/reset: arm-versatile: Register with kernel restart handler Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 2/6] power/reset: at91: " Guenter Roeck
@ 2015-01-25 20:30 ` Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 4/6] power/reset: st-poweroff: Register with kernel restart handler Guenter Roeck
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-01-25 20:30 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, Guenter Roeck, David Woodhouse, devicetree,
Dmitry Eremin-Solenikov, Grant Likely, linux-arm-kernel,
linux-kernel, Maxime Ripard, Rob Herring
sun6i restart is now handled by its watchdog driver directly,
so this driver is no longer needed.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/Kconfig | 6 ---
drivers/power/reset/Makefile | 1 -
drivers/power/reset/sun6i-reboot.c | 85 --------------------------------------
3 files changed, 92 deletions(-)
delete mode 100644 drivers/power/reset/sun6i-reboot.c
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index bf5acb3..4cb5744 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -109,12 +109,6 @@ config POWER_RESET_RESTART
Instead they restart, and u-boot holds the SoC until the
user presses a key. u-boot then boots into Linux.
-config POWER_RESET_SUN6I
- bool "Allwinner A31 SoC reset driver"
- depends on ARCH_SUNXI
- help
- Reboot support for the Allwinner A31 SoCs.
-
config POWER_RESET_ST
bool "ST restart power-off driver"
depends on ARCH_STI
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 1631652..11de15b 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o
obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
-obj-$(CONFIG_POWER_RESET_SUN6I) += sun6i-reboot.o
obj-$(CONFIG_POWER_RESET_ST) += st-poweroff.o
obj-$(CONFIG_POWER_RESET_VERSATILE) += arm-versatile-reboot.o
obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
diff --git a/drivers/power/reset/sun6i-reboot.c b/drivers/power/reset/sun6i-reboot.c
deleted file mode 100644
index af2cd7f..0000000
--- a/drivers/power/reset/sun6i-reboot.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Allwinner A31 SoCs reset code
- *
- * Copyright (C) 2012-2014 Maxime Ripard
- *
- * Maxime Ripard <maxime.ripard@free-electrons.com>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/platform_device.h>
-#include <linux/reboot.h>
-
-#include <asm/system_misc.h>
-
-#define SUN6I_WATCHDOG1_IRQ_REG 0x00
-#define SUN6I_WATCHDOG1_CTRL_REG 0x10
-#define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0)
-#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
-#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
-#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
-#define SUN6I_WATCHDOG1_MODE_REG 0x18
-#define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0)
-
-static void __iomem *wdt_base;
-
-static void sun6i_wdt_restart(enum reboot_mode mode, const char *cmd)
-{
- if (!wdt_base)
- return;
-
- /* Disable interrupts */
- writel(0, wdt_base + SUN6I_WATCHDOG1_IRQ_REG);
-
- /* We want to disable the IRQ and just reset the whole system */
- writel(SUN6I_WATCHDOG1_CONFIG_RESTART,
- wdt_base + SUN6I_WATCHDOG1_CONFIG_REG);
-
- /* Enable timer. The default and lowest interval value is 0.5s */
- writel(SUN6I_WATCHDOG1_MODE_ENABLE,
- wdt_base + SUN6I_WATCHDOG1_MODE_REG);
-
- /* Restart the watchdog. */
- writel(SUN6I_WATCHDOG1_CTRL_RESTART,
- wdt_base + SUN6I_WATCHDOG1_CTRL_REG);
-
- while (1) {
- mdelay(5);
- writel(SUN6I_WATCHDOG1_MODE_ENABLE,
- wdt_base + SUN6I_WATCHDOG1_MODE_REG);
- }
-}
-
-static int sun6i_reboot_probe(struct platform_device *pdev)
-{
- wdt_base = of_iomap(pdev->dev.of_node, 0);
- if (!wdt_base) {
- WARN(1, "failed to map watchdog base address");
- return -ENODEV;
- }
-
- arm_pm_restart = sun6i_wdt_restart;
-
- return 0;
-}
-
-static struct of_device_id sun6i_reboot_of_match[] = {
- { .compatible = "allwinner,sun6i-a31-wdt" },
- {}
-};
-
-static struct platform_driver sun6i_reboot_driver = {
- .probe = sun6i_reboot_probe,
- .driver = {
- .name = "sun6i-reboot",
- .of_match_table = sun6i_reboot_of_match,
- },
-};
-module_platform_driver(sun6i_reboot_driver);
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 4/6] power/reset: st-poweroff: Register with kernel restart handler
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
` (2 preceding siblings ...)
2015-01-25 20:30 ` [PATCH v2 3/6] power/reset: Remove sun6i reboot driver Guenter Roeck
@ 2015-01-25 20:30 ` Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 5/6] power/reset: st-poweroff: Fix misleading Kconfig description Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 6/6] power/reset: restart-poweroff: Remove arm dependencies Guenter Roeck
5 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-01-25 20:30 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, Guenter Roeck, David Woodhouse,
Dmitry Eremin-Solenikov, linux-kernel
Register with kernel restart handler instead of setting arm_pm_restart
directly. Select high priority since the restart handler is instantiated
through devicetree, indicating that it should be used if configured.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/st-poweroff.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/power/reset/st-poweroff.c b/drivers/power/reset/st-poweroff.c
index a0acf25..27383de 100644
--- a/drivers/power/reset/st-poweroff.c
+++ b/drivers/power/reset/st-poweroff.c
@@ -15,10 +15,9 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/mfd/syscon.h>
+#include <linux/reboot.h>
#include <linux/regmap.h>
-#include <asm/system_misc.h>
-
struct reset_syscfg {
struct regmap *regmap;
/* syscfg used for reset */
@@ -75,7 +74,8 @@ static struct reset_syscfg stid127_reset = {
static struct reset_syscfg *st_restart_syscfg;
-static void st_restart(enum reboot_mode reboot_mode, const char *cmd)
+static int st_restart(struct notifier_block *this, unsigned long mode,
+ void *cmd)
{
/* reset syscfg updated */
regmap_update_bits(st_restart_syscfg->regmap,
@@ -88,8 +88,15 @@ static void st_restart(enum reboot_mode reboot_mode, const char *cmd)
st_restart_syscfg->offset_rst_msk,
st_restart_syscfg->mask_rst_msk,
0);
+
+ return NOTIFY_DONE;
}
+static struct notifier_block st_restart_nb = {
+ .notifier_call = st_restart,
+ .priority = 192,
+};
+
static struct of_device_id st_reset_of_match[] = {
{
.compatible = "st,stih415-restart",
@@ -126,9 +133,7 @@ static int st_reset_probe(struct platform_device *pdev)
return PTR_ERR(st_restart_syscfg->regmap);
}
- arm_pm_restart = st_restart;
-
- return 0;
+ return register_restart_handler(&st_restart_nb);
}
static struct platform_driver st_reset_driver = {
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 5/6] power/reset: st-poweroff: Fix misleading Kconfig description
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
` (3 preceding siblings ...)
2015-01-25 20:30 ` [PATCH v2 4/6] power/reset: st-poweroff: Register with kernel restart handler Guenter Roeck
@ 2015-01-25 20:30 ` Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 6/6] power/reset: restart-poweroff: Remove arm dependencies Guenter Roeck
5 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-01-25 20:30 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, Guenter Roeck, David Woodhouse,
Dmitry Eremin-Solenikov, linux-kernel
The st-poweroff driver does not really power off the system
but resets it, so Kconfig should not claim that the driver
would handle power-off.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 4cb5744..bb81e2a 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -110,10 +110,10 @@ config POWER_RESET_RESTART
user presses a key. u-boot then boots into Linux.
config POWER_RESET_ST
- bool "ST restart power-off driver"
+ bool "ST restart driver"
depends on ARCH_STI
help
- Power off and reset support for STMicroelectronics boards.
+ Reset support for STMicroelectronics boards.
config POWER_RESET_VERSATILE
bool "ARM Versatile family reboot driver"
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 6/6] power/reset: restart-poweroff: Remove arm dependencies
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
` (4 preceding siblings ...)
2015-01-25 20:30 ` [PATCH v2 5/6] power/reset: st-poweroff: Fix misleading Kconfig description Guenter Roeck
@ 2015-01-25 20:30 ` Guenter Roeck
5 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-01-25 20:30 UTC (permalink / raw)
To: Sebastian Reichel
Cc: linux-pm, Guenter Roeck, David Woodhouse,
Dmitry Eremin-Solenikov, linux-kernel
This driver is now arm specific anymore, so there is no need to include
an arm specific include file. Also drop unnecessary depencency on ARM
from Kconfig.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/Kconfig | 1 -
drivers/power/reset/restart-poweroff.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index bb81e2a..27f6646 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -103,7 +103,6 @@ config POWER_RESET_QNAP
config POWER_RESET_RESTART
bool "Restart power-off driver"
- depends on ARM
help
Some boards don't actually have the ability to power off.
Instead they restart, and u-boot holds the SoC until the
diff --git a/drivers/power/reset/restart-poweroff.c b/drivers/power/reset/restart-poweroff.c
index f46f2c2..41b22c4 100644
--- a/drivers/power/reset/restart-poweroff.c
+++ b/drivers/power/reset/restart-poweroff.c
@@ -16,7 +16,6 @@
#include <linux/of_platform.h>
#include <linux/module.h>
#include <linux/reboot.h>
-#include <asm/system_misc.h>
static void restart_poweroff_do_poweroff(void)
{
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-01-25 20:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1422217845-18901-1-git-send-email-linux@roeck-us.net>
2015-01-25 20:30 ` [PATCH v2 1/6] power/reset: arm-versatile: Register with kernel restart handler Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 2/6] power/reset: at91: " Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 3/6] power/reset: Remove sun6i reboot driver Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 4/6] power/reset: st-poweroff: Register with kernel restart handler Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 5/6] power/reset: st-poweroff: Fix misleading Kconfig description Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 6/6] power/reset: restart-poweroff: Remove arm dependencies Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).