Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1583

RE: What's the best way to do a software-controlled CPU reset?

$
0
0

>but now I'm having trouble clearing the WOVF bit at startup.

The WOVF will be cleared automatically on reset. You should not have to do anything.

>Where can I find the Linux BSP code that does this?  I'd like to see if they're using a trick I'm missing.

here:

https://github.com/renesas-rz/linux-3.14/blob/master/arch/arm/mach-shmobile/board-rskrza1.c#L2267

#define WTCSR 0
#define WTCNT 2
#define WRCSR 4
static void r7s72100_restart(enum reboot_mode mode, const char *cmd)
{
	void *base = ioremap_nocache(0xFCFE0000, 0x10);

	/* If you have board specific stuff to do, you can do it
	   here before you reboot */

	/* NOTE: A reboot command doesn't 'sync' before this function
	   is called. See funciotn reboot() in kernel/reboot.c */

	/* Dummy read (must read WRCSR:WOVF at least once before clearing) */
	*(volatile uint8_t *)(base + WRCSR) = *(uint8_t *)(base + WRCSR);

	*(volatile uint16_t *)(base + WRCSR) = 0xA500;	/* Clear WOVF */
	*(volatile uint16_t *)(base + WRCSR) = 0x5A5F;	/* Reset Enable */
	*(volatile uint16_t *)(base + WTCNT) = 0x5A00;	/* Counter to 00 */
	*(volatile uint16_t *)(base + WTCSR) = 0xA578;	/* Start timer */

	while(1); /* Wait for WDT overflow */
}


Viewing all articles
Browse latest Browse all 1583

Trending Articles