aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/pmc-sierra/yosemite/prom.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/pmc-sierra/yosemite/prom.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/pmc-sierra/yosemite/prom.c')
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c141
1 files changed, 141 insertions, 0 deletions
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
new file mode 100644
index 000000000000..1fb3e697948d
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -0,0 +1,141 @@
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) 2003, 2004 PMC-Sierra Inc.
8 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
9 * Copyright (C) 2004 Ralf Baechle
10 */
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/smp.h>
17
18#include <asm/io.h>
19#include <asm/pgtable.h>
20#include <asm/processor.h>
21#include <asm/reboot.h>
22#include <asm/system.h>
23#include <asm/bootinfo.h>
24#include <asm/pmon.h>
25
26#ifdef CONFIG_SMP
27extern void prom_grab_secondary(void);
28#else
29#define prom_grab_secondary() do { } while (0)
30#endif
31
32#include "setup.h"
33
34struct callvectors *debug_vectors;
35
36extern unsigned long yosemite_base;
37extern unsigned long cpu_clock;
38
39const char *get_system_type(void)
40{
41 return "PMC-Sierra Yosemite";
42}
43
44static void prom_cpu0_exit(void *arg)
45{
46 void *nvram = (void *) YOSEMITE_RTC_BASE;
47
48 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
49 writeb(0x84, nvram + 0xff7);
50
51 /* wait for the watchdog to go off */
52 mdelay(100 + (1000 / 16));
53
54 /* if the watchdog fails for some reason, let people know */
55 printk(KERN_NOTICE "Watchdog reset failed\n");
56}
57
58/*
59 * Reset the NVRAM over the local bus
60 */
61static void prom_exit(void)
62{
63#ifdef CONFIG_SMP
64 if (smp_processor_id())
65 /* CPU 1 */
66 smp_call_function(prom_cpu0_exit, NULL, 1, 1);
67#endif
68 prom_cpu0_exit(NULL);
69}
70
71/*
72 * Halt the system
73 */
74static void prom_halt(void)
75{
76 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
77 while (1)
78 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
79}
80
81/*
82 * Init routine which accepts the variables from PMON
83 */
84void __init prom_init(void)
85{
86 int argc = fw_arg0;
87 char **arg = (char **) fw_arg1;
88 char **env = (char **) fw_arg2;
89 struct callvectors *cv = (struct callvectors *) fw_arg3;
90 int i = 0;
91
92 /* Callbacks for halt, restart */
93 _machine_restart = (void (*)(char *)) prom_exit;
94 _machine_halt = prom_halt;
95 _machine_power_off = prom_halt;
96
97 debug_vectors = cv;
98 arcs_cmdline[0] = '\0';
99
100 /* Get the boot parameters */
101 for (i = 1; i < argc; i++) {
102 if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >=
103 sizeof(arcs_cmdline))
104 break;
105
106 strcat(arcs_cmdline, arg[i]);
107 strcat(arcs_cmdline, " ");
108 }
109
110#ifdef CONFIG_SERIAL_8250_CONSOLE
111 if ((strstr(arcs_cmdline, "console=ttyS")) == NULL)
112 strcat(arcs_cmdline, "console=ttyS0,115200");
113#endif
114
115 while (*env) {
116 if (strncmp("ocd_base", *env, strlen("ocd_base")) == 0)
117 yosemite_base =
118 simple_strtol(*env + strlen("ocd_base="), NULL,
119 16);
120
121 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
122 cpu_clock =
123 simple_strtol(*env + strlen("cpuclock="), NULL,
124 10);
125
126 env++;
127 }
128
129 mips_machgroup = MACH_GROUP_TITAN;
130 mips_machtype = MACH_TITAN_YOSEMITE;
131
132 prom_grab_secondary();
133}
134
135void __init prom_free_prom_memory(void)
136{
137}
138
139void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
140{
141}