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 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
20 * GNU General Public License for more details.
25 #include <asm/arch/sys_proto.h>
26 #include <asm/arch/cpu.h>
27 #include <asm/arch/clock.h>
29 static struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
32 * get_cpu_rev(void) - extract rev info
39 id = readl(DEVICE_ID);
40 rev = (id >> 28) & 0xff;
46 * get_cpu_type(void) - extract cpu info
48 u32 get_cpu_type(void)
53 id = readl(DEVICE_ID);
54 partnum = (id >> 12) & 0xffff;
60 * get_board_rev() - setup to pass kernel board revision information
61 * returns:(bit[0-3] sub version, higher bit[7-4] is higher version)
63 u32 get_board_rev(void)
69 * get_device_type(): tell if GP/HS/EMU/TST
71 u32 get_device_type(void)
74 mode = readl(&cstat->statusreg) & DEVICE_MASK;
79 * get_sysboot_value(void) - return SYS_BOOT[4:0]
81 u32 get_sysboot_value(void)
84 mode = readl(&cstat->statusreg) & SYSBOOT_MASK;
88 #define SYSBOOT_FREQ_SHIFT 22
89 #define SYSBOOT_FREQ_MASK (3 << SYSBOOT_FREQ_SHIFT)
91 static unsigned long bootfreqs[] = {
98 u32 get_sysboot_freq(void)
101 mode = readl(&cstat->statusreg) & SYSBOOT_FREQ_MASK;
102 return bootfreqs[mode >> SYSBOOT_FREQ_SHIFT];
105 #ifdef CONFIG_DISPLAY_CPUINFO
107 * Print CPU information
109 int print_cpuinfo(void)
113 const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP;
115 switch (get_cpu_type()) {
120 cpu_s = "Unknown cpu type";
123 switch (get_device_type()) {
140 printf("%s-%s rev %d\n",
141 cpu_s, sec_s, get_cpu_rev());
143 clk = get_sysboot_freq();
144 printf("OSC clk: %4lu.%03lu MHz\n",
145 clk / 1000000, clk / 1000 % 1000);
146 clk = clk_get_rate(cmwkup, mpu);
147 printf("MPU clk: %4lu.%03lu MHz\n",
148 clk / 1000000, clk / 1000 % 1000);
149 clk = clk_get_rate(cmwkup, ddr);
150 printf("DDR clk: %4lu.%03lu MHz\n",
151 clk / 1000000, clk / 1000 % 1000);
152 clk = clk_get_rate(cmwkup, per);
153 printf("PER clk: %4lu.%03lu MHz\n",
154 clk / 1000000, clk / 1000 % 1000);
156 clk = clk_get_rate(cmwkup, disp);
157 printf("LCD clk: %4lu.%03lu MHz\n",
158 clk / 1000000, clk / 1000 % 1000);
163 #endif /* CONFIG_DISPLAY_CPUINFO */