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 PMC-Sierra Inc.
8 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
11 #include <linux/sched.h>
14 #include <asm/pgtable.h>
15 #include <asm/processor.h>
16 #include <asm/reboot.h>
17 #include <asm/system.h>
18 #include <linux/delay.h>
19 #include <linux/smp.h>
20 #include <asm/bootinfo.h>
26 int (*open) (char*, int, int);
28 int (*read) (int, void*, int);
29 int (*write) (int, void*, int);
30 off_t (*lseek) (int, off_t, int);
31 int (*printf) (const char*, ...);
32 void (*cacheflush) (void);
33 char* (*gets) (char*);
36 struct callvectors* debug_vectors;
38 extern unsigned long yosemite_base;
39 extern unsigned long cpu_clock;
40 unsigned char titan_ge_mac_addr_base[6];
42 const char *get_system_type(void)
44 return "PMC-Sierra Yosemite";
47 static void prom_cpu0_exit(void)
49 void *nvram = YOSEMITE_NVRAM_BASE_ADDR;
51 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
52 writeb(0x84, nvram + 0xff7);
54 /* wait for the watchdog to go off */
55 mdelay(100+(1000/16));
57 /* if the watchdog fails for some reason, let people know */
58 printk(KERN_NOTICE "Watchdog reset failed\n");
62 * Reset the NVRAM over the local bus
64 static void prom_exit(void)
67 if (smp_processor_id())
69 smp_call_function(prom_cpu0_exit, NULL, 1, 1);
75 * Get the MAC address from the EEPROM using the I2C protocol
77 void get_mac_address(char dest[6])
79 /* Use the I2C command code in the i2c-yosemite */
85 static void prom_halt(void)
87 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
89 __asm__(".set\tmips3\n\t"
95 * Init routine which accepts the variables from PMON
97 __init prom_init(int argc, char **arg, char **env, struct callvectors *cv)
101 /* Callbacks for halt, restart */
102 _machine_restart = (void (*)(char *))prom_exit;
103 _machine_halt = prom_halt;
104 _machine_power_off = prom_halt;
108 /* Do nothing for the 64-bit for now. Just implement for the 32-bit */
110 #else /* CONFIG_MIPS64 */
113 arcs_cmdline[0] = '\0';
115 /* Get the boot parameters */
116 for (i = 1; i < argc; i++) {
117 if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >= sizeof(arcs_cmdline))
120 strcat(arcs_cmdline, arg[i]);
121 strcat(arcs_cmdline, " ");
125 if (strncmp("ocd_base", *env, strlen("ocd_base")) == 0)
126 yosemite_base = simple_strtol(*env + strlen("ocd_base="),
129 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
130 cpu_clock = simple_strtol(*env + strlen("cpuclock="),
135 #endif /* CONFIG_MIPS64 */
137 mips_machgroup = MACH_GROUP_TITAN;
138 mips_machtype = MACH_TITAN_YOSEMITE;
140 get_mac_address(titan_ge_mac_addr_base);
142 debug_vectors->printf("Booting Linux kernel...\n");
145 void __init prom_free_prom_memory(void)
149 void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
153 extern void asmlinkage smp_bootstrap(void);
158 int prom_setup_smp(void)
163 * We know that the RM9000 on the Jaguar ATX board has 2 cores. Hence, this
164 * can be hardcoded for now.
169 int prom_boot_secondary(int cpu, unsigned long sp, unsigned long gp)
171 /* Clear the semaphore */
172 *(volatile uint32_t *)(0xbb000a68) = 0x80000000;
177 void prom_init_secondary(void)
179 clear_c0_config(CONF_CM_CMASK);
182 clear_c0_status(ST0_IM);
183 set_c0_status(0x1ffff);
186 void prom_smp_finish(void)