From: Domenico Andreoli <domenico.andreoli@linux.com>
To: linux-arch@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
linux-mips@lvger.kernel.org,
Russell King <linux@arm.linux.org.uk>,
Arnd Bergmann <arnd@arndb.de>, Olof Johansson <olof@lixom.net>,
Ralf Baechle <ralf@linux-mips.org>,
Linus Walleij <linus.walleij@linaro.org>,
Domenico Andreoli <domenico.andreoli@linux.com>
Subject: [PATCH 08/11] ARM: u300: use the common machine reset handling
Date: Thu, 31 Oct 2013 07:27:16 +0100 [thread overview]
Message-ID: <20131031063000.361406973@linux.com> (raw)
In-Reply-To: 20131031062708.520968323@linux.com
[-- Attachment #1: arm-machine-reset-u300.patch --]
[-- Type: text/plain, Size: 2870 bytes --]
From: Domenico Andreoli <domenico.andreoli@linux.com>
Proof of concept: u300 as provider of reset hooks.
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <olof@lixom.net>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
---
arch/arm/mach-u300/regulator.c | 23 ++++++++++++++---------
drivers/regulator/Kconfig | 1 +
2 files changed, 15 insertions(+), 9 deletions(-)
Index: b/drivers/regulator/Kconfig
===================================================================
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -106,6 +106,7 @@ config REGULATOR_AB3100
tristate "ST-Ericsson AB3100 Regulator functions"
depends on AB3100_CORE
default y if AB3100_CORE
+ select MACHINE_RESET
help
These regulators correspond to functionality in the
AB3100 analog baseband dealing with power regulators
Index: b/arch/arm/mach-u300/regulator.c
===================================================================
--- a/arch/arm/mach-u300/regulator.c
+++ b/arch/arm/mach-u300/regulator.c
@@ -17,6 +17,7 @@
#include <linux/regulator/consumer.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
+#include <linux/machine_reset.h>
/* Power Management Control 16bit (R/W) */
#define U300_SYSCON_PMCR (0x50)
@@ -24,20 +25,14 @@
#define U300_SYSCON_PMCR_PWR_MGNT_ENABLE (0x0001)
/*
- * Regulators that power the board and chip and which are
- * not copuled to specific drivers are hogged in these
- * instances.
- */
-static struct regulator *main_power_15;
-
-/*
* This function is used from pm.h to shut down the system by
* resetting all regulators in turn and then disable regulator
* LDO D (main power).
*/
-void u300_pm_poweroff(void)
+void u300_pm_poweroff(void *dev)
{
sigset_t old, all;
+ struct regulator *main_power_15 = dev;
sigfillset(&all);
if (!sigprocmask(SIG_BLOCK, &all, &old)) {
@@ -51,6 +46,11 @@ void u300_pm_poweroff(void)
return;
}
+static void u300_reset_hook_release(void *dev)
+{
+ regulator_put(dev);
+}
+
/*
* Hog the regulators needed to power up the board.
*/
@@ -58,7 +58,9 @@ static int __init __u300_init_boardpower
{
struct device_node *np = pdev->dev.of_node;
struct device_node *syscon_np;
+ struct regulator *main_power_15;
struct regmap *regmap;
+ struct reset_hook hook;
int err;
pr_info("U300: setting up board power\n");
@@ -98,7 +100,10 @@ static int __init __u300_init_boardpower
U300_SYSCON_PMCR_DCON_ENABLE, 0);
/* Register globally exported PM poweroff hook */
- pm_power_off = u300_pm_poweroff;
+ reset_hook_init(&hook);
+ hook.power_off = u300_pm_poweroff;
+ hook.release = u300_reset_hook_release;
+ set_machine_reset(RESET_POWER_OFF, &hook, main_power_15);
return 0;
}
next prev parent reply other threads:[~2013-10-31 6:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 6:27 [PATCH 00/11] RFC: Common machine reset handling Domenico Andreoli
2013-10-31 6:27 ` [PATCH 01/11] machine-reset: platform generic handling Domenico Andreoli
2013-10-31 6:27 ` [PATCH 02/11] ARM: use the common machine reset handling Domenico Andreoli
2013-10-31 6:27 ` [PATCH 03/11] ARM64: " Domenico Andreoli
2013-10-31 6:27 ` [PATCH 04/11] MIPS: " Domenico Andreoli
2013-11-01 5:11 ` Vineet Gupta
2013-11-01 5:26 ` Domenico Andreoli
2013-10-31 6:27 ` [PATCH 05/11] ARM: vexpress: consolidate machine reset func Domenico Andreoli
2013-10-31 6:27 ` [PATCH 06/11] ARM: vexpress: use the common machine reset handling Domenico Andreoli
2013-10-31 6:27 ` [PATCH 07/11] ARM: bcm2835: " Domenico Andreoli
2013-10-31 6:27 ` Domenico Andreoli [this message]
2013-10-31 14:40 ` [PATCH 08/11] ARM: u300: " Linus Walleij
2013-10-31 15:19 ` Domenico Andreoli
2013-10-31 6:27 ` [PATCH 09/11] ARM: tps65910: " Domenico Andreoli
2013-10-31 6:27 ` [PATCH 10/11] max8907: " Domenico Andreoli
2013-10-31 6:27 ` [PATCH 11/11] ARM: sp805: " Domenico Andreoli
2013-10-31 10:21 ` [PATCH 00/11] RFC: Common " Russell King - ARM Linux
2013-10-31 21:49 ` Stephen Warren
2013-11-01 5:16 ` Domenico Andreoli
2013-11-01 15:58 ` Stephen Warren
2013-11-01 16:12 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131031063000.361406973@linux.com \
--to=domenico.andreoli@linux.com \
--cc=arnd@arndb.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mips@lvger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=olof@lixom.net \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).