Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wu Zhangjin and committed by
Ralf Baechle
eb11df47 97e6a896

+22 -5
+1 -1
arch/mips/include/asm/mach-loongson/loongson.h
··· 23 23 extern void mach_prepare_shutdown(void); 24 24 25 25 /* environment arguments from bootloader */ 26 - extern unsigned long bus_clock, cpu_clock_freq; 26 + extern unsigned long cpu_clock_freq; 27 27 extern unsigned long memsize, highmemsize; 28 28 29 29 /* loongson-specific command line, env and memory initialization */
+21 -4
arch/mips/loongson/common/env.c
··· 23 23 24 24 #include <loongson.h> 25 25 26 - unsigned long bus_clock, cpu_clock_freq; 26 + unsigned long cpu_clock_freq; 27 27 EXPORT_SYMBOL(cpu_clock_freq); 28 28 unsigned long memsize, highmemsize; 29 - 30 - /* pmon passes arguments in 32bit pointers */ 31 - int *_prom_envp; 32 29 33 30 #define parse_even_earlier(res, option, p) \ 34 31 do { \ ··· 36 39 37 40 void __init prom_init_env(void) 38 41 { 42 + /* pmon passes arguments in 32bit pointers */ 43 + int *_prom_envp; 44 + unsigned long bus_clock; 45 + unsigned int processor_id; 39 46 long l; 40 47 41 48 /* firmware arguments are initialized in head.S */ ··· 56 55 } 57 56 if (memsize == 0) 58 57 memsize = 256; 58 + if (bus_clock == 0) 59 + bus_clock = 66000000; 60 + if (cpu_clock_freq == 0) { 61 + processor_id = (&current_cpu_data)->processor_id; 62 + switch (processor_id & PRID_REV_MASK) { 63 + case PRID_REV_LOONGSON2E: 64 + cpu_clock_freq = 533080000; 65 + break; 66 + case PRID_REV_LOONGSON2F: 67 + cpu_clock_freq = 797000000; 68 + break; 69 + default: 70 + cpu_clock_freq = 100000000; 71 + break; 72 + } 73 + } 59 74 60 75 pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n", 61 76 bus_clock, cpu_clock_freq, memsize, highmemsize);