Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp25659imm; Wed, 25 Jul 2018 21:44:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdGMBNGZkjMsK6+rxhRt0PoKXLoLCGxtNZ0pV4EOV46GQ9ZCVcX9+lHWSu93t/cCr0U6YE+ X-Received: by 2002:a62:4a41:: with SMTP id x62-v6mr495960pfa.45.1532580258045; Wed, 25 Jul 2018 21:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532580258; cv=none; d=google.com; s=arc-20160816; b=Cr8oG0/EftEuOQKpZQ60xHFDf57DxsLm5/T4H5MdP7/Ahv5ToPIpCCAMuMNIjIDjGo aHISOrgAT4bTKzagRXwXE4mCbnU8mS7BiR3/6c3/gZf/L56ZXxHW0f0UfIm+bx90pYm9 qLTLuBql/dm6ixZZQJuZnfQt05N4nLWU5aJbvWpnueLG+ppfoPWUMEHJMzuiu4NE8d+1 4JWe5hPtu50QWLU0UBwEMzDzMNdul/trK2yJT0zW6UrGgHXr31hL8Js1zCMWwoNXb05u QOClfqZqJMGEKMJdmrJg1qwB09caadJuCFYGGpI17Br1IkYYUmjfGX0nRgJ4t3+dyYmL i99w== 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=DPn+mes8dhdbGxFqa4jrzCn7MTj0YA5kPu/TqygKnCQ=; b=RK0PrkYIS8ZARyvS30Fj0l2m+3celR3FX/YNcL6W+3DYMHd+feJ0BTVb9BsjWe2sWw gN72e1h6GhnOh3ZvQ6TOxZQsxF39K+6vpwGjgtJCcsYVwVJIGTcVT38u/IxrQVizkNQk y+2VtTgg33BWQIA+eV5uoYapVhHzsQt47Jfdz5R1IoBXfo2GcMcwPud4TaVNdHjGVgI/ 25jtexC9lCW3MeU7ASD5N4hwijfTiqHSYWQ5Yc8NsaU2ERxzDV8ple53nhahCKZA9BzJ 0zq3JhBcnVC7aNQiOA592T5ttzGxzGMQCGSB9Lfvitq0EimLwndNpapPR9QQ+PCRj3xH 9h5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Vm1iYYuu; 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 d5-v6si340302pgq.316.2018.07.25.21.44.02; Wed, 25 Jul 2018 21:44:18 -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=Vm1iYYuu; 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 S1728749AbeGZF5x (ORCPT + 99 others); Thu, 26 Jul 2018 01:57:53 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:33228 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbeGZF5x (ORCPT ); Thu, 26 Jul 2018 01:57:53 -0400 Received: by mail-pl0-f67.google.com with SMTP id 6-v6so240533plb.0; Wed, 25 Jul 2018 21:42:56 -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=DPn+mes8dhdbGxFqa4jrzCn7MTj0YA5kPu/TqygKnCQ=; b=Vm1iYYuugYK23sJf9rUgvGexvBL/wysQ/gNFz+DpBzXwLxiufBWQ/8T3VQGBWXdC9Y a/cSyokSfdUpP0BwabkcJdcT51wwJ1KLtC6bGWWBt1VNB6IBCs9E3fVXSYYSwvloOVhH wTHjpbyxJeKLYN3Q06wuFfFWQTM8sNE+VKe5FYhXX8PnQ5BgisiEwF58Nq2Oxf25lr3K FxGB1NgZv4ml2PjJMB7YfpDXuaew1idOAoq1DrO/mBfBVTjZQuVGyr++L26JiIFOGdhO Cffl9vFmk9WoqJDfgK5gDuPZxY3rwIVT29k913b6P+AmBTEhT8hebZttjrj49USTDTrn Ikfw== 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=DPn+mes8dhdbGxFqa4jrzCn7MTj0YA5kPu/TqygKnCQ=; b=SJWhbhMYw/W++/xrUiJ6zslJeF0aajz47Ko/IYhWi5+EwCjecLT368MPz3ooJv4+R8 b+2N7Dhe5ucz88fucm2/PDIAJ6MrTlo1w7cDxga+ZMdBIqSndzvA+vME1Wm/TTOLI53O 3XNi6tJ7rCyf7xRAshvYpSdft+SrTSILs8t/scSNOsmYGLLrVF8/HGdKU30UnnXHlfkl ytr2Y17LXWRk3KqLks5pZaHNNhWcJCtUSrB+j9whpeVOmu5n9nDefix2UvwxkySf4DAe UENY6OxF+5/zfZOW26ZaJnUMVa1wzSFvC2MLgSN/ma2k3tnKsg6ovhh5P62ikGG1noOY +xIg== X-Gm-Message-State: AOUpUlHhb4whQTWY9KQVHJ21f6lS3UfZhoJ2jRhUGl7W9aIQ4SPmbQII Rh8dfCv1IEFWRCCtaLcK0GY= X-Received: by 2002:a17:902:b693:: with SMTP id c19-v6mr486785pls.114.1532580176572; Wed, 25 Jul 2018 21:42:56 -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 i62-v6sm411992pge.66.2018.07.25.21.42.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 21:42:55 -0700 (PDT) Subject: Re: [PATCH] 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, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com References: <1532335060-686-1-git-send-email-srinath.mannam@broadcom.com> From: Guenter Roeck Message-ID: Date: Wed, 25 Jul 2018 21:42:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1532335060-686-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/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; >