X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=target%2Flinux%2Fxburst%2Ffiles-2.6.32%2Farch%2Fmips%2Fjz4740%2Freset.c;fp=target%2Flinux%2Fxburst%2Ffiles-2.6.32%2Farch%2Fmips%2Fjz4740%2Freset.c;h=a4b2292f101ab17022d9c0e8cd123b6401961718;hb=809c03fe4c0f90c640b26e6a2792553b592c68f2;hp=0000000000000000000000000000000000000000;hpb=19682a7752733bc6a45026d69c27575b9b7755fd;p=openwrt-10.03%2F.git diff --git a/target/linux/xburst/files-2.6.32/arch/mips/jz4740/reset.c b/target/linux/xburst/files-2.6.32/arch/mips/jz4740/reset.c new file mode 100644 index 000000000..a4b2292f1 --- /dev/null +++ b/target/linux/xburst/files-2.6.32/arch/mips/jz4740/reset.c @@ -0,0 +1,50 @@ +/* + * linux/arch/mips/jz4740/reset.c + * + * JZ4740 reset routines. + * + * Copyright (c) 2006-2007 Ingenic Semiconductor Inc. + * Author: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void jz_restart(char *command) +{ + printk(KERN_NOTICE "Restarting after 4 ms\n"); + REG_WDT_TCSR = WDT_TCSR_PRESCALE4 | WDT_TCSR_EXT_EN; + REG_WDT_TCNT = 0; + REG_WDT_TDR = JZ_EXTAL/1000; /* reset after 4ms */ + jz4740_timer_enable_watchdog(); + REG_WDT_TCER = WDT_TCER_TCEN; /* wdt start */ + while (1); +} + +void jz_halt(void) +{ + /* Put CPU to power down mode */ + while (!(REG_RTC_RCR & RTC_RCR_WRDY)); + REG_RTC_HCR = RTC_HCR_PD; + + while (1) + __asm__(".set\tmips3\n\t" + "wait\n\t" + ".set\tmips0"); +} + +void jz_power_off(void) +{ + jz_halt(); +}