2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
5 * Louis Hamilton, Red Hat, Inc.
6 * hamilton@redhat.com [MIPS64 modifications]
8 * Copyright 2004 PMC-Sierra
9 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
11 * Based on Ocelot Linux port, which is
12 * Copyright 2001 MontaVista Software Inc.
13 * Author: jsun@mvista.com or jsun@junsun.net
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
20 * Copyright (C) 2004 MontaVista Software Inc.
21 * Author: Manish Lachwani, mlachwani@mvista.com
24 #include <linux/init.h>
25 #include <linux/bootmem.h>
26 #include <linux/mv643xx.h>
28 #include <asm/addrspace.h>
29 #include <asm/bootinfo.h>
31 #include "ocelot_3_fpga.h"
33 struct callvectors
* debug_vectors
;
34 extern unsigned long marvell_base
;
35 extern unsigned long cpu_clock
;
37 const char *get_system_type(void)
39 return "Momentum Ocelot-3";
44 unsigned long signext(unsigned long addr
)
47 return (unsigned long)((int)addr
);
50 void *get_arg(unsigned long args
, int arc
)
53 unsigned char *puc
, uc
;
56 ul
= (unsigned long)signext(args
);
57 puc
= (unsigned char *)ul
;
61 #ifdef CONFIG_CPU_LITTLE_ENDIAN
63 ul
= (unsigned long)uc
;
65 ul
|= (((unsigned long)uc
) << 8);
67 ul
|= (((unsigned long)uc
) << 16);
69 ul
|= (((unsigned long)uc
) << 24);
70 #else /* CONFIG_CPU_LITTLE_ENDIAN */
72 ul
= ((unsigned long)uc
) << 24;
74 ul
|= (((unsigned long)uc
) << 16);
76 ul
|= (((unsigned long)uc
) << 8);
78 ul
|= ((unsigned long)uc
);
79 #endif /* CONFIG_CPU_LITTLE_ENDIAN */
84 char *arg64(unsigned long addrin
, int arg_index
)
89 args
= signext(addrin
);
90 p
= (char *)get_arg(args
, arg_index
);
94 #endif /* CONFIG_64BIT */
96 void __init
prom_init(void)
99 char **arg
= (char **) fw_arg1
;
100 char **env
= (char **) fw_arg2
;
101 struct callvectors
*cv
= (struct callvectors
*) fw_arg3
;
106 printk("prom_init - MIPS64\n");
108 /* save the PROM vectors for debugging use */
109 debug_vectors
= (struct callvectors
*)signext((unsigned long)cv
);
111 /* arg[0] is "g", the rest is boot parameters */
112 arcs_cmdline
[0] = '\0';
114 for (i
= 1; i
< argc
; i
++) {
115 ptr
= (char *)arg64((unsigned long)arg
, i
);
116 if ((strlen(arcs_cmdline
) + strlen(ptr
) + 1) >=
117 sizeof(arcs_cmdline
))
119 strcat(arcs_cmdline
, ptr
);
120 strcat(arcs_cmdline
, " ");
125 ptr
= (char *)arg64((unsigned long)env
, i
);
129 if (strncmp("gtbase", ptr
, strlen("gtbase")) == 0) {
130 marvell_base
= simple_strtol(ptr
+ strlen("gtbase="),
133 if ((marvell_base
& 0xffffffff00000000) == 0)
134 marvell_base
|= 0xffffffff00000000;
136 printk("marvell_base set to 0x%016lx\n", marvell_base
);
138 if (strncmp("cpuclock", ptr
, strlen("cpuclock")) == 0) {
139 cpu_clock
= simple_strtol(ptr
+ strlen("cpuclock="),
141 printk("cpu_clock set to %d\n", cpu_clock
);
145 printk("arcs_cmdline: %s\n", arcs_cmdline
);
147 #else /* CONFIG_64BIT */
149 /* save the PROM vectors for debugging use */
152 /* arg[0] is "g", the rest is boot parameters */
153 arcs_cmdline
[0] = '\0';
154 for (i
= 1; i
< argc
; i
++) {
155 if (strlen(arcs_cmdline
) + strlen(arg
[i
] + 1)
156 >= sizeof(arcs_cmdline
))
158 strcat(arcs_cmdline
, arg
[i
]);
159 strcat(arcs_cmdline
, " ");
163 if (strncmp("gtbase", *env
, strlen("gtbase")) == 0) {
164 marvell_base
= simple_strtol(*env
+ strlen("gtbase="),
167 if (strncmp("cpuclock", *env
, strlen("cpuclock")) == 0) {
168 cpu_clock
= simple_strtol(*env
+ strlen("cpuclock="),
173 #endif /* CONFIG_64BIT */
175 mips_machgroup
= MACH_GROUP_MOMENCO
;
176 mips_machtype
= MACH_MOMENCO_OCELOT_3
;
179 debug_vectors
->printf("Booting Linux kernel...\n");
183 unsigned long __init
prom_free_prom_memory(void)
188 void __init
prom_fixup_mem_map(unsigned long start
, unsigned long end
)