public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Henrik Nordström" <henrik@henriknordstrom.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu
Date: Mon, 24 Mar 2014 00:53:01 +0100	[thread overview]
Message-ID: <1395618781.6065.26.camel@localhost> (raw)
In-Reply-To: <1394978030-14511-4-git-send-email-hdegoede@redhat.com>

s?n 2014-03-16 klockan 14:53 +0100 skrev Hans de Goede:
>  void reset_cpu(ulong addr)
>  {
> +	static const struct sunxi_wdog *wdog =
> +		 &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog;
> +
> +	/* Set the watchdog for its shortest interval (.5s) and wait */
> +	writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
> +	writel(WDT_CTRL_RESTART, &wdog->ctl);
> +	while (1);

This code is incomplete and do not reload the watchdog if already
running. wdog->ctl is locked by a magic key. Should use

        writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);

where

#define WDT_CTRL_KEY		(0x0a57 << 1)

Unfortunatley Allwinner kindly omitted this little detail from the User
Manual.

Found out while trying to use the watchdog as a watchdog and not only
reset. Asked Tom while he still was@Allwinner and got clarification
on how to use the watchdog control register.

Regards
Henrik

  parent reply	other threads:[~2014-03-23 23:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-16 13:53 [U-Boot] [PATCH u-boot sunxi 0/4] sun4i support on top of Ian's patches Hans de Goede
2014-03-16 13:53 ` [U-Boot] [PATCH u-boot sunxi 1/4] sunxi: FIXUP: sunxi: initial generic sun7i cpu, board and start of day support Hans de Goede
2014-03-16 13:53 ` [U-Boot] [PATCH u-boot sunxi 2/4] sunxi: FIXUP: sunxi: initial sun7i dram setup support Hans de Goede
2014-03-16 18:00   ` Ian Campbell
2014-03-16 13:53 ` [U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu Hans de Goede
2014-03-16 18:38   ` Ian Campbell
2014-03-24  0:00     ` Henrik Nordström
2014-03-23 23:53   ` Henrik Nordström [this message]
2014-05-10 11:37     ` Hans de Goede
2014-03-16 13:53 ` [U-Boot] [PATCH u-boot sunxi 4/4] sunxi: Add sun4i support Hans de Goede
2014-03-16 13:58   ` Hans de Goede
2014-03-17 12:43   ` Tom Rini
2014-03-17 22:51     ` [U-Boot] [linux-sunxi] " Hans de Goede
2014-03-16 15:05 ` [U-Boot] [PATCH u-boot sunxi 0/4] sun4i support on top of Ian's patches Ian Campbell
2014-03-16 15:15   ` Hans de Goede
2014-03-16 16:06     ` Ian Campbell

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=1395618781.6065.26.camel@localhost \
    --to=henrik@henriknordstrom.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