2011-12-03 17:02:00 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2015-08-26 07:04:45 +00:00
|
|
|
#include <init.h>
|
|
|
|
#include <restart.h>
|
2014-01-18 11:48:05 +00:00
|
|
|
#include <mach/pxa-regs.h>
|
2011-12-03 17:02:00 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
#define OSMR3 0x40A0000C
|
|
|
|
#define OSCR 0x40A00010
|
|
|
|
#define OSSR 0x40A00014
|
|
|
|
#define OWER 0x40A00018
|
|
|
|
|
|
|
|
#define OWER_WME (1 << 0) /* Watch-dog Match Enable */
|
|
|
|
#define OSSR_M3 (1 << 3) /* Match status channel 3 */
|
|
|
|
|
2015-01-09 07:36:41 +00:00
|
|
|
extern void pxa_clear_reset_source(void);
|
2014-01-18 11:48:06 +00:00
|
|
|
|
2015-08-26 07:04:45 +00:00
|
|
|
static void __noreturn pxa_restart_soc(struct restart_handler *rst)
|
2011-12-03 17:02:00 +00:00
|
|
|
{
|
2014-01-18 11:48:05 +00:00
|
|
|
/* Clear last reset source */
|
2015-01-09 07:36:42 +00:00
|
|
|
pxa_clear_reset_source();
|
2014-01-18 11:48:05 +00:00
|
|
|
|
2011-12-03 17:02:00 +00:00
|
|
|
/* Initialize the watchdog and let it fire */
|
|
|
|
writel(OWER_WME, OWER);
|
|
|
|
writel(OSSR_M3, OSSR);
|
|
|
|
writel(readl(OSCR) + 368640, OSMR3); /* ... in 100 ms */
|
|
|
|
|
2015-08-26 07:04:45 +00:00
|
|
|
hang();
|
2011-12-03 17:02:00 +00:00
|
|
|
}
|
2015-08-26 07:04:45 +00:00
|
|
|
|
|
|
|
static int restart_register_feature(void)
|
|
|
|
{
|
|
|
|
restart_handler_register_fn(pxa_restart_soc);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
coredevice_initcall(restart_register_feature);
|