Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp60157imm; Wed, 25 Jul 2018 22:36:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcEX3QJjsJ9vlpino+Nve3wmxvo89xa+bAFBsjg/GSiDfOLFtP4Kje04ZBxAotTjxBVORCa X-Received: by 2002:a62:8a4f:: with SMTP id y76-v6mr600412pfd.233.1532583395076; Wed, 25 Jul 2018 22:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532583395; cv=none; d=google.com; s=arc-20160816; b=Lix39H88kBn9aIwHaDETuAQOq6eIzsD04kUJTgRqXjA/4XT7/7sKkpS8GBEbOS8FuM zxsFLHplZ6FriiIptA03/aVU2hc/YaX/pOAhX87G9wpT8WQCXgzSv/bv3dcjZFvY58A7 6NcEnA9+VAjbPvVd0GPnH/I6GN99d80Jwgio6vCbplUS14qYb7QL+D5fMaURl+zlBi2I QItXVgyDeA4YUe0BXyrdskhV6DcLAG30wXSTlxJn2qxAC7+eEweUG8mPdmyJ+QNznxlC QBdndxGzpMWRnDz5uEyb7753gPovH90Gr3uDcdTO0p+z/pQRL64Y7ZTb8o20EJ8esk7C 98iA== 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=LXfnoQT26Efb8iF/xj1e9YrRlriJTfUgbu6cPpOBv9Q=; b=io7ZO6tTQGMAtPjOk0aqYwKdPHxAiupvFScHdWrkeZ534wb5tBxQ3urDF2iXtFs5bN TorUdhThWZlicb/diGhsa0/jcUrWaU8nN50SQNZkcafzcjGg5McllKSuvfhglOYfp0IW ur9Vk43cfdxQ97U4opdrnJ5eT0rxpM9LoOVHGGZtGY0X/gAbQ5EH0GW4nDoC7xcdZcjw rksap84hlX/+yUAGkK5fRjVCLBOpYMkYDaq8KAzctVaAyfy4bKMw43rjvQ88+Pon53eg DNMmuTC9oo1xi9Hus8UDFCDsFqTNZ717SI+TJqjwUTRSt5YhmG7aGDTKU4ZBWifCUlG2 rZAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=EdvIcStm; 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 bh7-v6si429611plb.367.2018.07.25.22.36.20; Wed, 25 Jul 2018 22:36:35 -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=EdvIcStm; 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 S1729056AbeGZGuH (ORCPT + 99 others); Thu, 26 Jul 2018 02:50:07 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:35743 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbeGZGuH (ORCPT ); Thu, 26 Jul 2018 02:50:07 -0400 Received: by mail-oi0-f67.google.com with SMTP id i12-v6so857221oik.2 for ; Wed, 25 Jul 2018 22:35:00 -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=LXfnoQT26Efb8iF/xj1e9YrRlriJTfUgbu6cPpOBv9Q=; b=EdvIcStm3zWPBFMwG9IynKVcDNXOnM5Ibr9KwqurjCj97DhwJVQufb610pumMvB7YT YGi2GgShFtlfWi4iAo4j96gDga4UJUjet7KrUtVeTvWe+XLa/zuQl2YTZid/6cH9MQBc 2ntBSqvRYmkI3USZ8Xr06/glA7wccsDwqZnMo= 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=LXfnoQT26Efb8iF/xj1e9YrRlriJTfUgbu6cPpOBv9Q=; b=thP24+RQctMF2i5gs7MFLwuCaLrQt8hbOo07djP3BGgGewrZp5reBSlLY5lWYgAqgn 5/03PROh+OishoKIa757MbEATjAwndH4A/28Y9jWTBm9Yfse81GV2qUl+/rkIW/av4OK Z8eH+p0nZo/v62M1WIyphCLFiBjv2ywyj53eK2KvfF9tknhULJ9CKh+8v2kQ9uthorbg lclVe7zR8PcIyk5wFHtJdQZy8lVggLWE8kmJKbLZsqpLz5rEsjoYFdU7US8K9s4bT2pZ uHkxMre/txPJX0rz59n/czHIIVJAaFg+apRBNsUn8aYPCk8BW8WtFLufxtg+i763OXr+ RPaw== X-Gm-Message-State: AOUpUlGs8NnqoV8i3WS6dZcWyL57y0mPGKRywZ+MgF/dPpbmoWblK8x8 /DglJGbGa2BNcUqH/Nv52N96cnShXYDgn6Rpjwwq4Q== X-Received: by 2002:aca:37c2:: with SMTP id e185-v6mr508311oia.326.1532583299645; Wed, 25 Jul 2018 22:34:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:6043:0:0:0:0:0 with HTTP; Wed, 25 Jul 2018 22:34:58 -0700 (PDT) In-Reply-To: References: <1532335060-686-1-git-send-email-srinath.mannam@broadcom.com> From: Srinath Mannam Date: Thu, 26 Jul 2018 11:04:58 +0530 Message-ID: Subject: Re: [PATCH] watchdog: sp805: Add clock-frequency property To: Guenter Roeck Cc: wim@linux-watchdog.org, Ray Jui , Vladimir Olovyannikov , Vikram Prakash , Scott Branden , linux-watchdog@vger.kernel.org, Linux Kernel Mailing List , BCM Kernel Feedback 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, Thank you.. I sent next version patch with modification. Regards, Srinath. On Thu, Jul 26, 2018 at 10:39 AM, Guenter Roeck wrote: > On 07/25/2018 09:47 PM, Srinath Mannam wrote: >> >> Hi Guenter, >> >> It was my mistake sorry for that. I thought to add as Rivewed-by your >> name.. >> Many changes are made based on your review comments and suggestions. >> So, Can I add your name in Reviewed list? > > > You did that already below, and I am ok with that. > > Guenter > >> I will modify and send next patchset. >> >> thank you. >> >> Regards, >> Srinath. >> >> On Thu, Jul 26, 2018 at 10:12 AM, Guenter Roeck >> wrote: >>> >>> On 07/23/2018 01:37 AM, Srinath Mannam wrote: >>>> >>>> >>>> Use clock-frequency property given in _DSD object >>>> of ACPI device to calculate Watchdog rate as binding >>>> clock devices are not available as device tree. >>>> >>>> Note: There is no formal review process for _DSD >>>> properties >>>> >>>> Signed-off-by: Srinath Mannam >>>> Signed-off-by: Guenter Roeck >>> >>> >>> >>> I just noticed this. This is completely inappropriate. It is >>> the equivalent of forging a signature on a check. >>> >>> _Never_ add a Signed-off-by: statement for anyone but yourself. >>> >>> Guenter >>> >>>> Reviewed-by: Guenter Roeck >>>> Reviewed-by: Ray Jui >>>> Reviewed-by: Scott Branden >>>> --- >>>> 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; >>>> >>> >> >