Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp588696ybp; Wed, 9 Oct 2019 00:41:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxP1bbaY8YOO0rfYUfxP8Cw7BDhsFK+5xYvDNbHgiVaRqSTy0qQgzXXXpl1MVT+c2Htig+O X-Received: by 2002:a17:906:64e:: with SMTP id t14mr1485096ejb.75.1570606872484; Wed, 09 Oct 2019 00:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570606872; cv=none; d=google.com; s=arc-20160816; b=MHeo7swseFvf7oNjZ7rLZRMz9kOEM1yfpGe2pdM2miOB8p6XYNq9wA2sh0PA7V1ZQE Ut5r+Yv8rxA2PUM/5RWf6rie3+EM6FFbGLq4xZuJDxhU68hSqtWrCcbvAbPJkNvrg/7x DgAmoCELFRfoiFWJWMY4uMapc5OXBIYEpUBcn+e5SOwCf+Rt2FT63FZ8PY3Vy2JqT3oR cj/KZN8CL6Pot9yapwft6R85LVsfA5KdClSgbrFOiLCwmNXQm8mf9yj23M+QaRWA79N+ hxOQFiYZ6LL0779iBaqLCPQrfOgbBQoFNrB/kFl1cY3/JbQmmilrYBJjk0eWatK0MdoK Bxig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=9zDcZbbjOvOr9R3bHYV0cHIJopMkOYsJuE3Zh+4pyKs=; b=mInIKsMq6c9m8zS7A0bf5Wgp7OnpCbBZMLiM/asAsKyKRAhbqnVmaQzhCSjQYl9SVj 7rlOCzw7WxoQMiYMVN62Ce5PZtVmicSOZfFaHsQva3ZtsN7/s8g8enAM9oR47MUx8o+i 3aLz1QiEa/G9uovlw3Z05EHuCitmOm0UC8gm/SsB6oCvQLIKEU+wPpYXlzozXElgkrEh 1pZ9gqj6KdnSgIaDxZ3oixgNl7Z2DmK+VdGuXVSebYRTas4GfFChop+DCLhhS6wIiJsK 6hVMjr/r5RdKN4Qbzl8scHzl0ULcEv/YQLldHAmwNCX77J3npZ9NFKHvQetTB8i5gFeB gXyw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si719794ejf.305.2019.10.09.00.40.49; Wed, 09 Oct 2019 00:41:12 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728939AbfJIHkN (ORCPT + 99 others); Wed, 9 Oct 2019 03:40:13 -0400 Received: from inva020.nxp.com ([92.121.34.13]:41440 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbfJIHkM (ORCPT ); Wed, 9 Oct 2019 03:40:12 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E08CB1A09EF; Wed, 9 Oct 2019 09:40:10 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0E29A1A09F3; Wed, 9 Oct 2019 09:40:06 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id CA114402B1; Wed, 9 Oct 2019 15:39:59 +0800 (SGT) From: Anson Huang To: wim@linux-watchdog.org, linux@roeck-us.net, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH] watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format Date: Wed, 9 Oct 2019 15:37:47 +0800 Message-Id: <1570606667-16729-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 7ea5cf5..8ed89f0 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.7.4