GNU Linux-libre 4.9.282-gnu1
[releases.git] / arch / xtensa / platforms / iss / setup.c
1 /*
2  *
3  * arch/xtensa/platform-iss/setup.c
4  *
5  * Platform specific initialization.
6  *
7  * Authors: Chris Zankel <chris@zankel.net>
8  *          Joe Taylor <joe@tensilica.com>
9  *
10  * Copyright 2001 - 2005 Tensilica Inc.
11  *
12  * This program is free software; you can redistribute  it and/or modify it
13  * under  the terms of  the GNU General  Public License as published by the
14  * Free Software Foundation;  either version 2 of the  License, or (at your
15  * option) any later version.
16  *
17  */
18 #include <linux/stddef.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/errno.h>
22 #include <linux/reboot.h>
23 #include <linux/kdev_t.h>
24 #include <linux/types.h>
25 #include <linux/major.h>
26 #include <linux/blkdev.h>
27 #include <linux/console.h>
28 #include <linux/delay.h>
29 #include <linux/stringify.h>
30 #include <linux/notifier.h>
31
32 #include <asm/platform.h>
33 #include <asm/bootparam.h>
34
35 #include <platform/simcall.h>
36
37
38 void __init platform_init(bp_tag_t* bootparam)
39 {
40
41 }
42
43 void platform_halt(void)
44 {
45         pr_info(" ** Called platform_halt() **\n");
46         simc_exit(0);
47 }
48
49 void platform_power_off(void)
50 {
51         pr_info(" ** Called platform_power_off() **\n");
52         simc_exit(0);
53 }
54 void platform_restart(void)
55 {
56         /* Flush and reset the mmu, simulate a processor reset, and
57          * jump to the reset vector. */
58         cpu_reset();
59         /* control never gets here */
60 }
61
62 extern void iss_net_poll(void);
63
64 const char twirl[]="|/-\\|/-\\";
65
66 void platform_heartbeat(void)
67 {
68 #if 0
69         static int i = 0, j = 0;
70
71         if (--i < 0) {
72                 i = 99;
73                 printk("\r%c\r", twirl[j++]);
74                 if (j == 8)
75                         j = 0;
76         }
77 #endif
78 }
79
80
81
82 static int
83 iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
84 {
85         simc_exit(1);
86         return NOTIFY_DONE;
87 }
88
89 static struct notifier_block iss_panic_block = {
90         iss_panic_event,
91         NULL,
92         0
93 };
94
95 void __init platform_setup(char **p_cmdline)
96 {
97         atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
98 }