Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5432960imm; Sun, 22 Jul 2018 22:36:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcYXK5MPvH8vU3RaY0rfy2q9MQFO9NiRh9ss4SZ5zogOW4CkbDap9uR4fe0O9mVJtf9Yt7/ X-Received: by 2002:a65:5286:: with SMTP id y6-v6mr10904506pgp.65.1532324184350; Sun, 22 Jul 2018 22:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532324184; cv=none; d=google.com; s=arc-20160816; b=hyx+qWJlNw+2xtamOcgFv9WmkT9UkHgndClhp6ZwV8JXAiCzpULfBPGgcDR8M3l7PW C4tEz5DxAZLP4sqYkSXHlUzYE3KHCSyHrYQ3xtGmjAoCA4oUkuER6cpvxWgG8oJZNKia +IEgoA0M76SwsTdY8adRcubKm3U+Sa2xSTohGTjMCuxBeawpCjurySnA8jVUQp2nz2qt PcZFINOcGD4U2aOF8LV40faSWhV1kakrO0fhP0xv6Pvd0BGpVF1WiHRfE/rMTYjngJTr BDlZ8xCjfHkQz74CpOIRDNM/sqILzUAxPiZ9PO/yyEROCgTNEVrUdCpGd6vQW47SsqS9 ZtQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=XYa2hDE81Ra9Azj5g9rpZpWVy/4Py4e5jLdkj7WFCNc=; b=Kw/T9FI/EJilX38IrVcYzWWO0TS0yLidtREF/WZC9qDqeFz7lbPJ5hGQMlmSPCOtXj oJUvwxyvzLLJyhcj09LAQ0JSluAfeXC+6/o4UKwl27GZi9LpUIsmGM6EATW85GJBrRNJ G1Wz3ajF0KpWVw87H8GIyGeW6LCV3mbFo2fCDWzTU+h/gMd7lbcYr5D9IPRVfgVnoBC4 2rPmD52vgjRViM3dB6Izt3pjKeTKDj2qnojSQE5PdIzubUEv6ZL7RKUPsC9onZIoijFn A9gt1yJPSYTBRhtyT1g+/C4WNTqvN+34ewlj62L3VxKhL/fRDi/UIx1fpEDEtCjBnshH DmjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=aKCx3cFM; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c192-v6si7864753pfg.347.2018.07.22.22.36.07; Sun, 22 Jul 2018 22:36:24 -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=pass header.i=@broadcom.com header.s=google header.b=aKCx3cFM; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387771AbeGWGek (ORCPT + 99 others); Mon, 23 Jul 2018 02:34:40 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:40509 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725976AbeGWGek (ORCPT ); Mon, 23 Jul 2018 02:34:40 -0400 Received: by mail-oi0-f68.google.com with SMTP id w126-v6so31089609oie.7 for ; Sun, 22 Jul 2018 22:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XYa2hDE81Ra9Azj5g9rpZpWVy/4Py4e5jLdkj7WFCNc=; b=aKCx3cFMrgGRbdPVDM0elHc2QR5p5/yUMkReNJx31hbu+0Sfc734YMxhHZUz71Jos4 fXjnpBvGvFvHjZmZODKgnElVNG6aQ+BaVn4Pj1kvbQfwkc2dXeapQs30xVxQkP5lu5AT /MHdWX5K+3HdXxu2iU/3F6Wf11HTlr/yGaGp4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XYa2hDE81Ra9Azj5g9rpZpWVy/4Py4e5jLdkj7WFCNc=; b=ZSFbIn5tH7h6z32rqjmI9BsxL8niVD8XoHR2pHdz3yym5k63H1qnL0Xa91VnCIGD1D wPk0H8uCkpRsQ39zWldyNKotPSmg48HM3Ae9H9idCFYtHJhlGyEjtKXttS0nnbijbtmt 4QOM5h3qND00N658QQcvUbum2rKcYNuh5WcXf15VJ7ZNuJNRGtupyzpTNog8ouXYBC35 CGrEt2MWa9XgYC+r5iSFmVBAEF76LnO7vj1v9cDbT9nf5jGvnArj5qHtdr5gXwO+i7UJ QCZeTtdP59dpM+A/8jSRX6hj2CNhrtcXuzF4CiFq7JUtzpF2OR/xHjg1UD3HXorkvNrl tD5g== X-Gm-Message-State: AOUpUlHuTj5HFOzbAomRSWK7ofReRzW9upyO+V2yAY9qs27WLddZskNK 0rUNft5mnMDjhwl/Dxwr8AYeArrxmRq9UVuBKePkXg== X-Received: by 2002:aca:d986:: with SMTP id q128-v6mr6841399oig.349.1532324113364; Sun, 22 Jul 2018 22:35:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:6043:0:0:0:0:0 with HTTP; Sun, 22 Jul 2018 22:35:12 -0700 (PDT) In-Reply-To: References: <1531212279-24953-1-git-send-email-srinath.mannam@broadcom.com> From: Srinath Mannam Date: Mon, 23 Jul 2018 11:05:12 +0530 Message-ID: Subject: Re: [RFC PATCH v3] watchdog: sp805: Add clock-frequency property To: Guenter Roeck Cc: wim@linux-watchdog.org, Ray Jui , Vladimir Olovyannikov , Vikram Prakash , Scott Branden , Sudeep Holla , linux-watchdog@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guenter, I will send the updated patch.. Thank you. Regards, Srinath. On Sat, Jul 21, 2018 at 8:08 PM, Guenter Roeck wrote: > 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; >> >