• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/arch/mips/momentum/ocelot_c/
1/*
2 * This program is free software; you can redistribute  it and/or modify it
3 * under  the terms of  the GNU General  Public License as published by the
4 * Free Software Foundation;  either version 2 of the  License, or (at your
5 * option) any later version.
6 *
7 * Copyright (C) 1997, 2001 Ralf Baechle
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 * Copyright (C) 2002 Momentum Computer Inc.
12 * Author: Matthew Dharm <mdharm@momenco.com>
13 *
14 * Louis Hamilton, Red Hat, Inc.
15 * hamilton@redhat.com  [MIPS64 modifications]
16 */
17#include <linux/sched.h>
18#include <linux/mm.h>
19#include <asm/io.h>
20#include <asm/pgtable.h>
21#include <asm/processor.h>
22#include <asm/reboot.h>
23#include <asm/system.h>
24#include <linux/delay.h>
25
26void momenco_ocelot_restart(char *command)
27{
28	/* base address of timekeeper portion of part */
29	void *nvram = (void *)
30#ifdef CONFIG_64BIT
31		0xfffffffffc807000;
32#else
33		0xfc807000;
34#endif
35
36	/* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
37	writeb(0x84, nvram + 0xff7);
38
39	/* wait for the watchdog to go off */
40	mdelay(100+(1000/16));
41
42	/* if the watchdog fails for some reason, let people know */
43	printk(KERN_NOTICE "Watchdog reset failed\n");
44}
45
46void momenco_ocelot_halt(void)
47{
48	printk(KERN_NOTICE "\n** You can safely turn off the power\n");
49	while (1)
50		__asm__(".set\tmips3\n\t"
51	                "wait\n\t"
52			".set\tmips0");
53}
54
55void momenco_ocelot_power_off(void)
56{
57	momenco_ocelot_halt();
58}
59