[MIPS] Rename _machine_power_off to pm_power_off so the kernel builds again.
[linux-2.6/mini2440.git] / arch / mips / pmc-sierra / yosemite / prom.c
blob165275c00cbb9c8fb42ebf9cbf64807725f67c95
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.
7 * Copyright (C) 2003, 2004 PMC-Sierra Inc.
8 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
9 * Copyright (C) 2004 Ralf Baechle
11 #include <linux/config.h>
12 #include <linux/init.h>
13 #include <linux/sched.h>
14 #include <linux/mm.h>
15 #include <linux/delay.h>
16 #include <linux/pm.h>
17 #include <linux/smp.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 <asm/bootinfo.h>
25 #include <asm/pmon.h>
27 #ifdef CONFIG_SMP
28 extern void prom_grab_secondary(void);
29 #else
30 #define prom_grab_secondary() do { } while (0)
31 #endif
33 #include "setup.h"
35 struct callvectors *debug_vectors;
37 extern unsigned long yosemite_base;
38 extern unsigned long cpu_clock;
40 const char *get_system_type(void)
42 return "PMC-Sierra Yosemite";
45 static void prom_cpu0_exit(void *arg)
47 void *nvram = (void *) YOSEMITE_RTC_BASE;
49 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
50 writeb(0x84, nvram + 0xff7);
52 /* wait for the watchdog to go off */
53 mdelay(100 + (1000 / 16));
55 /* if the watchdog fails for some reason, let people know */
56 printk(KERN_NOTICE "Watchdog reset failed\n");
60 * Reset the NVRAM over the local bus
62 static void prom_exit(void)
64 #ifdef CONFIG_SMP
65 if (smp_processor_id())
66 /* CPU 1 */
67 smp_call_function(prom_cpu0_exit, NULL, 1, 1);
68 #endif
69 prom_cpu0_exit(NULL);
73 * Halt the system
75 static void prom_halt(void)
77 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
78 while (1)
79 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
83 * Init routine which accepts the variables from PMON
85 void __init prom_init(void)
87 int argc = fw_arg0;
88 char **arg = (char **) fw_arg1;
89 char **env = (char **) fw_arg2;
90 struct callvectors *cv = (struct callvectors *) fw_arg3;
91 int i = 0;
93 /* Callbacks for halt, restart */
94 _machine_restart = (void (*)(char *)) prom_exit;
95 _machine_halt = prom_halt;
96 pm_power_off = prom_halt;
98 debug_vectors = cv;
99 arcs_cmdline[0] = '\0';
101 /* Get the boot parameters */
102 for (i = 1; i < argc; i++) {
103 if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >=
104 sizeof(arcs_cmdline))
105 break;
107 strcat(arcs_cmdline, arg[i]);
108 strcat(arcs_cmdline, " ");
111 #ifdef CONFIG_SERIAL_8250_CONSOLE
112 if ((strstr(arcs_cmdline, "console=ttyS")) == NULL)
113 strcat(arcs_cmdline, "console=ttyS0,115200");
114 #endif
116 while (*env) {
117 if (strncmp("ocd_base", *env, strlen("ocd_base")) == 0)
118 yosemite_base =
119 simple_strtol(*env + strlen("ocd_base="), NULL,
120 16);
122 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
123 cpu_clock =
124 simple_strtol(*env + strlen("cpuclock="), NULL,
125 10);
127 env++;
130 mips_machgroup = MACH_GROUP_TITAN;
131 mips_machtype = MACH_TITAN_YOSEMITE;
133 prom_grab_secondary();
136 unsigned long __init prom_free_prom_memory(void)
138 return 0;
141 void __init prom_fixup_mem_map(unsigned long start, unsigned long end)