From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Date: Sat, 10 May 2014 13:37:37 +0200 Subject: [U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu In-Reply-To: <1395618781.6065.26.camel@localhost> References: <1394978030-14511-1-git-send-email-hdegoede@redhat.com> <1394978030-14511-4-git-send-email-hdegoede@redhat.com> <1395618781.6065.26.camel@localhost> Message-ID: <536E0F81.8060703@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, On 03/24/2014 12:53 AM, Henrik Nordstr?m wrote: > 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 at Allwinner and got clarification > on how to use the watchdog control register. Thanks, I'm currently working on v2 of this series and I've included this fix. Regards, Hans