Commit eb11df47 authored by Wu Zhangjin's avatar Wu Zhangjin Committed by Ralf Baechle

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: default avatarWu 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: default avatarRalf Baechle <ralf@linux-mips.org>
parent 97e6a896
...@@ -23,7 +23,7 @@ extern void mach_prepare_reboot(void); ...@@ -23,7 +23,7 @@ extern void mach_prepare_reboot(void);
extern void mach_prepare_shutdown(void); extern void mach_prepare_shutdown(void);
/* environment arguments from bootloader */ /* environment arguments from bootloader */
extern unsigned long bus_clock, cpu_clock_freq; extern unsigned long cpu_clock_freq;
extern unsigned long memsize, highmemsize; extern unsigned long memsize, highmemsize;
/* loongson-specific command line, env and memory initialization */ /* loongson-specific command line, env and memory initialization */
......
...@@ -23,13 +23,10 @@ ...@@ -23,13 +23,10 @@
#include <loongson.h> #include <loongson.h>
unsigned long bus_clock, cpu_clock_freq; unsigned long cpu_clock_freq;
EXPORT_SYMBOL(cpu_clock_freq); EXPORT_SYMBOL(cpu_clock_freq);
unsigned long memsize, highmemsize; unsigned long memsize, highmemsize;
/* pmon passes arguments in 32bit pointers */
int *_prom_envp;
#define parse_even_earlier(res, option, p) \ #define parse_even_earlier(res, option, p) \
do { \ do { \
if (strncmp(option, (char *)p, strlen(option)) == 0) \ if (strncmp(option, (char *)p, strlen(option)) == 0) \
...@@ -39,6 +36,10 @@ do { \ ...@@ -39,6 +36,10 @@ do { \
void __init prom_init_env(void) void __init prom_init_env(void)
{ {
/* pmon passes arguments in 32bit pointers */
int *_prom_envp;
unsigned long bus_clock;
unsigned int processor_id;
long l; long l;
/* firmware arguments are initialized in head.S */ /* firmware arguments are initialized in head.S */
...@@ -55,6 +56,22 @@ void __init prom_init_env(void) ...@@ -55,6 +56,22 @@ void __init prom_init_env(void)
} }
if (memsize == 0) if (memsize == 0)
memsize = 256; memsize = 256;
if (bus_clock == 0)
bus_clock = 66000000;
if (cpu_clock_freq == 0) {
processor_id = (&current_cpu_data)->processor_id;
switch (processor_id & PRID_REV_MASK) {
case PRID_REV_LOONGSON2E:
cpu_clock_freq = 533080000;
break;
case PRID_REV_LOONGSON2F:
cpu_clock_freq = 797000000;
break;
default:
cpu_clock_freq = 100000000;
break;
}
}
pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n", pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n",
bus_clock, cpu_clock_freq, memsize, highmemsize); bus_clock, cpu_clock_freq, memsize, highmemsize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment