Linux-libre 5.7.6-gnu
[librecmc/linux-libre.git] / arch / mips / lasat / reset.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Thomas Horsten <thh@lasat.com>
4  * Copyright (C) 2000 LASAT Networks A/S.
5  *
6  * Reset the LASAT board.
7  */
8 #include <linux/kernel.h>
9 #include <linux/pm.h>
10
11 #include <asm/reboot.h>
12 #include <asm/lasat/lasat.h>
13
14 #include "picvue.h"
15 #include "prom.h"
16
17 static void lasat_machine_restart(char *command);
18 static void lasat_machine_halt(void);
19
20 /* Used to set machine to boot in service mode via /proc interface */
21 int lasat_boot_to_service;
22
23 static void lasat_machine_restart(char *command)
24 {
25         local_irq_disable();
26
27         if (lasat_boot_to_service) {
28                 *(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
29                 *(volatile unsigned int *)0xa00000fc = 0xfedeabba;
30         }
31         *lasat_misc->reset_reg = 0xbedead;
32         for (;;) ;
33 }
34
35 static void lasat_machine_halt(void)
36 {
37         local_irq_disable();
38
39         prom_monitor();
40         for (;;) ;
41 }
42
43 void lasat_reboot_setup(void)
44 {
45         _machine_restart = lasat_machine_restart;
46         _machine_halt = lasat_machine_halt;
47         pm_power_off = lasat_machine_halt;
48 }