Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp532656imm; Wed, 11 Jul 2018 06:50:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWgQ313yjnc9psrdE2BBzp4Ccr8n7fPiPuDBozq7b9R3GsxLdt9bql/wOv/6xxWhJxEsi1 X-Received: by 2002:a63:1a20:: with SMTP id a32-v6mr20555774pga.446.1531317032687; Wed, 11 Jul 2018 06:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531317032; cv=none; d=google.com; s=arc-20160816; b=p3TsYxd8jaQRwpmtAriYWM8gGqgw5pYFFBdG3qvK6pFndX6qFkEfDswv71QfIOG9rm 9hiAk0hMmKAU0e7O7Oq3YMjCNU+BvaKS5gUhnAyR6pk2+wfzre5nWcx7TkZFCsySTvv1 5kfytcAi4KBZXZJoycTzqT1HoQhn29lJ+VnQgg2INFotEDV1z6FPmP/cF5lJUl7Yrocj 2t38iC+c61nocnkChspVbnm0xXWuKRYkjUfpId6Gt+vc5lYAh/5N7Y+lIWbkFeTY5ld5 81a4uFgBHximHi4q/aqrcpjceNvmMbkQ8QsRy36zzA/BT6sMJRNcZxhZn65m3g08yEWE x1ew== 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=XBF27R11Dwm68WG9DLpn0B02TtPQTGNAknacUy/Pwk4=; b=v70aLVhPI9eO84R/m+MZ4dSWbBJYuYW6ufcRWdWI496vyjSvofa+9meUz2br0jgUNo aThH58NbYZReUppqILIzn2B1wgJw5S9xEKTRIITukdF80qpn78jfMunV14FuIZiqmaan f2AoZUhwjyj2JG+H5x3YI+x1/v3f/wTW/bwmHm4uI8vDBSvg4FLcGJsYe5N+cBTQ4+/4 LCVCaHzo41yFlrx7RjYn8MFAsv+iRsdiUUmrCZItNFusskvw/D2wdm3TuDM1czf/qSRA M1/GWl3Xxfai8OmK2fvP18V+j8fUoUhQwNtVLafh1qU0yf6itSHQ+VyDmoh4a/PVeMER enZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="IOJOsC/f"; 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 m32-v6si14359240pgl.622.2018.07.11.06.50.17; Wed, 11 Jul 2018 06:50:32 -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="IOJOsC/f"; 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 S2388199AbeGKNwS (ORCPT + 99 others); Wed, 11 Jul 2018 09:52:18 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45820 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387759AbeGKNwS (ORCPT ); Wed, 11 Jul 2018 09:52:18 -0400 Received: by mail-pl0-f66.google.com with SMTP id a17-v6so3351777plm.12; Wed, 11 Jul 2018 06:47:52 -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=XBF27R11Dwm68WG9DLpn0B02TtPQTGNAknacUy/Pwk4=; b=IOJOsC/fBY/16cFhQ6eJKfAw+liEWOq1D0AhhVDfzM0UnOFY6ZLqnac1+do2IhmTLd CxIqLA9XiL7LUxD2PFiTWYBzbyK1d9kZ6JLVvFVLfvxpFfgTsM04O4OfyQONrBSVERfP CT8NshFMFv7X8tmH5FpeyARQr+bCrnaElT/IQe0sWuisHiQ+S6YnTnTSy2X+iiz1fAtU wqtmKJXquU4s8Cuh69GU8g9LIAYbbaPuyGK81Ty4QoHy104jlT5GTaxrtS/ViJ9bGjjX nXz2VFGbFNV/BEYHLMttZi67MRi7IlWcbSRP1tnYpfMv+DyqcdY4L4IxHwLDXDR33IKD HJnw== 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=XBF27R11Dwm68WG9DLpn0B02TtPQTGNAknacUy/Pwk4=; b=pGDMOkQ1Nbf8u91ZaNZBVk7v+mfiYyjlnca1CG8p+Bw1FEwDiVo9f0PG2NoqO3JW0u HK6aZxYjank2TAQn+szWWPxYajZors16Ipv1o3NUG5BrY3Gngjc+Y6S+MwfyC3yiGETP nq+liha/0r/CEW8ZNOi8suXXTKSjI884jaOCslHl4okU0k621xMInIpFVYCErbLwFaF6 m4blkpZV4ADECd0ZXW39mylxIHkTLkI7+hMYUPfL303DN50cPmWfjShOb6NLDWWmabEu /reF0GMM3mOGJLMnLyt9so8fozmxrrJZCWjUu1A1BqsnKFjzKSXy5qxJH57qO8jopWJz Xi0g== X-Gm-Message-State: APt69E1lrrHEKGRUiHW1vofJT57+NWIdcm2oVByxKL5CMaQTRiKQKCgb QE1SNFGr7V4V8YAWGMPL3O6+tQ== X-Received: by 2002:a17:902:e00a:: with SMTP id ca10-v6mr28769844plb.224.1531316871629; Wed, 11 Jul 2018 06:47:51 -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 z4-v6sm19935143pfl.11.2018.07.11.06.47.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 06:47:50 -0700 (PDT) Subject: Re: [RFC PATCH v3] watchdog: sp805: Add clock-frequency property To: Srinath Mannam Cc: wim@linux-watchdog.org, Ray Jui , Vladimir Olovyannikov , Vikram Prakash , Scott Branden , Sudeep Holla , linux-watchdog@vger.kernel.org, Linux Kernel Mailing List References: <1531212279-24953-1-git-send-email-srinath.mannam@broadcom.com> <20180710213557.GC27827@roeck-us.net> From: Guenter Roeck Message-ID: <3868f0c7-e45e-d3b4-5365-12a6a0646f6f@roeck-us.net> Date: Wed, 11 Jul 2018 06:47:49 -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: 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/11/2018 06:22 AM, Srinath Mannam wrote: > Hi Guenter, > > Thank you very much for all the help with your feedback and review > comments to complete the changes very fast. > > About the documentation.. > I have gone through few similar patches available in the kernel are > listed in the mail of previous version. > No documentation available in Linux for the properties used in those > patches also. " No documentation available _in Linux_" Emphasis mine. Yes, I noticed this as well. I was asking for a reference to documentation _outside_ Linux. Sorry for not being more specific. Guenter > For example, > 1: "src-clock-hz" property added in the part of ACPI support with the > below patch. > Patch details: commit 515da746983bc6382e380ba8b1ce9345a9550ffe > Author: Naveen Kaje > Date: Tue Oct 11 10:27:56 2016 -0600 > > i2c: qup: add ACPI support > 2: "amd,dma-freq" property added in the part of ACPI support with the > below patch > commit 82a19035d000c8b4fd7d6f61b614f63dec75d389 > Author: Lendacky, Thomas > Date: Fri Jan 16 12:47:16 2015 -0600 > > amd-xgbe: Add ACPI support > > Regards, > Srinath. > > > > > On Wed, Jul 11, 2018 at 3:05 AM, Guenter Roeck wrote: >> On Tue, Jul 10, 2018 at 02:14:39PM +0530, 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 >> >> I am ok with the patch itself. All that is missing now is a >> reference to the _DSD property documentation. Is that published >> somewhere or is it all wild-wild-west ? >> >> 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; >>> -- >>> 2.7.4 >>> > -- > 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 >