diff --git a/xen/arch/arm/platforms/sunxi.c b/xen/arch/arm/platforms/sunxi.c index fb12801..7b728a4 100644 --- a/xen/arch/arm/platforms/sunxi.c +++ b/xen/arch/arm/platforms/sunxi.c @@ -16,7 +16,31 @@ * GNU General Public License for more details. */ +#include +#include +#include #include +#include + +static void sunxi_reset(void) +{ + void __iomem *wdt; + + wdt = ioremap_nocache(SUNXI_WDT_BASE & PAGE_MASK, PAGE_SIZE); + if ( !wdt ) + { + dprintk(XENLOG_ERR, "Unable to map watchdog!\n"); + return; + } + + writel(SUNXI_WDT_MODE_EN | SUNXI_WDT_MODE_RST_EN, wdt + ((SUNXI_WDT_BASE + SUNXI_WDT_MODE) & ~PAGE_MASK)); + iounmap(wdt); + + for (;;) + { + __asm("wfi"); + } +} static const char * const sunxi_dt_compat[] __initconst = { @@ -37,6 +61,7 @@ static const struct dt_device_match sunxi_blacklist_dev[] __initconst = PLATFORM_START(sunxi, "Allwinner A20") .compatible = sunxi_dt_compat, .blacklist_dev = sunxi_blacklist_dev, + .reset = sunxi_reset, .dom0_gnttab_start = 0x01d00000, .dom0_gnttab_size = 0x20000, diff --git a/xen/include/asm-arm/platforms/sunxi.h b/xen/include/asm-arm/platforms/sunxi.h new file mode 100644 index 0000000..4b7f48c --- /dev/null +++ b/xen/include/asm-arm/platforms/sunxi.h @@ -0,0 +1,17 @@ +#ifndef __ASM_ARM_PLATFORMS_SUNXI_H +#define __ASM_ASM_PLATFORMS_SUNXI_H + +#define SUNXI_WDT_BASE 0x01c20c90 +#define SUNXI_WDT_MODE 0x04 +#define SUNXI_WDT_MODE_EN (1 << 0) +#define SUNXI_WDT_MODE_RST_EN (1 << 1) + +#endif /* __ASM_ARM_PLATFORMS_SUNXI_H */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */