From: Graeme Russ Date: Sun, 4 Oct 2009 22:49:22 +1100 Subject: [U-Boot] [PATCH] CFI Driver: Reset watchdog timer after each flash operation In-Reply-To: <4AC883ED.8050006@gmx.de> References: <20091002103417.GA9767@zaphod.peppercon.de> <200910021306.38589.sr@denx.de> <4AC5EE3B.5090200@gmx.de> <20091003232910.BEF2F832E408@gemini.denx.de> <4AC883ED.8050006@gmx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Oct 4, 2009 at 10:15 PM, Ingo van Lil wrote: > On 10/04/2009 01:29 AM, Wolfgang Denk wrote: > >> No, not an exception, but the reference implementation. I cannot help >> it that most other architectures / SoCs don;t care much. > > Well, if such an uncommon side-effect is expected of a function with a > well-known name it should at least be prominently documented. I like > Mike's suggestion to have a central udelay() implementation for that; > I'm gonna try to whip up a patch tomorrow. > > >>> I'm using an Atmel AT91-based custom board, and the udelay() function >>> can be found in cpu/arm926ejs/at91/timer.c. Unfortunately there's no >>> central udelay() implementation in lib_arm. >> >> Guess nobody attempted to use a WD on such a system before. > > You hardly have a choice: After reset the AT91's watchdog timer runs at > maximum period (15 seconds), and the control register is one-time > writable. If you disable the watchdog in u-boot there's no way to > re-enable it later in the OS. > > Regards, > Ingo Naive question of the day - Is there any reason for the complexity of the watchdog implementation with all the #defines to sort out software and hardware resets? Wouldn't it be easier to replace it with a weak function with an empty default implementation over-ridden at the board/arch/cpu level as needed? We can then call the watchdog reset in udelay() - will be a problem if the watchdog needs udelay (for a timed reset pulse for example) Just a thought Regards, Graeme