From patchwork Wed Dec 3 14:17:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 5431121 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 81BAABEEA8 for ; Wed, 3 Dec 2014 14:17:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC89B20303 for ; Wed, 3 Dec 2014 14:17:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2D1720353 for ; Wed, 3 Dec 2014 14:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751983AbaLCORP (ORCPT ); Wed, 3 Dec 2014 09:17:15 -0500 Received: from laurent.telenet-ops.be ([195.130.137.89]:41230 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499AbaLCORN (ORCPT ); Wed, 3 Dec 2014 09:17:13 -0500 Received: from ayla.of.borg ([84.193.93.87]) by laurent.telenet-ops.be with bizsmtp id P2HA1p0071t5w8s012HADT; Wed, 03 Dec 2014 15:17:10 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1XwAjt-0002tG-WF; Wed, 03 Dec 2014 15:17:10 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1XwAju-0001m3-5H; Wed, 03 Dec 2014 15:17:10 +0100 From: Geert Uytterhoeven To: Simon Horman , Magnus Damm , Arnd Bergmann Cc: linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven Subject: [PATCH 1/4] ARM: shmobile: R-Mobile: Add SYSC restart handler Date: Wed, 3 Dec 2014 15:17:04 +0100 Message-Id: <1417616227-6715-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417616227-6715-1-git-send-email-geert+renesas@glider.be> References: <1417616227-6715-1-git-send-email-geert+renesas@glider.be> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include +#include #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);