From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
Arnd Bergmann <arnd@arndb.de>
Cc: linux-sh@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 1/4] ARM: shmobile: R-Mobile: Add SYSC restart handler
Date: Wed, 3 Dec 2014 15:17:04 +0100 [thread overview]
Message-ID: <1417616227-6715-2-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1417616227-6715-1-git-send-email-geert+renesas@glider.be>
Extend the PM domain platform driver for the R-Mobile System
Controller (SYSC) to register a restart handler, to be used on various
Renesas ARM SoCs (e.g. R-Mobile A1 (r8a7740) and APE6 (r8a73a4), and
SH-Mobile AP4 (sh7372) and AG5 (sh73a0)).
Note that this supports DT-based platforms only.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
arch/arm/mach-shmobile/pm-rmobile.c | 48 ++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index f540096c05f6eabd..b82da04c7210a98d 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -23,14 +23,22 @@
#include <linux/slab.h>
#include <asm/io.h>
+#include <asm/system_misc.h>
#include "pm-rmobile.h"
-/* SYSC */
+/* SYSC Register Bank 1 */
#define SPDCR 0x08 /* SYS Power Down Control Register */
#define SWUCR 0x14 /* SYS Wakeup Control Register */
#define PSTR 0x80 /* Power Status Register */
+/* SYSC Register Bank 2 */
+#define RESCNT2 0x20 /* Reset Control Register 2 */
+
+/* Reset Control Register 2 */
+#define RESCNT2_PRES 0x80000000 /* Soft power-on reset */
+
+
#define PSTR_RETRIES 100
#define PSTR_DELAY_US 10
@@ -400,3 +408,41 @@ static int __init rmobile_init_pm_domains(void)
core_initcall(rmobile_init_pm_domains);
#endif /* !CONFIG_ARCH_SHMOBILE_LEGACY */
+
+
+static void __iomem *sysc_base2;
+
+static void rmobile_sysc_restart(enum reboot_mode reboot_mode, const char *cmd)
+{
+ pr_debug("%s %u/%s\n", __func__, reboot_mode, cmd);
+
+ writel(RESCNT2_PRES, sysc_base2 + RESCNT2);
+}
+
+static int rmobile_sysc_probe(struct platform_device *pdev)
+{
+ dev_dbg(&pdev->dev, "%s\n", __func__);
+
+ sysc_base2 = of_iomap(pdev->dev.of_node, 1);
+ if (!sysc_base2)
+ return -ENODEV;
+
+ arm_pm_restart = rmobile_sysc_restart;
+
+ return 0;
+}
+
+static const struct of_device_id rmobile_sysc_of_match[] = {
+ { .compatible = "renesas,sysc-rmobile", },
+ { /* sentinel */ }
+};
+
+static struct platform_driver rmobile_sysc_driver = {
+ .probe = rmobile_sysc_probe,
+ .driver = {
+ .name = "rmobile_sysc",
+ .of_match_table = rmobile_sysc_of_match,
+ },
+};
+
+module_platform_driver(rmobile_sysc_driver);
--
1.9.1
next prev parent reply other threads:[~2014-12-03 14:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 14:17 [PATCH 0/4] ARM: shmobile: R-Mobile: Add SYSC restart handler Geert Uytterhoeven
2014-12-03 14:17 ` Geert Uytterhoeven [this message]
2014-12-04 10:08 ` [PATCH 1/4] " Arnd Bergmann
2014-12-04 11:47 ` Geert Uytterhoeven
2014-12-04 12:53 ` Geert Uytterhoeven
2014-12-03 14:17 ` [PATCH 2/4] ARM: shmobile: r8a7740: Remove restart callback Geert Uytterhoeven
2014-12-03 14:17 ` [PATCH 3/4] ARM: shmobile: sh73a0: " Geert Uytterhoeven
2014-12-03 14:17 ` [PATCH 4/4] ARM: shmobile: kzm9g-reference: " Geert Uytterhoeven
2014-12-04 7:34 ` [PATCH 0/4] ARM: shmobile: R-Mobile: Add SYSC restart handler Simon Horman
2014-12-04 9:39 ` Geert Uytterhoeven
2014-12-04 12:18 ` Simon Horman
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=1417616227-6715-2-git-send-email-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=arnd@arndb.de \
--cc=horms@verge.net.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/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