From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76994C432C3 for ; Tue, 3 Dec 2019 22:42:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 496F520865 for ; Tue, 3 Dec 2019 22:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575412925; bh=WjHu08LmqT2OPELbjZFEqCtn8ZeJPW9t8uOuPbCMxrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mUcYvpTV1k6VQZhU2lA7IO8bhHjR60OwTq5knFR5fDimvTwcIV2f4V1n5QPgt8Mth vbwGgtOc/wqTVUuuYJioOKM+XOeNu4o7THmowNn5GQR53L+KnAYrdHKcH6idIqUHMo jUnKDT/idREbaTR7nBaFx287heI93Nsw4CGHeKkg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbfLCWmE (ORCPT ); Tue, 3 Dec 2019 17:42:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:56736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbfLCWmA (ORCPT ); Tue, 3 Dec 2019 17:42:00 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 87518206EC; Tue, 3 Dec 2019 22:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575412920; bh=WjHu08LmqT2OPELbjZFEqCtn8ZeJPW9t8uOuPbCMxrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oGUmr7vpoonoKvShqVUIc2FzXHOAsEYNyBIDZbm+ApnZQciBcSyr0nEAXn1f3sy4C pZ7SF+M1ACA2fQjAZ+kBpMpJoUIV8hV6ttPjm5uzpU3Mydh8Rk3BuN/clnFgYsiqZC Wb2SuQvyVAgOYJdy+21A3gjsgivBpGbyv/V0LPgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anson Huang , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.3 067/135] watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format Date: Tue, 3 Dec 2019 23:35:07 +0100 Message-Id: <20191203213025.741546037@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203213005.828543156@linuxfoundation.org> References: <20191203213005.828543156@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang [ Upstream commit 2c50a6b825b3463a7600d6e6acadba73211c3d2c ] SCU firmware calculates pretimeout based on current time stamp instead of watchdog timeout stamp, need to convert the pretimeout to SCU firmware's timeout value. Fixes: 15f7d7fc5542 ("watchdog: imx_sc: Add pretimeout support") Signed-off-by: Anson Huang Reviewed-by: Guenter Roeck Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/imx_sc_wdt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c index 78eaaf75a263f..9545d1e07421a 100644 --- a/drivers/watchdog/imx_sc_wdt.c +++ b/drivers/watchdog/imx_sc_wdt.c @@ -99,8 +99,14 @@ static int imx_sc_wdt_set_pretimeout(struct watchdog_device *wdog, { struct arm_smccc_res res; + /* + * SCU firmware calculates pretimeout based on current time + * stamp instead of watchdog timeout stamp, need to convert + * the pretimeout to SCU firmware's timeout value. + */ arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG, - pretimeout * 1000, 0, 0, 0, 0, 0, &res); + (wdog->timeout - pretimeout) * 1000, 0, 0, 0, + 0, 0, &res); if (res.a0) return -EACCES; -- 2.20.1