From mboxrd@z Thu Jan 1 00:00:00 1970 From: Henrik =?ISO-8859-1?Q?Nordstr=F6m?= Date: Mon, 24 Mar 2014 00:53:01 +0100 Subject: [U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu In-Reply-To: <1394978030-14511-4-git-send-email-hdegoede@redhat.com> References: <1394978030-14511-1-git-send-email-hdegoede@redhat.com> <1394978030-14511-4-git-send-email-hdegoede@redhat.com> Message-ID: <1395618781.6065.26.camel@localhost> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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