4 * System information functions
6 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
8 * Derived from Beagle Board and 3430 SDP code by
9 * Richard Woodruff <r-woodruff2@ti.com>
10 * Syed Mohammed Khasim <khasim@ti.com>
12 * SPDX-License-Identifier: GPL-2.0+
17 #include <asm/arch/sys_proto.h>
18 #include <asm/arch/cpu.h>
19 #include <asm/arch/clock.h>
21 struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
24 * get_cpu_rev(void) - extract rev info
31 id = readl(DEVICE_ID);
32 rev = (id >> 28) & 0xff;
38 * get_cpu_type(void) - extract cpu info
40 u32 get_cpu_type(void)
45 id = readl(DEVICE_ID);
46 partnum = (id >> 12) & 0xffff;
52 * get_board_rev() - setup to pass kernel board revision information
53 * returns:(bit[0-3] sub version, higher bit[7-4] is higher version)
55 u32 get_board_rev(void)
61 * get_device_type(): tell if GP/HS/EMU/TST
63 u32 get_device_type(void)
66 mode = readl(&cstat->statusreg) & DEVICE_MASK;
71 * get_sysboot_value(void) - return SYS_BOOT[4:0]
73 u32 get_sysboot_value(void)
76 mode = readl(&cstat->statusreg) & SYSBOOT_MASK;
80 #ifdef CONFIG_DISPLAY_CPUINFO
81 #define SYSBOOT_FREQ_SHIFT 22
82 #define SYSBOOT_FREQ_MASK (3 << SYSBOOT_FREQ_SHIFT)
84 static unsigned long bootfreqs[] = {
91 static u32 get_sysboot_freq(void)
94 mode = readl(&cstat->statusreg) & SYSBOOT_FREQ_MASK;
95 return bootfreqs[mode >> SYSBOOT_FREQ_SHIFT];
99 * Print CPU information
101 int print_cpuinfo(void)
105 const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP;
107 switch (get_cpu_type()) {
115 cpu_s = "Unknown cpu type";
118 switch (get_device_type()) {
135 printf("%s-%s rev %d\n", cpu_s, sec_s, get_cpu_rev());
137 clk = get_sysboot_freq();
138 printf("OSC clk: %4lu.%03lu MHz\n",
139 clk / 1000000, clk / 1000 % 1000);
140 clk = clk_get_rate(cmwkup, mpu);
141 printf("MPU clk: %4lu.%03lu MHz\n",
142 clk / 1000000, clk / 1000 % 1000);
143 clk = clk_get_rate(cmwkup, ddr);
144 printf("DDR clk: %4lu.%03lu MHz\n",
145 clk / 1000000, clk / 1000 % 1000);
146 clk = clk_get_rate(cmwkup, per);
147 printf("PER clk: %4lu.%03lu MHz\n",
148 clk / 1000000, clk / 1000 % 1000);
150 clk = clk_get_rate(cmwkup, disp);
151 printf("LCD clk: %4lu.%03lu MHz\n",
152 clk / 1000000, clk / 1000 % 1000);
157 #endif /* CONFIG_DISPLAY_CPUINFO */