From patchwork Fri Jan 24 04:44:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1228675 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=XJ6mjQXy; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483mlS0bD8z9sRY for ; Fri, 24 Jan 2020 15:44:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2711981749; Fri, 24 Jan 2020 05:44:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1579841086; bh=noTsqcJOLuOZcsYfne7iYjOhgHqFAgZjhmCj3N9iQLA=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=XJ6mjQXyrRMpOgig4sh2NGHgHoRMSbpGXe9ZPys+YOygWjxrHl4bQBwDOzUJ8aH6R KUtnJjiEciVvc9BBwp58BAu78DoScl8f9Ty6m1f2Zp0vni2doFyuiMdpLXQqKNv49c ePYFi9Hd+boISY6PcyVOl+bZNMDhTM9At/NtrPhXDXwr3evm7cGojQE0kt/MQm/Em1 tGiZ+2wn44Y8AmQdGEb9/d+YuR12nbXkNzXiC0gUGO8Xd37Gp4ltE2E9djpUU7aomn bZZeBlOqwa38670V+RzfKYWumspELlVdzXSp6JMgecPRXxMxfE7Zcght4D2rQL+az6 O3hhYPM0FbX/w== Received: by phobos.denx.de (Postfix, from userid 109) id D0CCB817B0; Fri, 24 Jan 2020 05:44:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4B81A81744 for ; Fri, 24 Jan 2020 05:44:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 483mlF4wRyz1qqkj; Fri, 24 Jan 2020 05:44:41 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 483mlF4WQ7z1qsnS; Fri, 24 Jan 2020 05:44:41 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 086gm3qn9u_i; Fri, 24 Jan 2020 05:44:40 +0100 (CET) X-Auth-Info: 49iRMkyeA2crJD72JVCf5h5WR7kXJt61IIdzpX7x/Xc= Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz [86.49.35.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 24 Jan 2020 05:44:40 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Subject: [PATCH 1/3] watchdog: omap_wdt: Fix WDT timeout configuration Date: Fri, 24 Jan 2020 05:44:23 +0100 Message-Id: <20200124044425.469550-1-marex@denx.de> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Suniel Mahesh , Sam Protsenko Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean The timeout parameter of omap3_wdt_start() is in miliseconds, while GET_WLDR_VAL() expects parameter in seconds. Fix this so the WDT driver is actually usable. Signed-off-by: Marek Vasut Cc: Grygorii Strashko Cc: Sam Protsenko Cc: Suniel Mahesh Reviewed-by: Lokesh Vutla --- drivers/watchdog/omap_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 284cfbb2a8..b9cdf70036 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -188,7 +188,7 @@ static int omap3_wdt_stop(struct udevice *dev) static int omap3_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) { struct omap3_wdt_priv *priv = dev_get_priv(dev); - u32 pre_margin = GET_WLDR_VAL(timeout_ms); + u32 pre_margin = GET_WLDR_VAL(timeout_ms / 1000); /* * Make sure the watchdog is disabled. This is unfortunately required * because writing to various registers with the watchdog running has no From patchwork Fri Jan 24 04:44:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1228676 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=WNDGWcb/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483mlf1TqZz9sRY for ; Fri, 24 Jan 2020 15:45:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0BFCE817FF; Fri, 24 Jan 2020 05:44:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1579841092; bh=nAAB9lry7XHQcKh4dGsuz2ksG0yqk6ME4Brl6j3vQ70=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=WNDGWcb/ZwaLvCMIRB1l98GLIVDLeGrxPfDCIqP97hK/sPr5BaT/qVWYOxlCYsZHg xpZVJ9zIO0qo+ZTnJwM1cvTtbZ4na/IEt7nyouKXzP/yBe0kzYkdgCI5Jn3QSxcbyF gwkjgZi5WHmAAxM0WoOoLnXR8q/aYNabyvIKUB4+fkFR66gilqcd6yFPC5PCdLyQVE l5WF6dN6/OveelUCvSjwx6XJNMdVP9dei9aKp+cXF7zoG/DIiSY1XSn4iYMd6jFjLE JfOkXXF90qj4Yc2lXTQq+PRT8/H8hoBwnowwnsgZJ05BO9usGWJBsS8MAL20yZEssn jo+uim5XlJY3Q== Received: by phobos.denx.de (Postfix, from userid 109) id BF2B88177B; Fri, 24 Jan 2020 05:44:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0A99181749 for ; Fri, 24 Jan 2020 05:44:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 483mlG5k5Jz1qr4G; Fri, 24 Jan 2020 05:44:42 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 483mlG5DJVz1qsnS; Fri, 24 Jan 2020 05:44:42 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 7lfIv846Ei0F; Fri, 24 Jan 2020 05:44:41 +0100 (CET) X-Auth-Info: K5EtFjnvQNfqwll21lZv5Dpe6YbzDftPvYDhn6c+ILo= Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz [86.49.35.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 24 Jan 2020 05:44:41 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Subject: [PATCH 2/3] watchdog: omap_wdt: Fix WDT reloading Date: Fri, 24 Jan 2020 05:44:24 +0100 Message-Id: <20200124044425.469550-2-marex@denx.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200124044425.469550-1-marex@denx.de> References: <20200124044425.469550-1-marex@denx.de> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Suniel Mahesh , Sam Protsenko Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean The watchdog timer value was never updated in the hardware by this driver, so the watchdog triggered on some random stale value that was left in the hardware. The TI SPRUH37C says, quote: 20.4.3.9 Modifying Timer Count/Load Values and Prescaler Setting ... After a write access, the load register value and prescaler ratio registers are updated immediately, but new values are considered only after the next consecutive counter overflow or after a new trigger command (the WDT_WTGR register). This means at least one trigger must happen. The driver probably depended on someone calling it's .reset() callback, however that is not guaranteed e.g. if the WDT operates without servicing. Add this missing trigger. Signed-off-by: Marek Vasut Cc: Grygorii Strashko Cc: Sam Protsenko Cc: Suniel Mahesh Reviewed-by: Lokesh Vutla --- drivers/watchdog/omap_wdt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index b9cdf70036..85425ca505 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -219,6 +219,16 @@ static int omap3_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) while ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WSPR) ; + /* Trigger the watchdog to actually reload the counter. */ + while ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WTGR) + ; + + priv->wdt_trgr_pattern = ~(priv->wdt_trgr_pattern); + writel(priv->wdt_trgr_pattern, &priv->regs->wdtwtgr); + + while ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WTGR) + ; + return 0; } From patchwork Fri Jan 24 04:44:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1228677 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=pMfTGaqi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483mln2ZMDz9sRY for ; Fri, 24 Jan 2020 15:45:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D03BA8180F; Fri, 24 Jan 2020 05:44:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1579841094; bh=CV33ZanKTgAUblIMdpXLTb7Csn2q9q0J64eEqe0sHNc=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=pMfTGaqizy9Uxo6+C0RS76zTKZUL2bjx78njH6pJ+/7Y0VTlAqZrKcWDXkVV/rEP6 1z6LVIYvrkmFPsmcIDENahMCqXOjfyarDtquYOpMKvSxuSvaDml8f73dE7EujNq915 yUQBbHeki6xsd+RjfqShixr1Wxhi320a9G82a2Yyihd2c08XSRYtHf3W7i+MUbaZnP 9GCPb3ZJXx/sm8pfMP434gWumEhNEaal2ns5wNVuKDmO7EcgJkaDRUf90KS2xZIF9h oW4ZILr7E2Fk/OG1ztttH6Za0Wevjl4nPZFG6PHZeFhYeW1Eh0wZ5GZTco2PM8bjKy yKU1csFfsh0kg== Received: by phobos.denx.de (Postfix, from userid 109) id ED529817C0; Fri, 24 Jan 2020 05:44:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 349EA81766 for ; Fri, 24 Jan 2020 05:44:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 483mlJ02l2z1qr4L; Fri, 24 Jan 2020 05:44:44 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 483mlH6nL9z1qsnS; Fri, 24 Jan 2020 05:44:43 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 1VWACAgdCNWy; Fri, 24 Jan 2020 05:44:42 +0100 (CET) X-Auth-Info: na9xD+/bsHCQZVPvh1ohn3XCzQLmNiJvjac6tkIZhwk= Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz [86.49.35.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 24 Jan 2020 05:44:42 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Subject: [PATCH 3/3] watchdog: omap_wdt: Fix WDT coding style Date: Fri, 24 Jan 2020 05:44:25 +0100 Message-Id: <20200124044425.469550-3-marex@denx.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200124044425.469550-1-marex@denx.de> References: <20200124044425.469550-1-marex@denx.de> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Suniel Mahesh , Sam Protsenko Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Fix obvious coding style problems, no functional change. Signed-off-by: Marek Vasut Cc: Grygorii Strashko Cc: Sam Protsenko Cc: Suniel Mahesh Reviewed-by: Lokesh Vutla --- drivers/watchdog/omap_wdt.c | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 85425ca505..5199d914ed 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -150,24 +150,24 @@ static int omap3_wdt_reset(struct udevice *dev) { struct omap3_wdt_priv *priv = dev_get_priv(dev); -/* - * Somebody just triggered watchdog reset and write to WTGR register - * is in progress. It is resetting right now, no need to trigger it - * again - */ + /* + * Somebody just triggered watchdog reset and write to WTGR register + * is in progress. It is resetting right now, no need to trigger it + * again + */ if ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WTGR) return 0; priv->wdt_trgr_pattern = ~(priv->wdt_trgr_pattern); writel(priv->wdt_trgr_pattern, &priv->regs->wdtwtgr); -/* - * Don't wait for posted write to complete, i.e. don't check - * WDT_WWPS_PEND_WTGR bit in WWPS register. There is no writes to - * WTGR register outside of this func, and if entering it - * we see WDT_WWPS_PEND_WTGR bit set, it means watchdog reset - * was just triggered. This prevents us from wasting time in busy - * polling of WDT_WWPS_PEND_WTGR bit. - */ + /* + * Don't wait for posted write to complete, i.e. don't check + * WDT_WWPS_PEND_WTGR bit in WWPS register. There is no writes to + * WTGR register outside of this func, and if entering it + * we see WDT_WWPS_PEND_WTGR bit set, it means watchdog reset + * was just triggered. This prevents us from wasting time in busy + * polling of WDT_WWPS_PEND_WTGR bit. + */ return 0; } @@ -175,7 +175,7 @@ static int omap3_wdt_stop(struct udevice *dev) { struct omap3_wdt_priv *priv = dev_get_priv(dev); -/* disable watchdog */ + /* disable watchdog */ writel(0xAAAA, &priv->regs->wdtwspr); while (readl(&priv->regs->wdtwwps) != 0x0) ; @@ -189,28 +189,28 @@ static int omap3_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) { struct omap3_wdt_priv *priv = dev_get_priv(dev); u32 pre_margin = GET_WLDR_VAL(timeout_ms / 1000); -/* - * Make sure the watchdog is disabled. This is unfortunately required - * because writing to various registers with the watchdog running has no - * effect. - */ + /* + * Make sure the watchdog is disabled. This is unfortunately required + * because writing to various registers with the watchdog running has + * no effect. + */ omap3_wdt_stop(dev); -/* initialize prescaler */ + /* initialize prescaler */ while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WCLR) ; writel(WDT_WCLR_PRE | (PTV << WDT_WCLR_PTV_OFF), &priv->regs->wdtwclr); while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WCLR) ; -/* just count up at 32 KHz */ + /* just count up at 32 KHz */ while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WLDR) ; writel(pre_margin, &priv->regs->wdtwldr); while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WLDR) ; -/* Sequence to enable the watchdog */ + /* Sequence to enable the watchdog */ writel(0xBBBB, &priv->regs->wdtwspr); while ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WSPR) ;