From patchwork Sat Aug 12 18:43:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 109935 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp2442383qge; Sat, 12 Aug 2017 11:43:41 -0700 (PDT) X-Received: by 10.84.137.169 with SMTP id 38mr21789325pln.331.1502563421865; Sat, 12 Aug 2017 11:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502563421; cv=none; d=google.com; s=arc-20160816; b=B97xvpyoVNQD6MF2RIPXFbxZW2hUZ28RZVR/3l/x/H0rtRLuRRX7KNYZmbNkUeoDFG TC1xwV3c/00nCV/XFQzUCF+I2F2UCexVwwJ7JhCxn/Xsmc1Fmvtb2aFfTVd6qqZaG0QP bu4zpyKg+FKG4U6Yfk95rc6rDkkIzmSP40E3sxMJ5L/5CtzgePam4J6Uvd9mZx4LtDwo FGjobsf9vR+VbggT4GIa8n1PM7wHsYkTV81sIHMIQ502ewJv2AUXnADkRo37VP7oNSnV 5uCd2KEvCJSiLuuq/lEgF5EN+5OwsNzC34CnLM2v/mVGIsCJE+Fk0kbpjPvD03Q5wSyw +ZwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ymPLFK2hV8x1Mgxlt39vXhC6XC58bvKrYPsh6BWbnOE=; b=dfmjxi1K3kVSFzrWy7UiQ2HTSrm/uFIU6zKYRVzr4yiN/QQJ0E5iUgf/wlWTfp+x9c /tSkIJPu1aVdMTbwAPl0KF5Rsp8raOAMVes8aEs/QL+Kp14c8Qa174XBfvXaqVTvbqKH hs6SowSCE9aJ3wMGnOS0FvcZA+1HRcXoom2MPiLf/CHKIu9oLZl5gy9qxdEQevdFqS6a wo9NHFueFcXT62Z205HTigeGcAeYPq6V4ANt/qLyJFJGexXFoCi/HR9VuouMEjan5Q9h 9n2UpPqo2olHC529sKlGQ6Q3HI0aWm99znDnPMMJEBsImeRkpVw0kCdw5xrmwfktsEMv wokw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ct+s7SK1; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p24si2288117pli.501.2017.08.12.11.43.41 for ; Sat, 12 Aug 2017 11:43:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ct+s7SK1; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751480AbdHLSnl (ORCPT ); Sat, 12 Aug 2017 14:43:41 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:35181 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbdHLSnl (ORCPT ); Sat, 12 Aug 2017 14:43:41 -0400 Received: by mail-lf0-f54.google.com with SMTP id t128so27038907lff.2 for ; Sat, 12 Aug 2017 11:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c0JDdooZT7fvyB4RoQlKZY+ReA+TUYDdoyeDE3pE5c8=; b=Ct+s7SK175ZbUWj4/SXqp9cmB8NNU3kMzPKUinNo34EE3FcpQTPrk7kOSQYg9ojA5C +PyaeyidaMjIInHlgJ1IryuWOXXYCwzm3BI4Kna+9s3xfQJexJAFp4Oehwz6NZvuuI7d ZXV7Tuclv+bs+taivpB9E9xc88359Y0Pyu6hM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c0JDdooZT7fvyB4RoQlKZY+ReA+TUYDdoyeDE3pE5c8=; b=M71+fIcoqQzUCBAiDH3KYQks7Y8fxIwVP6vSuiTH6xr5evpePM5PDvqpHzryzpLxZu an9QX2il3vUh2gYfd5EaC8F3RyJn4vSdJ7KVKlVEgRGziEKGi793qXQ0mSe5XeqNj2wx qrVUJWbKbrV5fkaXDBZjS3UWbNLQXNQsWOAlwOC1akVCP3XEzQAsmlFVdBBYKzKpoO4S HcJ8oCeyUW+YNnV8mJB1ivZBv1Ou4M+XRQupsxGuwMIlpqkpWfCJe0UIBnWhy06jRkp+ PrXJkBNKDQowLJUZBRFUu2POgmTbrroZE3IXXyoEkHp2xSfdI7xkWz3xH8v5EUcs3B5b qcSQ== X-Gm-Message-State: AHYfb5j+0STHg0aou3DdXvuuBGApUSDtt+UCnRDnccyQ/IoMnUpDlW9z gtFMk8pQRa5jAAdT X-Received: by 10.25.202.74 with SMTP id h10mr6858098lfj.85.1502563419759; Sat, 12 Aug 2017 11:43:39 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-277e71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.126.39]) by smtp.gmail.com with ESMTPSA id d64sm696628lfg.22.2017.08.12.11.43.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Aug 2017 11:43:38 -0700 (PDT) From: Linus Walleij To: Wim Van Sebroeck , Guenter Roeck , Jonas Jensen , Andrew Jeffery , Joel Stanley Cc: linux-arm-kernel@lists.infradead.org, linux-watchdog@vger.kernel.org, Linus Walleij Subject: [PATCH 05/11] watchdog: ftwdt010: Add restart support Date: Sat, 12 Aug 2017 20:43:12 +0200 Message-Id: <20170812184318.10144-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170812184318.10144-1-linus.walleij@linaro.org> References: <20170812184318.10144-1-linus.walleij@linaro.org> Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org This enables the Faraday FTWDT010 to restart the system, if need be. Set the restart priority for the watchdog to 128. Signed-off-by: Linus Walleij --- drivers/watchdog/ftwdt010_wdt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.13.4 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c index 680279f5c679..7fc865eea28d 100644 --- a/drivers/watchdog/ftwdt010_wdt.c +++ b/drivers/watchdog/ftwdt010_wdt.c @@ -56,6 +56,22 @@ struct ftwdt010_wdt *to_ftwdt010_wdt(struct watchdog_device *wdd) return container_of(wdd, struct ftwdt010_wdt, wdd); } +static int ftwdt010_wdt_restart(struct watchdog_device *wdd, + unsigned long action, void *data) +{ + struct ftwdt010_wdt *gwdt = to_ftwdt010_wdt(wdd); + u32 enable; + + writel(1, gwdt->base + FTWDT010_WDLOAD); + writel(WDRESTART_MAGIC, gwdt->base + FTWDT010_WDRESTART); + enable = WDCR_SYS_RST | WDCR_ENABLE; + if (gwdt->use_extclk) + enable |= WDCR_EXTCLK; + writel(enable, gwdt->base + FTWDT010_WDCR); + + return 0; +} + static int ftwdt010_wdt_start(struct watchdog_device *wdd) { struct ftwdt010_wdt *gwdt = to_ftwdt010_wdt(wdd); @@ -118,6 +134,7 @@ static const struct watchdog_ops ftwdt010_wdt_ops = { .stop = ftwdt010_wdt_stop, .ping = ftwdt010_wdt_ping, .set_timeout = ftwdt010_wdt_set_timeout, + .restart = ftwdt010_wdt_restart, .owner = THIS_MODULE, }; @@ -201,6 +218,7 @@ static int ftwdt010_wdt_probe(struct platform_device *pdev) */ gwdt->wdd.timeout = 13U; watchdog_init_timeout(&gwdt->wdd, 0, dev); + watchdog_set_restart_priority(&gwdt->wdd, 128); reg = readw(gwdt->base + FTWDT010_WDCR); if (reg & WDCR_ENABLE) {