Pull video into test branch
[linux-drm-fsl-dcu.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/init.h>
15 #include <linux/mm.h>
16 #include <linux/sched.h>
17 #include <linux/bootmem.h>
18
19 #include <asm/addrspace.h>
20 #include <asm/bootinfo.h>
21 #include <asm/pmon.h>
22 #include <asm/gt64240.h>
23
24 #include "ocelot_pld.h"
25
26 struct callvectors* debug_vectors;
27
28 extern unsigned long marvell_base;
29 extern unsigned long bus_clock;
30
31 #ifdef CONFIG_GALILEO_GT64240_ETH
32 extern unsigned char prom_mac_addr_base[6];
33 #endif
34
35 const char *get_system_type(void)
36 {
37         return "Momentum Ocelot";
38 }
39
40 void __init prom_init(void)
41 {
42         int argc = fw_arg0;
43         char **arg = (char **) fw_arg1;
44         char **env = (char **) fw_arg2;
45         struct callvectors *cv = (struct callvectors *) fw_arg3;
46         int i;
47
48         /* save the PROM vectors for debugging use */
49         debug_vectors = cv;
50
51         /* arg[0] is "g", the rest is boot parameters */
52         arcs_cmdline[0] = '\0';
53         for (i = 1; i < argc; i++) {
54                 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
55                     >= sizeof(arcs_cmdline))
56                         break;
57                 strcat(arcs_cmdline, arg[i]);
58                 strcat(arcs_cmdline, " ");
59         }
60
61         mips_machgroup = MACH_GROUP_MOMENCO;
62         mips_machtype = MACH_MOMENCO_OCELOT_G;
63
64 #ifdef CONFIG_GALILEO_GT64240_ETH
65         /* get the base MAC address for on-board ethernet ports */
66         memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6);
67 #endif
68
69         while (*env) {
70                 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
71                         marvell_base = simple_strtol(*env + strlen("gtbase="),
72                                                         NULL, 16);
73                 }
74                 if (strncmp("busclock", *env, strlen("busclock")) == 0) {
75                         bus_clock = simple_strtol(*env + strlen("busclock="),
76                                                         NULL, 10);
77                 }
78                 env++;
79         }
80 }
81
82 unsigned long __init prom_free_prom_memory(void)
83 {
84         return 0;
85 }