diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2010-01-04 04:16:48 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:53:11 -0500 |
commit | eb11df472d8491fcb28534b59017e1b5465997fa (patch) | |
tree | 019fe0166af774fffe0227b42546463a326e144e /arch/mips/loongson | |
parent | 97e6a89634befaf5bd66d3044d36961c887cd98c (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.c | 25 |
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 | ||
26 | unsigned long bus_clock, cpu_clock_freq; | 26 | unsigned long cpu_clock_freq; |
27 | EXPORT_SYMBOL(cpu_clock_freq); | 27 | EXPORT_SYMBOL(cpu_clock_freq); |
28 | unsigned long memsize, highmemsize; | 28 | unsigned long memsize, highmemsize; |
29 | 29 | ||
30 | /* pmon passes arguments in 32bit pointers */ | ||
31 | int *_prom_envp; | ||
32 | |||
33 | #define parse_even_earlier(res, option, p) \ | 30 | #define parse_even_earlier(res, option, p) \ |
34 | do { \ | 31 | do { \ |
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 | ||
40 | void __init prom_init_env(void) | 37 | void __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 = (¤t_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); |