patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / mips / momentum / ocelot_g / prom.c
1 /*
2  * Copyright 2002 Momentum Computer Inc.
3  * Author: Matthew Dharm <mdharm@momenco.com>
4  *
5  * Based on Ocelot Linux port, which is
6  * Copyright 2001 MontaVista Software Inc.
7  * Author: jsun@mvista.com or jsun@junsun.net
8  *
9  * This program is free software; you can redistribute  it and/or modify it
10  * under  the terms of  the GNU General  Public License as published by the
11  * Free Software Foundation;  either version 2 of the  License, or (at your
12  * option) any later version.
13  */
14 #include <linux/config.h>
15 #include <linux/init.h>
16 #include <linux/mm.h>
17 #include <linux/sched.h>
18 #include <linux/bootmem.h>
19
20 #include <asm/addrspace.h>
21 #include <asm/bootinfo.h>
22 #include <asm/pmon.h>
23
24 #include "gt64240.h"
25 #include "ocelot_pld.h"
26
27 struct callvectors* debug_vectors;
28
29 extern unsigned long gt64240_base;
30 extern unsigned long bus_clock;
31
32 #ifdef CONFIG_GALILLEO_GT64240_ETH
33 extern unsigned char prom_mac_addr_base[6];
34 #endif
35
36 const char *get_system_type(void)
37 {
38         return "Momentum Ocelot";
39 }
40
41 /* [jsun@junsun.net] PMON passes arguments in C main() style */
42 void __init prom_init(void)
43 {
44         uint32_t tmp;
45         int argc = fw_arg0;
46         char **arg = (char **) fw_arg1;
47         char **env = (char **) fw_arg2;
48         struct callvectors *cv = (struct callvectors *) fw_arg3;
49         int i;
50
51         /* save the PROM vectors for debugging use */
52         debug_vectors = cv;
53
54         /* arg[0] is "g", the rest is boot parameters */
55         arcs_cmdline[0] = '\0';
56         for (i = 1; i < argc; i++) {
57                 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
58                     >= sizeof(arcs_cmdline))
59                         break;
60                 strcat(arcs_cmdline, arg[i]);
61                 strcat(arcs_cmdline, " ");
62         }
63
64         mips_machgroup = MACH_GROUP_MOMENCO;
65         mips_machtype = MACH_MOMENCO_OCELOT_G;
66
67 #ifdef CONFIG_GALILLEO_GT64240_ETH
68         /* get the base MAC address for on-board ethernet ports */
69         memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6);
70 #endif
71
72         while (*env) {
73                 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
74                         gt64240_base = simple_strtol(*env + strlen("gtbase="),
75                                                         NULL, 16);
76                 }
77                 if (strncmp("busclock", *env, strlen("busclock")) == 0) {
78                         bus_clock = simple_strtol(*env + strlen("busclock="),
79                                                         NULL, 10);
80                 }
81                 *env++;
82         }
83
84         debug_vectors->printf("Booting Linux kernel...\n");
85 }
86
87 unsigned long __init prom_free_prom_memory(void)
88 {
89         return 0;
90 }