From patchwork Tue Sep 30 17:48:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 5005391 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 91D35BEEA6 for ; Tue, 30 Sep 2014 17:50:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BCE0C20220 for ; Tue, 30 Sep 2014 17:50:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5B8E20200 for ; Tue, 30 Sep 2014 17:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753443AbaI3RtH (ORCPT ); Tue, 30 Sep 2014 13:49:07 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:41130 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753386AbaI3RtA (ORCPT ); Tue, 30 Sep 2014 13:49:00 -0400 Received: by mail-pd0-f181.google.com with SMTP id z10so5543595pdj.26 for ; Tue, 30 Sep 2014 10:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=d5mXBV+dxQRgpYIrlTT7qirXEnu7Fg+Dla1PgEvS0GI=; b=o0/PISoXigntgSN2KbhOIG+Q7+idAs+qAP+AXtz9al69YjoQmT//zLx1o4yUPgouVP VK+G8sRgSrjTx0Hj1/cpVSzUdoOnH/SBA0rgDqDM7V2Tj/FqVDIx3T5z/mwSnyQcQp2w 5nct32QWIQ5yRQWUN8lJDBXNxFJcYFemLF4b9SpFG1YaIOW2YhOSuD9UwOAbwzzlNTfB mujla+6Cwh3VCLDRnq+54dxlCd0KZIC0Ld5E3BBX+0rZp9SfJ1jEohf43GNO4dPKmxPa Be00lZbpjuTSIjOAeGK4xTUv1D8voB6M8Gea1Jxlm/W9ZantxzGK8bUl6u7c/2MObzNs 7mtA== X-Received: by 10.66.66.163 with SMTP id g3mr25818774pat.150.1412099339939; Tue, 30 Sep 2014 10:48:59 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by mx.google.com with ESMTPSA id oz6sm15768946pdb.38.2014.09.30.10.48.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 30 Sep 2014 10:48:59 -0700 (PDT) From: Guenter Roeck To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, Dmitry Eremin-Solenikov , David Woodhouse , Santosh Shilimkar , linux-kernel@vger.kernel.org, Guenter Roeck , Anders Berg Subject: [PATCH v2 07/10] power/reset: axxia: Register with kernel restart handler Date: Tue, 30 Sep 2014 10:48:33 -0700 Message-Id: <1412099316-23167-8-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412099316-23167-1-git-send-email-linux@roeck-us.net> References: <1412099316-23167-1-git-send-email-linux@roeck-us.net> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Register with kernel restart handler instead of setting arm_pm_restart directly. Cc: Anders Berg Tested-by: Anders Berg Signed-off-by: Guenter Roeck --- drivers/power/reset/axxia-reset.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/power/reset/axxia-reset.c b/drivers/power/reset/axxia-reset.c index 3b1f8d6..4e4cd1c 100644 --- a/drivers/power/reset/axxia-reset.c +++ b/drivers/power/reset/axxia-reset.c @@ -19,14 +19,12 @@ #include #include #include +#include #include #include #include #include -#include - - #define SC_CRIT_WRITE_KEY 0x1000 #define SC_LATCH_ON_RESET 0x1004 #define SC_RESET_CONTROL 0x1008 @@ -39,7 +37,8 @@ static struct regmap *syscon; -static void do_axxia_restart(enum reboot_mode reboot_mode, const char *cmd) +static int axxia_restart_handler(struct notifier_block *this, + unsigned long mode, void *cmd) { /* Access Key (0xab) */ regmap_write(syscon, SC_CRIT_WRITE_KEY, 0xab); @@ -50,11 +49,19 @@ static void do_axxia_restart(enum reboot_mode reboot_mode, const char *cmd) /* Assert chip reset */ regmap_update_bits(syscon, SC_RESET_CONTROL, RSTCTL_RST_CHIP, RSTCTL_RST_CHIP); + + return NOTIFY_DONE; } +static struct notifier_block axxia_restart_nb = { + .notifier_call = axxia_restart_handler, + .priority = 128, +}; + static int axxia_reset_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + int err; syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); if (IS_ERR(syscon)) { @@ -62,9 +69,11 @@ static int axxia_reset_probe(struct platform_device *pdev) return PTR_ERR(syscon); } - arm_pm_restart = do_axxia_restart; + err = register_restart_handler(&axxia_restart_nb); + if (err) + dev_err(dev, "cannot register restart handler (err=%d)\n", err); - return 0; + return err; } static const struct of_device_id of_axxia_reset_match[] = {