From patchwork Mon Oct 16 20:54:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 115992 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4110511qgn; Mon, 16 Oct 2017 13:56:58 -0700 (PDT) X-Received: by 10.99.4.133 with SMTP id 127mr8950688pge.72.1508187418728; Mon, 16 Oct 2017 13:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508187418; cv=none; d=google.com; s=arc-20160816; b=kWsTPIKL+gv7YVChDCkZJKF/1W4I5pCQUTP4ermEozgps/XPiIeXSJGZ/djTW40zrh zcdkSVb3BQi4ssZglC75sFnjUw63fknT10B9JhXSQbfSCBiBIWi/drfNwzY9UDb5mK/V 7pUJ+u8GvcdgoXlOAf9X+54ox+LyBVoWAAme0PqdbXoTdxIcqdn7tEdTh5c6G+2Usedn ujnb7KNLf5WDx4JVJ3OaHBOZhyAz7N4Bjv4GZ0iJ020bWQj/Uf1xyFWjAjzaUcZWqTD5 faMjMqM85j+tiOF2z0/TA29qr3xQxEZUxdCSCNwMI2ptj6M34lT+TA1zYkM01jxk4fO0 U6Tw== 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=ru7YUIKmLtuQLQJnkPx3BLoL8uVNm6RZlzrnrd/M+TU=; b=wGlq9t8WSX3anMaoFPshFyKEAcwBn0Vbb96Y8CibSRn5frs+VCaQ8M16KoqBoG78uS GYaAPY/6/wxt6t1W0DfvuJARxDrMqFcDg4cSbvqPEFGpsqjzPirk6l/7x3oCIgRbU4ii I6VLf4/X7kBiQdJTU0ErbmYIzXpEWFPG5N8dsmvgkKrf4SqYqqWdvTdemqxkvwtvgE49 Xqg1YcREK3tKoW1q9HPt6oriZb3n8z4dtVugR8Pv/6kl1rrn81t/iHNGa5LQA2UMcSzy Cfj0AGmlIA/ktCZoH8+5kR0x+rN20D7i21DnvDf9mW7g6bKROz8Bw8Uegd2/ITSlIiHO wBrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UZSXIneS; 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 m6si533400pff.595.2017.10.16.13.56.58 for ; Mon, 16 Oct 2017 13:56:58 -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=UZSXIneS; 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 S1755144AbdJPU46 (ORCPT ); Mon, 16 Oct 2017 16:56:58 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:43816 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754256AbdJPU45 (ORCPT ); Mon, 16 Oct 2017 16:56:57 -0400 Received: by mail-lf0-f51.google.com with SMTP id a16so18494392lfk.0 for ; Mon, 16 Oct 2017 13:56:57 -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=Wg/OI1Wni53JoqMtXH7/Y38F2v6dFRpG8nX/7YUIhxM=; b=UZSXIneSHYq9OUtArQPNn0HMC8PjhZQM63SgIBspXyoqJgayI2DrPzviWkYSojxXJX Nw/M/gcxWQ/dOerRgu5DjN6SkBxI0wqYAaq4lrOjWCodCrFUIn4UhJnELM2TllKrn06W xEfTdwugt/zKjtgns4D43xqdw/bLQFZYKQmMM= 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=Wg/OI1Wni53JoqMtXH7/Y38F2v6dFRpG8nX/7YUIhxM=; b=gGYbPwUEOYG/tyF7MfIFQtIrjhbwbjCevko/AnRTbUIzLZ3XcwF/i133ThFKiGHd7a 3pu7dPaHb01KJWDCjU/PI6SdTNo3FXv3RGYM59a/4JkIiOSDrPi5E4i7bLLvXOgV2fM+ WWfNYWpdpIIvkZWntSKT0Ccyes2h3Z0YPfovAb6v/zlBseFfRQ4TjIXcCENx4kXLCK8I 6Rme5q3uDs+bqnKhdIRJGwIRSdvSe4PL8pmHvBDEA4XC4igq8zWcjpigJao8+rb3gs+c PZXbmM2Ls56axiViVy+BEzk7SV1XD4RPgI0N0oHVEFOF/+dcND9+YDc27Trl4AuoINig 33VQ== X-Gm-Message-State: AMCzsaXt0/R76f5tTC36CQ7byca7Zol0Af/43FgALsZKlrlRfX/5O5dp E6DLlmHUt5a47xr79UH0K6v/Cw== X-Google-Smtp-Source: ABhQp+RRm7a/gEVARdqyUuD5Bgvr92fv3AU0xB4AxCvferDgmRcpc3B7uELovEMJaofOsL/+rZUDMw== X-Received: by 10.25.151.206 with SMTP id z197mr3308214lfd.3.1508187416546; Mon, 16 Oct 2017 13:56:56 -0700 (PDT) Received: from localhost.localdomain (c-5f7c71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.124.95]) by smtp.gmail.com with ESMTPSA id s88sm2131227lje.40.2017.10.16.13.56.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2017 13:56:55 -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 5/5 v2] watchdog: ftwdt010: Add restart support Date: Mon, 16 Oct 2017 22:54:27 +0200 Message-Id: <20171016205427.4297-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171016205427.4297-1-linus.walleij@linaro.org> References: <20171016205427.4297-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 --- ChangeLog v1->v2: - Rebased, no changes. --- drivers/watchdog/ftwdt010_wdt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.13.6 -- 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 Reviewed-by: Guenter Roeck diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c index 21c3ac7f557a..0be7c2db642d 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, }; @@ -190,6 +207,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) {