From patchwork Mon Feb 22 16:55:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylvain Lemieux X-Patchwork-Id: 8380331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EBB3DC0553 for ; Mon, 22 Feb 2016 16:59:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D61120520 for ; Mon, 22 Feb 2016 16:59:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38AB020504 for ; Mon, 22 Feb 2016 16:59:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXtoB-0007q7-AX; Mon, 22 Feb 2016 16:58:03 +0000 Received: from mail-ig0-x230.google.com ([2607:f8b0:4001:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXtml-0006tP-Ja for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 16:56:37 +0000 Received: by mail-ig0-x230.google.com with SMTP id xg9so80851245igb.1 for ; Mon, 22 Feb 2016 08:56:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h8TR14tS2KpoEvc7YEJncjoS1IZTZVjTW60BOuIc9wE=; b=TUgdU4hfKFxMi4UhFessBPoCiJoRF1HySMUTYbKY2ONpoKmkR8y8P+hQGk+4Tm3NOK tW7I/NPKqDSmM/xNzUFMN79nJkICHQZzIPgpZ/cJ2xbF8EsRCIHtZdBSfEbJnEZp+wxs /8hRM/VPJDE9Bzkzlly+AKiuBl93RbOJ/iGDRZkGxmSMU8iVaehzBHVw0OvSRazjCFIH OuQ6TWr6RuuxqCIGDP4svIO0Nm0h5aPFI6xDp0lxpeZeQiVKLJPHzGRIHod84OkC3K7H VhfwCLZteKdYtdvy3NlYuxH+hdC94l91hLtGcxwWKeByORFDbhMW5zLJ/uFaTDWpY43z UMEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=h8TR14tS2KpoEvc7YEJncjoS1IZTZVjTW60BOuIc9wE=; b=YwWGRkDRnn3zKxixjzkscm3WeKQb+A/yLPv9KrR8kb2K2+E90JzDwOswRGTC8y/39r F9HS4sOKamXQLqTWtvq94qtgUef/no/HCnx9u3m80q1u+SSX/Z4zjOHs88Zv4nzsGeSD 1d5MIOiNataQLZOdt1/9GTnmGwn+Hle3GxkT7HKpJKSYkQIJ8tUXaQNyRau9qnOu0khF WRoxdvY0yO5qAN4F6L3B+bOT/1MIEsqMJnSa6aZPBwpyDMyzFFmY+HRG8efDwXp4Xln+ UdhLZKI5kVGlTmwn9n7WLWZBR1e41wrAbZ0gqGTptbji+0XAZyQR7eNLPTNCDQmSHBHo qSRg== X-Gm-Message-State: AG10YOS8FL7S1KXwAkXys64VtO0WI2AJ5lJzn/FGqVAWI9Nu9GTEw8azpU7b19/wLg7KMQ== X-Received: by 10.50.13.1 with SMTP id d1mr12896558igc.46.1456160174680; Mon, 22 Feb 2016 08:56:14 -0800 (PST) Received: from CABRO3AP00510.americas.tsp.ad ([74.51.240.241]) by smtp.gmail.com with ESMTPSA id x69sm11786084ioi.16.2016.02.22.08.56.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 08:56:13 -0800 (PST) From: slemieux.tyco@gmail.com To: linux-arm-kernel@lists.infradead.org, wim@iguana.be, manabian@gmail.com Subject: [PATCH v2 4/5] watchdog: pnx4008: restart: support "cmd" from userspace Date: Mon, 22 Feb 2016 11:55:42 -0500 Message-Id: <1456160143-26761-5-git-send-email-slemieux.tyco@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1456160143-26761-1-git-send-email-slemieux.tyco@gmail.com> References: <1456160143-26761-1-git-send-email-slemieux.tyco@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_085635_915521_BE7E7E1F X-CRM114-Status: GOOD ( 14.06 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stigge@antcom.de, linux-watchdog@vger.kernel.org, linux@roeck-us.net, vz@mleia.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Sylvain Lemieux Added support to verify if a "cmd" is passed from the userspace program rebooting the system; - if a valid "cmd" is available, handle it; - If the received "cmd" is not supported, use the default reboot mode. Signed-off-by: Sylvain Lemieux --- Changes from v1 to v2: - Rename patch title; was "arm: lpc32xx: restart: support "cmd" from userspace" - Add change to "pnx-4008" driver instead of "mach-lpc32xx". drivers/watchdog/pnx4008_wdt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 2275fd4..5f34299 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c @@ -133,6 +133,19 @@ static void pnx4008_wdt_sys_reset(enum reboot_mode mode, const char *cmd) /* Make sure WDT clocks are enabled */ writel(LPC32XX_CLKPWR_PWMCLK_WDOG_EN, LPC32XX_CLKPWR_TIMER_CLK_CTRL); + /* + * Verify if a "cmd" passed from the userspace program rebooting + * the system; if available, and handle it. + * - For details, see the 'reboot' syscall in kernel/reboot.c + * - If the received "cmd" is not supported, use the default mode. + */ + if (cmd) { + if (cmd[0] == 'h') + mode = REBOOT_HARD; + else if (cmd[0] == 's') + mode = REBOOT_SOFT; + } + if (mode == REBOOT_SOFT) { /* Force match output active */ writel(EXT_MATCH0, WDTIM_EMR(wdt_base));