Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9089525pxu; Mon, 28 Dec 2020 06:22:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwi4LHjbDTxequh4dXw6NP2Vun4jv5N+fXzWZen0IlD9HEBzZTu/lw5V2OqIE1OWQMjfnIP X-Received: by 2002:a17:906:77ce:: with SMTP id m14mr43478390ejn.10.1609165366705; Mon, 28 Dec 2020 06:22:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165366; cv=none; d=google.com; s=arc-20160816; b=s1ttMW736o5d2uahoqk905TWap7Vv/w29OKICwSNrvWKHA1/gSaRS2wQoJTzb7SM0o cbPkoTVWnm7FTZ/sZb+O5GWhY3+7wCItr0WFst4xJKcH/DEfk0JHYuW0PUpqsrzBt0uJ bb16Y9uz1cBOyHFQkoJPwNJTKIzNSyk93uafBPA69JbQD73dXxtLngWnun4/sh7R9Jll lNZxYBHCqrtI5bJ28KYLFTrnoRiGXkbLOb01zL3ByrEK84616B6Mld6xxx6MRf4pQAHK J71xJtMlHdlJgLkPnsTkgWNL9eADHX9B4K/DnQI1JkTZEyQVv8IwbkFyQDBdk0pZ2nFE U1qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=im28xF6UzuwNKN8ik4ZtMKH2mEyBD44gxZJ+I21+IpE=; b=Q+Kjhq4OLb20J0PiSALgcd5JXFcRpuBOSJdn5TTWBaznlwCmKZfPcfiTnISRh4UP58 Yi6NlXue6NZ/nJpkYoBPkf8ib1i59DsMurbQiUCkESSckpUbtpvN3hAsZwuBLnLBePMM u51cmsFTKbsJHeh/WrefNR3vUbyvqZJHwbsEU4kVaRZ3BJRUH02g9P4medRzOhzrB2Kn dbBu05+QP/iuG3vIW4BELQseP+buoY++74UW3JKzUCcxVyJHcQ8zhhFwMC0LE/0kDILO XYPwnO7G3GIYdWdM9gJx6CcUFwpkv7b/7cNOLzUYX4h4s9AReDyszOLXYb5WxHI1RmNE WY3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WAk4aR1L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si20269547edx.585.2020.12.28.06.22.22; Mon, 28 Dec 2020 06:22:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WAk4aR1L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502136AbgL1OTl (ORCPT + 99 others); Mon, 28 Dec 2020 09:19:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:53122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502110AbgL1OTg (ORCPT ); Mon, 28 Dec 2020 09:19:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBBA5207B2; Mon, 28 Dec 2020 14:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165155; bh=TQSSlT2EQRSgXCmBGXqu5Wg5Cl/1A1x7DS0kj6eoQgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WAk4aR1LPtoVgIFhqVltKLzJKqCFILHzwojQqVt7rMYvqH03vhmRWVRT3XBGmN6Fh VdwtRLBbtimdR9y41JAIl+Gn/EOL0ttWlpKhNQUCUGq3snZmiLEJ5BQhvBotwlkYqe 3fSXZBeSPhSMPH3osbL60ErpcGb44k5ZuTVuoPVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lingling Xu , Chunyan Zhang , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.10 431/717] watchdog: sprd: check busy bit before new loading rather than after that Date: Mon, 28 Dec 2020 13:47:09 +0100 Message-Id: <20201228125041.617496340@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lingling Xu [ Upstream commit 3e07d240939803bed9feb2a353d94686a411a7ca ] As the specification described, users must check busy bit before start a new loading operation to make sure that the previous loading is done and the device is ready to accept a new one. [ chunyan: Massaged changelog ] Fixes: 477603467009 ("watchdog: Add Spreadtrum watchdog driver") Signed-off-by: Lingling Xu Signed-off-by: Chunyan Zhang Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20201029023933.24548-3-zhang.lyra@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/sprd_wdt.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c index f3c90b4afead1..b9b1daa9e2a4c 100644 --- a/drivers/watchdog/sprd_wdt.c +++ b/drivers/watchdog/sprd_wdt.c @@ -108,18 +108,6 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout, u32 tmr_step = timeout * SPRD_WDT_CNT_STEP; u32 prtmr_step = pretimeout * SPRD_WDT_CNT_STEP; - sprd_wdt_unlock(wdt->base); - writel_relaxed((tmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & - SPRD_WDT_LOW_VALUE_MASK, wdt->base + SPRD_WDT_LOAD_HIGH); - writel_relaxed((tmr_step & SPRD_WDT_LOW_VALUE_MASK), - wdt->base + SPRD_WDT_LOAD_LOW); - writel_relaxed((prtmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & - SPRD_WDT_LOW_VALUE_MASK, - wdt->base + SPRD_WDT_IRQ_LOAD_HIGH); - writel_relaxed(prtmr_step & SPRD_WDT_LOW_VALUE_MASK, - wdt->base + SPRD_WDT_IRQ_LOAD_LOW); - sprd_wdt_lock(wdt->base); - /* * Waiting the load value operation done, * it needs two or three RTC clock cycles. @@ -134,6 +122,19 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout, if (delay_cnt >= SPRD_WDT_LOAD_TIMEOUT) return -EBUSY; + + sprd_wdt_unlock(wdt->base); + writel_relaxed((tmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & + SPRD_WDT_LOW_VALUE_MASK, wdt->base + SPRD_WDT_LOAD_HIGH); + writel_relaxed((tmr_step & SPRD_WDT_LOW_VALUE_MASK), + wdt->base + SPRD_WDT_LOAD_LOW); + writel_relaxed((prtmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & + SPRD_WDT_LOW_VALUE_MASK, + wdt->base + SPRD_WDT_IRQ_LOAD_HIGH); + writel_relaxed(prtmr_step & SPRD_WDT_LOW_VALUE_MASK, + wdt->base + SPRD_WDT_IRQ_LOAD_LOW); + sprd_wdt_lock(wdt->base); + return 0; } -- 2.27.0