Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3986695imm; Sat, 21 Jul 2018 07:39:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcizquw1GrWXoX9aaGQsJKuhx8CPAIcRkPCzDrY33B3xXZtRm2eeGGPvblnB3SIWBMGg70g X-Received: by 2002:a62:ca0d:: with SMTP id n13-v6mr6220600pfg.69.1532183960749; Sat, 21 Jul 2018 07:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532183960; cv=none; d=google.com; s=arc-20160816; b=JgYNzJmfdf4DR6DMelIP/XZQ0ED8jsiO6gcnpu8/l6oDaBcWH/37ZpE9rlAgx7uexT IJ3yyUhgtBxrvKCXRjOv8qSEp+/260KN58WHZdj4KEZMGreKbT6tLzzNJ7Tf0nMGaE+t D9QDWRnxGLckL1dT5yWhUtdhVRoPfWa5z6ACb8Xetl6AwIn8RbKcMhLxR5AiBZpAsV/D 4QrJSM7asDZSwoN4GgU9nnyuVQxCUaw1x3wTUY/J3sP0kRY7WsVAAurNBMK469TKYwin NjoFF2Q+kDUVL6sXTxdbeFvp2UJcTuzzigHaUJBrI/IrSvpWXLxxQ2j6NnFUxFsRZJiV 7abw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=1G8wvxE5WaH2HmUeK6gSneIJTTPuFfg+m0WFqDpnAvw=; b=ZhySPfmOTRzmFgvm1tL6+pK102h4Qw57UFol35SF2rs+E5guhg1pYBxpHEU2VjY9g8 AzPQ7KO52J7eI6CoHtCmG1MBPLozNmuvaITaQs3Dl6KLJXgmoZpqkDixdB0d8mtTgK09 1ubq94onsNY46MmZnhlO5qNKC2ejbhBRX7N7eMzXR0HbeXh3b66V9zO4g0OnDWx9ifvf X7dgt/qYiRrzuPQ80SvIUoAcFfreNX6ynSCjtlmP0Jh+O8zjwOhQNOQ3uuHXnCWhdU+R eoNzyrbaY/n3aLdF5sm5azvFF/w6AS0npyCOfeLFh12208bpo7fDjEMv/MA3HK5kZojw 0U/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O9LNjedB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18-v6si3866733plq.104.2018.07.21.07.39.06; Sat, 21 Jul 2018 07:39:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O9LNjedB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728062AbeGUPbN (ORCPT + 99 others); Sat, 21 Jul 2018 11:31:13 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34161 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727876AbeGUPbN (ORCPT ); Sat, 21 Jul 2018 11:31:13 -0400 Received: by mail-pg1-f194.google.com with SMTP id y5-v6so9147097pgv.1; Sat, 21 Jul 2018 07:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1G8wvxE5WaH2HmUeK6gSneIJTTPuFfg+m0WFqDpnAvw=; b=O9LNjedB7hU4yJt6UOMGUzW9KNXfvsgzitOZ01GCD4mxXzwOtSUs/HywjgK2LZwKu5 UFQIsK3d31vebRIuE1NibWNu0SIsVl6wFn6S82DuJsAlZ29W3MUCBQSA0d9APCQjNhe2 i9zyZNiPdaA1iLJVwBUvqSLC9uhbYWWl5SnWOZBnkgMkXuoyuUK2bAvP7UVpVOUCHWip 82paoYM2lHhjrdSGYmWD45tF6WILHLyOFQY63EmKRGTLDzwgCeEy+blrWE17jtYcWKpq nugJWAJY5bAJn4xa226wvmRhcDRYuo6GI/zrGOuIrgW4JIGstBY39tpL+FX2MsHtgvgE o+uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1G8wvxE5WaH2HmUeK6gSneIJTTPuFfg+m0WFqDpnAvw=; b=AbYaPSu/uzJ8rI8cBeGr/MaMKYk6Aeb42mQs/QYEExRcZC0rt5+SFPa/TqqQYN6QZo u0M7M6ZDOg/h1/EeoOkX53Bh5seHFFRd19gOcRpdxpmSLFV40WZTOfPRZq4g/Bj7Wdju NO06mwyh93+FkWZQZLwTqkM7l4ZYYF5mXRbvCTTCBN6hhYyOFT2WJ+uIUJTdkACKVojA ODs8No8owzzkPFBDkcN9ijwis1FUoRhpTdcKGkGPvRsJgWbqCzjDrjxmnjmJXQeDh+O2 Ba1fa7VFpcATGO2q8QWdDAWPM8CV4hfAPPebDMkvI8AjAl25ygBC6mPlifLKK/s2gkrY NR9g== X-Gm-Message-State: AOUpUlErmv1viNWxFj3i8ZziY9IquFy8aOMCQnwIyJSdvFwjW5I16H0y GvpNvTfssJoxmQiJMUrrxNXUU+HF X-Received: by 2002:a62:6eca:: with SMTP id j193-v6mr6337534pfc.256.1532183894441; Sat, 21 Jul 2018 07:38:14 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id z90-v6sm8796102pfk.85.2018.07.21.07.38.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 07:38:13 -0700 (PDT) Subject: Re: [RFC PATCH v3] watchdog: sp805: Add clock-frequency property To: Srinath Mannam , wim@linux-watchdog.org Cc: ray.jui@broadcom.com, vladimir.olovyannikov@broadcom.com, vikram.prakash@broadcom.com, scott.branden@broadcom.com, sudeep.holla@arm.com, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org References: <1531212279-24953-1-git-send-email-srinath.mannam@broadcom.com> From: Guenter Roeck Message-ID: Date: Sat, 21 Jul 2018 07:38:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1531212279-24953-1-git-send-email-srinath.mannam@broadcom.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/10/2018 01:44 AM, Srinath Mannam wrote: > When using ACPI node, binding clock devices are > not available as device tree, So clock-frequency > property given in _DSD object of ACPI device is > used to calculate Watchdog rate. > > Signed-off-by: Srinath Mannam Please resend as non-RFC and add a note in the description indicating that there is no formal review process for _DSD properties. Thanks, Guenter > --- > drivers/watchdog/sp805_wdt.c | 35 +++++++++++++++++++++++++---------- > 1 file changed, 25 insertions(+), 10 deletions(-) > > diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c > index 9849db0..a896b1c 100644 > --- a/drivers/watchdog/sp805_wdt.c > +++ b/drivers/watchdog/sp805_wdt.c > @@ -11,6 +11,7 @@ > * warranty of any kind, whether express or implied. > */ > > +#include > #include > #include > #include > @@ -22,6 +23,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -65,6 +67,7 @@ struct sp805_wdt { > spinlock_t lock; > void __iomem *base; > struct clk *clk; > + u64 rate; > struct amba_device *adev; > unsigned int load_val; > }; > @@ -80,7 +83,7 @@ static int wdt_setload(struct watchdog_device *wdd, unsigned int timeout) > struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); > u64 load, rate; > > - rate = clk_get_rate(wdt->clk); > + rate = wdt->rate; > > /* > * sp805 runs counter with given value twice, after the end of first > @@ -106,9 +109,7 @@ static int wdt_setload(struct watchdog_device *wdd, unsigned int timeout) > static unsigned int wdt_timeleft(struct watchdog_device *wdd) > { > struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); > - u64 load, rate; > - > - rate = clk_get_rate(wdt->clk); > + u64 load; > > spin_lock(&wdt->lock); > load = readl_relaxed(wdt->base + WDTVALUE); > @@ -118,7 +119,7 @@ static unsigned int wdt_timeleft(struct watchdog_device *wdd) > load += wdt->load_val + 1; > spin_unlock(&wdt->lock); > > - return div_u64(load, rate); > + return div_u64(load, wdt->rate); > } > > static int > @@ -228,11 +229,25 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) > if (IS_ERR(wdt->base)) > return PTR_ERR(wdt->base); > > - wdt->clk = devm_clk_get(&adev->dev, NULL); > - if (IS_ERR(wdt->clk)) { > - dev_warn(&adev->dev, "Clock not found\n"); > - ret = PTR_ERR(wdt->clk); > - goto err; > + if (adev->dev.of_node) { > + wdt->clk = devm_clk_get(&adev->dev, NULL); > + if (IS_ERR(wdt->clk)) { > + dev_err(&adev->dev, "Clock not found\n"); > + return PTR_ERR(wdt->clk); > + } > + wdt->rate = clk_get_rate(wdt->clk); > + } else if (has_acpi_companion(&adev->dev)) { > + /* > + * When Driver probe with ACPI device, clock devices > + * are not available, so watchdog rate get from > + * clock-frequency property given in _DSD object. > + */ > + device_property_read_u64(&adev->dev, "clock-frequency", > + &wdt->rate); > + if (!wdt->rate) { > + dev_err(&adev->dev, "no clock-frequency property\n"); > + return -ENODEV; > + } > } > > wdt->adev = adev; >