public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH u-boot sunxi 01/12] sunxi: Implement reset_cpu
Date: Sat, 22 Mar 2014 17:16:34 +0100	[thread overview]
Message-ID: <532DB762.9010509@redhat.com> (raw)
In-Reply-To: <1395138344.12847.30.camel@kazak.uk.xensource.com>

Hi,

On 03/18/2014 11:25 AM, Ian Campbell wrote:
> On Tue, 2014-03-18 at 00:00 +0100, Hans de Goede wrote:
>> There is no way to reset the cpu, so use the watchdog for this.
> 
> Did you see
> https://www.mail-archive.com/u-boot at lists.denx.de/msg134259.html ?

Ah no, but I've read it now.

I think it would be better to focus on all the other more important bits
for now, and then we can look into adding some sort of generic watchdog
support later.

In the mean time I would like to carry this patch, since having "reset"
work can be quite useful, and it is just 3 lines (not counting the lines
which we would still need with the generic watchdog support).

Regards,

Hans


> 
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>  arch/arm/cpu/armv7/sunxi/board.c        | 7 +++++++
>>  arch/arm/include/asm/arch-sunxi/timer.h | 4 ++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
>> index e95f4e5..4fd5bcc 100644
>> --- a/arch/arm/cpu/armv7/sunxi/board.c
>> +++ b/arch/arm/cpu/armv7/sunxi/board.c
>> @@ -54,6 +54,13 @@ int gpio_init(void)
>>  
>>  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);
>>  }
>>  
>>  /* do some early init */
>> diff --git a/arch/arm/include/asm/arch-sunxi/timer.h b/arch/arm/include/asm/arch-sunxi/timer.h
>> index 6aacfd7..c29d3a0 100644
>> --- a/arch/arm/include/asm/arch-sunxi/timer.h
>> +++ b/arch/arm/include/asm/arch-sunxi/timer.h
>> @@ -11,6 +11,10 @@
>>  #ifndef _SUNXI_TIMER_H_
>>  #define _SUNXI_TIMER_H_
>>  
>> +#define WDT_CTRL_RESTART        (0x1 << 0)
>> +#define WDT_MODE_EN             (0x1 << 0)
>> +#define WDT_MODE_RESET_EN       (0x1 << 1)
>> +
>>  #ifndef __ASSEMBLY__
>>  
>>  #include <linux/types.h>
> 
> 

  reply	other threads:[~2014-03-22 16:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 23:00 [U-Boot] [PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 01/12] sunxi: Implement reset_cpu Hans de Goede
2014-03-18 10:25   ` Ian Campbell
2014-03-22 16:16     ` Hans de Goede [this message]
2014-03-22 17:17       ` Ian Campbell
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 02/12] sunxi: FIXUP: sunxi: initial generic sun7i cpu, board and start of day support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 03/12] sunxi: FIXUP: sunxi: initial sun7i clocks and timer support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 04/12] sunxi: FIXUP: sunxi: initial sun7i dram setup support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 05/12] sunxi: Add sun4i support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 06/12] sunxi: Add sun5i support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 07/12] sunxi: Add i2c support Hans de Goede
2014-03-18  7:54   ` Heiko Schocher
2014-05-03 15:46     ` Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 08/12] sunxi: Add axp209 pmic support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 09/12] sunxi: Add axp152 " Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 10/12] sunxi: fast MBUS support on sun7i Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 11/12] net: Rename and cleanup sunxi (Allwinner) emac driver Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 12/12] sunxi: enable emac for sun4i and sun5i Hans de Goede
2014-03-18 20:52 ` [U-Boot] [PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support Ian Campbell
2014-03-20 12:49 ` [U-Boot] [PATCH] sun5i: Add A13-OLinuXinoM support Tom Rini
2014-06-09  6:50   ` Albert ARIBAUD
2014-06-09  7:56     ` Hans de Goede
2014-06-10  7:25       ` Albert ARIBAUD
2014-06-10  7:48         ` Hans de Goede
2014-06-10  8:34           ` Albert ARIBAUD

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=532DB762.9010509@redhat.com \
    --to=hdegoede@redhat.com \
    --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