public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Simon Kagstrom <simon.kagstrom@netinsight.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm:kirkwood: Add hardware watchdog support for Marvell Kirkwood boards
Date: Wed, 28 Oct 2009 10:53:16 +0100	[thread overview]
Message-ID: <20091028105316.43bb55eb@marrow.netinsight.se> (raw)
In-Reply-To: <73173D32E9439E4ABB5151606C3E19E202F200E6CB@SC-VEXCH1.marvell.com>

Thanks for the comments!

On Wed, 28 Oct 2009 02:24:43 -0700
Prafulla Wadaskar <prafulla@marvell.com> wrote:

> > >  
> > >  #define UBOOT_CNTR	0	/* counter to use for uboot timer */
> > > +#define WATCHDOG_CNTR	2
> 
> BTW, this declaration will not be required if you see struct kwtmr_register 

Well, to me it makes the code more clear, so I'd prefer to keep it.

> > >  
> > >  /* Timer reload and current value registers */
> > >  struct kwtmr_val {
> > > @@ -166,3 +167,31 @@ int timer_init(void)
> > >  
> > >  	return 0;
> > >  }
> > > +
> > > +#if defined(CONFIG_HW_WATCHDOG)
> > > +static unsigned long watchdog_timeout = 5;
> 
> Please get rid of this magic number, Pls provide some comments
> I think just u8 are sufficient here since the time is in seconds.
> I suggest variable name as "wdt_tout" to keep it small

I'll make it configurable through config.h, and a u8. However, I think
watchdog_timeout is a more descriptive name here.

> > > +
> > > +	writel(time, CNTMR_VAL_REG(WATCHDOG_CNTR));
> 
> Please check struct kwtmr_registers, wdt regs are named differently, pls use them

I can do that, but CNTMR_VAL_REG is actually defined higher up in the
file as

   #define CNTMR_VAL_REG(tmrnum)		&kwtmr_regs->tmr[tmrnum].val

and used for the regular timer support. I'm not sure I like that, but
at least the file should be internally consistent.

> > > --- a/include/asm-arm/arch-kirkwood/cpu.h
> > > +++ b/include/asm-arm/arch-kirkwood/cpu.h
> > > @@ -165,5 +165,7 @@ int kw_config_mpp(unsigned int mpp0_7, 
> > unsigned int mpp8_15,
> > >  		unsigned int mpp32_39, unsigned int mpp40_47,
> > >  		unsigned int mpp48_55);
> > >  unsigned int kw_winctrl_calcsize(unsigned int sizeval);
> > > +void kw_watchdog_init(unsigned long timeout_secs);
> 
> Functions declared here are suppose to be in cpu.c
> Moreover I think we don't need this function at all,
> You can club kw_watchdog_init with hw_watchdog_reset so that at very first WATCHDOG_RESET() function call,
> watchdog timer it will be initialized.

But then it's unconditionally turned on as soon as the first
WATCHDOG_RESET() is called, which might not be what you want.

In the long run, we should probably add command line support for
enabling the watchdog (some might want to do it just before starting
Linux for example).

// Simon

  reply	other threads:[~2009-10-28  9:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-28  7:06 [U-Boot] [PATCH] arm:kirkwood: Add hardware watchdog support for Marvell Kirkwood boards Simon Kagstrom
2009-09-28 12:36 ` Tom
2009-09-28 13:36   ` Simon Kagstrom
2009-09-28 14:28     ` Tom
2009-09-29  2:16 ` Prafulla Wadaskar
2009-09-29  8:28   ` Simon Kagstrom
2009-09-29 13:45     ` Prafulla Wadaskar
2009-09-29 13:59       ` Stefan Roese
2009-09-29 14:01       ` Simon Kagstrom
2009-10-28  8:17 ` Simon Kagstrom
2009-10-28  9:24   ` Prafulla Wadaskar
2009-10-28  9:53     ` Simon Kagstrom [this message]
2009-10-28 11:34       ` Prafulla Wadaskar
2009-10-28 12:44         ` Simon Kagstrom
2009-10-28 12:57           ` Prafulla Wadaskar
2009-10-28 13:05             ` Simon Kagstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091028105316.43bb55eb@marrow.netinsight.se \
    --to=simon.kagstrom@netinsight.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox