1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Based on Ocelot Linux port, which is
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: jsun@mvista.com or jsun@junsun.net
7 * Copyright 2003 ICT CAS
8 * Author: Michael Guo <guoyi@ict.ac.cn>
10 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
11 * Author: Fuxin Zhang, zhangfx@lemote.com
13 * Copyright (C) 2009 Lemote Inc.
14 * Author: Wu Zhangjin, wuzhangjin@gmail.com
16 #include <linux/export.h>
17 #include <asm/bootinfo.h>
18 #include <asm/fw/fw.h>
22 EXPORT_SYMBOL(cpu_clock_freq
);
24 void __init
prom_init_env(void)
26 /* pmon passes arguments in 32bit pointers */
27 unsigned int processor_id
;
29 cpu_clock_freq
= fw_getenvl("cpuclock");
30 memsize
= fw_getenvl("memsize");
31 highmemsize
= fw_getenvl("highmemsize");
36 pr_info("memsize=%u, highmemsize=%u\n", memsize
, highmemsize
);
38 if (cpu_clock_freq
== 0) {
39 processor_id
= (¤t_cpu_data
)->processor_id
;
40 switch (processor_id
& PRID_REV_MASK
) {
41 case PRID_REV_LOONGSON2E
:
42 cpu_clock_freq
= 533080000;
44 case PRID_REV_LOONGSON2F
:
45 cpu_clock_freq
= 797000000;
48 cpu_clock_freq
= 100000000;
52 pr_info("CpuClock = %u\n", cpu_clock_freq
);