From patchwork Sat May 10 16:23:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 4148711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E6EAA9F23C for ; Sat, 10 May 2014 16:26:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 16205201BB for ; Sat, 10 May 2014 16:26:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 327552018E for ; Sat, 10 May 2014 16:26:40 +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 1WjA4C-0000wA-4z; Sat, 10 May 2014 16:24:04 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WjA49-0000UO-Ds for linux-arm-kernel@lists.infradead.org; Sat, 10 May 2014 16:24:02 +0000 Received: by mail-pa0-f53.google.com with SMTP id kp14so5602584pab.26 for ; Sat, 10 May 2014 09:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=EhmGgl9sO36QH8hCb6AXLBN7InN0PEIO1pVd2EyYuPY=; b=v9/q+31dXgJ12pOgKUQrqfCkNcmmLMWaoYiQGEhwZ5w9KUZF9pXKRv7ABWsfH7aRce j/4eBdIC1qhbHYWhEUbNTWJKGPbiEbc/HSRmyxY+fi8ZxwRdHb/PlmXOp6YOnJWcH3OK T4tMNDep7pMKD80I6YxMli5drPYz1lM6liBcUxa113ND5V8c6yM1eYggscFeY/KYUlyM 3W3uUBBmCj9jxtz9ysNW/s+IDQut5Ud2WdnggX01BFRAkNkO9uUPhAccqhq+5qE4Vjwi 05uQEgdUayQnIJZmlD1CHey8A+wi/jHIHHi9l/pntCQ4irK+9JedAB7jBueKmZRwy0C+ kN6Q== X-Received: by 10.66.177.168 with SMTP id cr8mr34294613pac.128.1399739019489; Sat, 10 May 2014 09:23:39 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by mx.google.com with ESMTPSA id mt1sm13602615pbb.31.2014.05.10.09.23.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 10 May 2014 09:23:38 -0700 (PDT) Date: Sat, 10 May 2014 09:23:29 -0700 From: Guenter Roeck To: Randy Dunlap Subject: [PATCH 6/5] watchdog: Document reboot API Message-ID: <20140510162329.GA19884@roeck-us.net> References: <1399681883-891-1-git-send-email-linux@roeck-us.net> <536D74E3.8010609@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <536D74E3.8010609@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140510_092401_498411_53503651 X-CRM114-Status: GOOD ( 19.59 ) X-Spam-Score: 0.2 (/) Cc: Russell King , linux-watchdog@vger.kernel.org, Arnd Bergmann , linux-doc@vger.kernel.org, Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Jonas Jensen , Wim Van Sebroeck , Maxime Ripard , linux-arm-kernel@lists.infradead.org, Heiko Stuebner X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 Document the new reboot API functionality. Signed-off-by: Guenter Roeck --- Documentation/watchdog/watchdog-kernel-api.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index a0438f3..f8f0f18 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt @@ -90,6 +90,8 @@ struct watchdog_ops { int (*stop)(struct watchdog_device *); /* optional operations */ int (*ping)(struct watchdog_device *); + void (*reboot)(struct watchdog_device *, enum reboot_mode, + const char *); unsigned int (*status)(struct watchdog_device *); int (*set_timeout)(struct watchdog_device *, unsigned int); unsigned int (*get_timeleft)(struct watchdog_device *); @@ -148,6 +150,10 @@ they are supported. These optional routines/operations are: info structure). * status: this routine checks the status of the watchdog timer device. The status of the device is reported with watchdog WDIOF_* status flags/bits. +* reboot: if this routine is present, it may be called to reboot the system. + Parameters are the pointer to the watchdog device, the reboot mode, and a + command string. The latter two parameters are the system reboot mode + and the cmd parameter passed to machine_restart(). * set_timeout: this routine checks and changes the timeout of the watchdog timer device. It returns 0 on success, -EINVAL for "parameter out of range" and -EIO for "could not write value to the watchdog". On success this @@ -224,3 +230,11 @@ the device tree (if the module timeout parameter is invalid). Best practice is to set the default timeout value as timeout value in the watchdog_device and then use this function to set the user "preferred" timeout value. This routine returns zero on success and a negative errno code for failure. + +The watchdog_do_reboot function can be used reboot the system. This is intended +to be used in systems which do not have an explicit reboot capability, but +implement reboot by programming the watchdog to expire immediately. If the +function is called, and a watchdog driver with reboot functionality was +previously registered, the reboot function of that driver will be called. +Architecture code should call watchdog_do_reboot from its machine_reboot +function after other means to reboot the system failed.