aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2010-01-04 04:16:48 -0500
committerRalf Baechle <ralf@linux-mips.org>2010-02-27 06:53:11 -0500
commiteb11df472d8491fcb28534b59017e1b5465997fa (patch)
tree019fe0166af774fffe0227b42546463a326e144e /arch/mips/loongson
parent97e6a89634befaf5bd66d3044d36961c887cd98c (diff)
MIPS: Loongson: Cleanup of the environment variables
Changes: o Move bus_clock into prom_init_env() o Initialize the cpu_clock_freq to the default values for the correspoding processor revisions if no such environment variable passed by BIOS/Bootloader. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: linux-mips@linux-mips.org Cc: yanh@lemote.com Cc: huhb@lemote.com Cc: zhangfx@lemote.com Patchwork: http://patchwork.linux-mips.org/patch/826/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson')
-rw-r--r--arch/mips/loongson/common/env.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c
index 196d947d929a..8c01df5758a9 100644
--- a/arch/mips/loongson/common/env.c
+++ b/arch/mips/loongson/common/env.c
@@ -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);