aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson/common/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/loongson/common/env.c')
-rw-r--r--arch/mips/loongson/common/env.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c
index 196d947d929a..ae4cff97a56c 100644
--- a/arch/mips/loongson/common/env.c
+++ b/arch/mips/loongson/common/env.c
@@ -9,8 +9,8 @@
9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
10 * Author: Fuxin Zhang, zhangfx@lemote.com 10 * Author: Fuxin Zhang, zhangfx@lemote.com
11 * 11 *
12 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology 12 * Copyright (C) 2009 Lemote Inc.
13 * Author: Wu Zhangjin, wuzj@lemote.com 13 * Author: Wu Zhangjin, wuzhangjin@gmail.com
14 * 14 *
15 * This program is free software; you can redistribute it and/or modify it 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 16 * under the terms of the GNU General Public License as published by the
@@ -23,13 +23,10 @@
23 23
24#include <loongson.h> 24#include <loongson.h>
25 25
26unsigned long bus_clock, cpu_clock_freq; 26unsigned long cpu_clock_freq;
27EXPORT_SYMBOL(cpu_clock_freq); 27EXPORT_SYMBOL(cpu_clock_freq);
28unsigned long memsize, highmemsize; 28unsigned long memsize, highmemsize;
29 29
30/* pmon passes arguments in 32bit pointers */
31int *_prom_envp;
32
33#define parse_even_earlier(res, option, p) \ 30#define parse_even_earlier(res, option, p) \
34do { \ 31do { \
35 if (strncmp(option, (char *)p, strlen(option)) == 0) \ 32 if (strncmp(option, (char *)p, strlen(option)) == 0) \
@@ -39,6 +36,10 @@ do { \
39 36
40void __init prom_init_env(void) 37void __init prom_init_env(void)
41{ 38{
39 /* pmon passes arguments in 32bit pointers */
40 int *_prom_envp;
41 unsigned long bus_clock;
42 unsigned int processor_id;
42 long l; 43 long l;
43 44
44 /* firmware arguments are initialized in head.S */ 45 /* firmware arguments are initialized in head.S */
@@ -55,6 +56,22 @@ void __init prom_init_env(void)
55 } 56 }
56 if (memsize == 0) 57 if (memsize == 0)
57 memsize = 256; 58 memsize = 256;
59 if (bus_clock == 0)
60 bus_clock = 66000000;
61 if (cpu_clock_freq == 0) {
62 processor_id = (&current_cpu_data)->processor_id;
63 switch (processor_id & PRID_REV_MASK) {
64 case PRID_REV_LOONGSON2E:
65 cpu_clock_freq = 533080000;
66 break;
67 case PRID_REV_LOONGSON2F:
68 cpu_clock_freq = 797000000;
69 break;
70 default:
71 cpu_clock_freq = 100000000;
72 break;
73 }
74 }
58 75
59 pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n", 76 pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n",
60 bus_clock, cpu_clock_freq, memsize, highmemsize); 77 bus_clock, cpu_clock_freq, memsize, highmemsize);