Skip to content

Commit eb11df4

Browse files
lzufalconralfbaechle
authored andcommitted
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>
1 parent 97e6a89 commit eb11df4

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎arch/mips/include/asm/mach-loongson/loongson.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern void mach_prepare_reboot(void);
2323
extern void mach_prepare_shutdown(void);
2424

2525
/* environment arguments from bootloader */
26-
extern unsigned long bus_clock, cpu_clock_freq;
26+
extern unsigned long cpu_clock_freq;
2727
extern unsigned long memsize, highmemsize;
2828

2929
/* loongson-specific command line, env and memory initialization */

‎arch/mips/loongson/common/env.c‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@
2323

2424
#include <loongson.h>
2525

26-
unsigned long bus_clock, cpu_clock_freq;
26+
unsigned long cpu_clock_freq;
2727
EXPORT_SYMBOL(cpu_clock_freq);
2828
unsigned long memsize, highmemsize;
2929

30-
/* pmon passes arguments in 32bit pointers */
31-
int *_prom_envp;
32-
3330
#define parse_even_earlier(res, option, p) \
3431
do { \
3532
if (strncmp(option, (char *)p, strlen(option)) == 0) \
@@ -39,6 +36,10 @@ do { \
3936

4037
void __init prom_init_env(void)
4138
{
39+
/* pmon passes arguments in 32bit pointers */
40+
int *_prom_envp;
41+
unsigned long bus_clock;
42+
unsigned int processor_id;
4243
long l;
4344

4445
/* firmware arguments are initialized in head.S */
@@ -55,6 +56,22 @@ void __init prom_init_env(void)
5556
}
5657
if (memsize == 0)
5758
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+
}
5875

5976
pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n",
6077
bus_clock, cpu_clock_freq, memsize, highmemsize);

0 commit comments

Comments
 (0)