2 * Copyright (C) 2004, 2005 by Thomas Koeller (thomas.koeller@baslerweb.com)
3 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <linux/config.h>
22 #include <linux/init.h>
23 #include <linux/sched.h>
25 #include <linux/delay.h>
26 #include <linux/smp.h>
27 #include <linux/module.h>
29 #include <asm/pgtable.h>
30 #include <asm/processor.h>
31 #include <asm/reboot.h>
32 #include <asm/system.h>
33 #include <asm/bootinfo.h>
34 #include <asm/string.h>
38 /* This struct is used by Redboot to pass arguments to the kernel */
54 static unsigned int prom_argc;
55 static const char ** prom_argv;
56 static const t_env_var * prom_env;
58 static void prom_halt(void) __attribute__((noreturn));
59 static void prom_exit(void) __attribute__((noreturn));
63 const char *get_system_type(void)
65 return "Basler eXcite";
71 static void prom_halt(void)
73 printk(KERN_NOTICE "\n** System halted.\n");
83 * Reset the CPU and re-enter Redboot
85 static void prom_exit(void)
88 volatile unsigned char * const flg =
89 (volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_DPR);
91 /* Clear the watchdog reset flag, set the reboot flag */
95 for (i = 0; i < 10; i++) {
96 *(volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_SYSCTL) = 0x02;
101 printk(KERN_NOTICE "Reset failed\n");
105 static const char __init *prom_getenv(char *name)
108 for (p = prom_env; p->name != NULL; p++)
109 if(strcmp(name, p->name) == 0)
115 * Init routine which accepts the variables from Redboot
117 void __init prom_init(void)
119 const struct parmblock * const pb = (struct parmblock *) fw_arg2;
122 prom_argv = (const char **) fw_arg1;
123 prom_env = &pb->memsize;
125 /* Callbacks for halt, restart */
126 _machine_restart = (void (*)(char *)) prom_exit;
127 _machine_halt = prom_halt;
130 /* copy command line */
131 strcpy(arcs_cmdline, prom_argv[1]);
132 memsize = simple_strtol(prom_getenv("memsize"), NULL, 16);
133 strcpy(modetty, prom_getenv("modetty0"));
134 #endif /* CONFIG_32BIT */
137 # error 64 bit support not implemented
138 #endif /* CONFIG_64BIT */
140 mips_machgroup = MACH_GROUP_TITAN;
141 mips_machtype = MACH_TITAN_EXCITE;
144 /* This is called from free_initmem(), so we need to provide it */
145 void __init prom_free_prom_memory(void)