From patchwork Fri Apr 26 14:33:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 16439 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f197.google.com (mail-ye0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D09812397A for ; Fri, 26 Apr 2013 14:35:41 +0000 (UTC) Received: by mail-ye0-f197.google.com with SMTP id q9sf6216578yen.0 for ; Fri, 26 Apr 2013 07:34:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:date:message-id:x-mailer:mime-version :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=OOqlgjRkMOuFJfqMjxjFh26tcABGJsmzY7kktO8uwok=; b=km4t7bOa9WxndBrTDsAr2HEK+1KQ8TZrfaRh7HMXg84Y0R/G0AZzlhp10tmduhCeKp HElZY9+R3chJyYHBCjic62G3YAywMusgCU/d93w5bcVHdGrskqu6Uexsoaw96HtIVcau 2H0ROf5Q+2iGL0bH0mNwpuO90KU3xo9CXsUPF8VjPoaLu//8QZtUhrXfnIuCEt1eP61/ qKE5Rlydjp788opkmhkaTvO0adFjVNAzncySnlwoePscgAEu1Fh7Oi57+KO9LdAdaBuo HEOdrkGplSsKpdK6VJqOQ0zRRhCs0WCWD4FJZpI0DamwTXmIhaeiuEUpja5AbWyPiGT8 31jA== X-Received: by 10.236.170.7 with SMTP id o7mr21690776yhl.1.1366986885931; Fri, 26 Apr 2013 07:34:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.58.234 with SMTP id u10ls1847943qeq.22.gmail; Fri, 26 Apr 2013 07:34:45 -0700 (PDT) X-Received: by 10.58.56.161 with SMTP id b1mr29375961veq.42.1366986885713; Fri, 26 Apr 2013 07:34:45 -0700 (PDT) Received: from mail-vb0-x22b.google.com (mail-vb0-x22b.google.com [2607:f8b0:400c:c02::22b]) by mx.google.com with ESMTPS id sa4si5458496vdc.49.2013.04.26.07.34.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 07:34:45 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22b is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22b; Received: by mail-vb0-f43.google.com with SMTP id q13so2648914vbe.2 for ; Fri, 26 Apr 2013 07:34:45 -0700 (PDT) X-Received: by 10.220.39.69 with SMTP id f5mr29515807vce.45.1366986885238; Fri, 26 Apr 2013 07:34:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp71911veb; Fri, 26 Apr 2013 07:34:44 -0700 (PDT) X-Received: by 10.15.52.70 with SMTP id o46mr43759187eew.14.1366986884058; Fri, 26 Apr 2013 07:34:44 -0700 (PDT) Received: from eu1sys200aog112.obsmtp.com (eu1sys200aog112.obsmtp.com [207.126.144.133]) by mx.google.com with SMTP id i41si2869509eev.224.2013.04.26.07.34.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Apr 2013 07:34:44 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.133; Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKUXqQbk4phj1nS50IVhrUwwDckQOS62/D@postini.com; Fri, 26 Apr 2013 14:34:43 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 547091DA; Fri, 26 Apr 2013 14:34:01 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3D29A4F9F; Fri, 26 Apr 2013 14:33:55 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id D1159A8081; Fri, 26 Apr 2013 16:33:54 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 26 Apr 2013 16:34:00 +0200 From: Linus Walleij To: , Guenter Roeck , Wim Van Sebroeck Cc: , Arnd Bergmann , Linus Walleij Subject: [PATCH 09/23 v2] watchdog: coh901327: devicetree support Date: Fri, 26 Apr 2013 16:33:53 +0200 Message-ID: <1366986833-7158-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmLucGafH6PSHHy3B/O8uLcBmJbBHO5beMUw+nbC88Q3qTRep37RrpHBejvA4QZ/cgpmdWC X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22b is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Linus Walleij This adds support for probing the COH 901 327 watchdog from the device tree and also adds associated bindings. Cc: Wim Van Sebroeck Signed-off-by: Linus Walleij --- ChangeLog v1->v2: augment driver to call watchdog_init_timeout() so we can also set the timeout from the device tree, as per suggestion from Guenter Roeck. Hi Wim, I'm seeking an ACK on this patch to take it into ARM SoC along with the patches making use of this new binding. --- .../bindings/watchdog/stericsson-coh901327.txt | 19 +++++++++++++++++++ drivers/watchdog/coh901327_wdt.c | 12 +++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt diff --git a/Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt b/Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt new file mode 100644 index 0000000..8ffb88e --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt @@ -0,0 +1,19 @@ +ST-Ericsson COH 901 327 Watchdog timer + +Required properties: +- compatible: must be "stericsson,coh901327". +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: the interrupt used for the watchdog timeout warning. + +Optional properties: +- timeout-sec: contains the watchdog timeout in seconds. + +Example: + +watchdog: watchdog@c0012000 { + compatible = "stericsson,coh901327"; + reg = <0xc0012000 0x1000>; + interrupts = <3>; + timeout-sec = <60>; +}; diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index b9b8a8b..4bd070f 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c @@ -354,9 +354,9 @@ static int __init coh901327_probe(struct platform_device *pdev) clk_disable(clk); - if (margin < 1 || margin > 327) - margin = 60; - coh901327_wdt.timeout = margin; + ret = watchdog_init_timeout(&coh901327_wdt, margin, &pdev->dev); + if (ret < 0) + coh901327_wdt.timeout = 60; ret = watchdog_register_device(&coh901327_wdt); if (ret == 0) @@ -441,10 +441,16 @@ void coh901327_watchdog_reset(void) /* Return and await doom */ } +static const struct of_device_id coh901327_dt_match[] = { + { .compatible = "stericsson,coh901327" }, + {}, +}; + static struct platform_driver coh901327_driver = { .driver = { .owner = THIS_MODULE, .name = "coh901327_wdog", + .of_match_table = coh901327_dt_match, }, .remove = __exit_p(coh901327_remove), .suspend = coh901327_suspend,