Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp42715imm; Wed, 25 Jul 2018 22:10:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfsDDxNkhT6+3lTtUiQI0HcKwYC1wG04UBHJVY9a1KQ6G2HVtKRj+ETJDY+qowbywZiyl+s X-Received: by 2002:a17:902:7587:: with SMTP id j7-v6mr528273pll.256.1532581814222; Wed, 25 Jul 2018 22:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532581814; cv=none; d=google.com; s=arc-20160816; b=xoI0TCIlrd6kxhfAu7uNcU/08eg82YL/JX0cfowKLQ6VNRgYhP+ky6l2agci7DjX7b 09WpalQWY8GJZjcTr3z7bckRDHBARAcScdyKTtMSr/fCBE6iunUNgSqNDhf5PRuD9zyt C7onPSLHEvYZeSxmR7mbTQNirsZZ0nYFynD/YhtSTAtGsQZsnEoNFmfChcUN8mA6hGnw EDMnOuNSIUlf73VmSxnZp/X/mq8dJIEbCRAF0ozg4EWEiyDNE8C6kZdobKvwmgYP2nQI DkvFY9zMW2FO7dWrdvokjlvniaNXBE7buBIfJ6Xc2R7kTMJo4GvxUFeTTxNg7TymTyes yyBA== 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=+jFslDIlB1tbHPpDDYjSykHVUPEmC4O+2ITeytPUf7w=; b=WH0xURc5VLQGtxJdvhpkLTTO7Eh79/9E9pWVhBz6+TFFW5kl9Qr3JKELBpWUy7uphV qU7U/dPqIOII3mBo0AeO8/vpffpwNtpoqU8YiQViVbC2ieuwCavecTw23Ha3IjOfObuO XHKupAiSETU4Eu9am5uBH7lSFfXMq6h3dlf52fsj3FK3qjYY+W7MYaGwpZxIFdQGLYio YGJuoftP50jcw0BeDigFZv57DvwBefq4B7kOy7bHqpUKxQ9fuzA6Q83wfM/Rn7Pu2Dt8 4HURkGwaOgiRG8UU1BZ3BShJlMC9f0hCvMiOvkOHCFaxEitYdQ4ubTLYMatOfuvuKYKF o0Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=klg6vhIp; 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 e14-v6si419870pfi.184.2018.07.25.22.09.59; Wed, 25 Jul 2018 22:10:14 -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=klg6vhIp; 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 S1728805AbeGZGYJ (ORCPT + 99 others); Thu, 26 Jul 2018 02:24:09 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33236 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbeGZGYJ (ORCPT ); Thu, 26 Jul 2018 02:24:09 -0400 Received: by mail-pf1-f194.google.com with SMTP id b17-v6so182860pfi.0; Wed, 25 Jul 2018 22:09:07 -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=+jFslDIlB1tbHPpDDYjSykHVUPEmC4O+2ITeytPUf7w=; b=klg6vhIpiWuUJKRWXQBHI4xFAZU2jraLaH0uQyfQv8Njpx8b+UYFvyjPjSut8XTD4f +z5J9+/7c5X9qSWZu8r0K/CBJxKkUHJMX4tGEv6YLnnerR6hxoCnhPOUEndvL17ciJz5 MN+AdWPksuDZJLiKgu6/4/BAdUYhW56UVSPol84oO8tqH+yTD6rtQoalgZfWiZSMHIVe SDMJ+wqnHuYwMu1Nt2oNJhVmS1EdKxaIEoyun+EAJFPjPY5+kxHOfMBheN3uM+HhdM1I Nh7V9iAHnrRlnNxTOgwmr47HSDmuxm5xy0kPrWihk/kjDCWYqm/6nYW/EFPKgsx4Qh/D 5tFA== 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=+jFslDIlB1tbHPpDDYjSykHVUPEmC4O+2ITeytPUf7w=; b=Mh47xxA/ySqTZOBzVCCmumNcwTTgEkEFZ+Ke32Mw1LGy6+hSRG9/s7jVbSwKMS0ZCr yHw+TEknvZ7zP7gJ5/OIX3lympbNjhsmnSItnllLSwemVNiKaCUKfMovBTMC5PqQPixn bvc+xqHyCslCsXTdGU9m1a7THpDKHzfiZ5qe28UYSCv11TfX4mHD+Iph6qQixCiSZUTO iUGpUk7XbOB30C130vt4c8ydGEFbktc3rYCL2CnkbqtkMRYYMUOHWt6i1oILp+NCmuZS NVqFdo4JQefgVqsFaN3Hbeh+GvynEOZtFeZFcF7x/gsjJ2dXdzOpAvRd294SyfBorxqr yagw== X-Gm-Message-State: AOUpUlG+EaNCmvGqbQMgPewH2BWmidq0v6iHEK9TVTQa8p7F4FSN3S4x 2XCRbwN3UMCGQ3eZt2gvovM= X-Received: by 2002:a62:1c16:: with SMTP id c22-v6mr580327pfc.148.1532581747141; Wed, 25 Jul 2018 22:09:07 -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 h10-v6sm748867pfj.78.2018.07.25.22.09.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 22:09:06 -0700 (PDT) Subject: Re: [PATCH] watchdog: sp805: Add clock-frequency property To: Srinath Mannam 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 References: <1532335060-686-1-git-send-email-srinath.mannam@broadcom.com> From: Guenter Roeck Message-ID: Date: Wed, 25 Jul 2018 22:09:04 -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: 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/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; >>> >> >