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