Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932248AbcCCTC4 (ORCPT ); Thu, 3 Mar 2016 14:02:56 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:42098 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756683AbcCCTCy (ORCPT ); Thu, 3 Mar 2016 14:02:54 -0500 Date: Thu, 3 Mar 2016 11:02:51 -0800 From: Guenter Roeck To: Romain Izard Cc: LKML , linux-watchdog@vger.kernel.org, linux-arm-kernel , Wim Van Sebroeck , Wenyou Yang , Nicolas Ferre Subject: Re: [PATCH v1] watchdog: sama5d4_wdt: Reset delay on start Message-ID: <20160303190251.GA22198@roeck-us.net> References: <1457000979-15717-1-git-send-email-romain.izard.pro@gmail.com> <56D829A7.1020201@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1852 Lines: 52 On Thu, Mar 03, 2016 at 01:53:47PM +0100, Romain Izard wrote: > Hi Guenter, > > 2016-03-03 13:10 GMT+01:00 Guenter Roeck : > > On 03/03/2016 02:29 AM, Romain Izard wrote: > >> > >> If the internal counter is not refreshed when the watchdog is started > >> for the first time, the watchdog will trigger very rapidly. For > >> example, opening /dev/watchdog without writing in it will immediately > >> trigger a reboot, instead of waiting for the delay to expire. > >> > >> To avoid this problem, reload the timer on opening the watchdog > >> device. > >> > >> Command: "while sleep 5; do echo 1; done > /dev/watchdog" > >> Before: system reset > >> After: the watchdog runs correctly > >> > >> Signed-off-by: Romain Izard > > > > > > Subject might better read "ping watchdog on start" or similar. > > > OK. I'll change it for a v2. > > > Does the watchdog have to be pinged before it is enabled ? I am a bit > > concerned that there may still be a 125 uS window during which the > > system could restart. > > > > According to the SAMA5D2 & SAMA5D4 datasheets, the timer ought to be > reloaded when the watchdog is enabled by a write in the MR register. > Unfortunately, it does not work as described, as I encountered the > problem on a SAMA5D2 Xplained board. > > The 4 clock delay is not in the datasheet either, but without any delay > the timer is clearly not reloaded, as my issue stays the same. As there > is a required delay before writing to MR after writing to CR, I applied > the same type of delay in the reverse case. > Question is if there is now a 4 clock window where the watchdog can still reset the system. Can you reload the timer before enabling the watchdog ? Thanks, Guenter > Perhaps Nicolas or Wenyou have more information on this. > > Best regards, > -- > Romain Izard