]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/cpu/armv7/am33xx/sys_info.c
Licenses: introduce SPDX Unique Lincense Identifiers
[people/ms/u-boot.git] / arch / arm / cpu / armv7 / am33xx / sys_info.c
CommitLineData
5655108a
CN
1/*
2 * sys_info.c
3 *
4 * System information functions
5 *
6 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
7 *
8 * Derived from Beagle Board and 3430 SDP code by
9 * Richard Woodruff <r-woodruff2@ti.com>
10 * Syed Mohammed Khasim <khasim@ti.com>
11 *
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.
16 *
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.
21 */
22
23#include <common.h>
24#include <asm/io.h>
25#include <asm/arch/sys_proto.h>
26#include <asm/arch/cpu.h>
27#include <asm/arch/clock.h>
28
29struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
30
31/**
32 * get_cpu_rev(void) - extract rev info
33 */
34u32 get_cpu_rev(void)
35{
36 u32 id;
37 u32 rev;
38
39 id = readl(DEVICE_ID);
40 rev = (id >> 28) & 0xff;
41
42 return rev;
43}
44
45/**
46 * get_cpu_type(void) - extract cpu info
47 */
48u32 get_cpu_type(void)
49{
50 u32 id = 0;
51 u32 partnum;
52
53 id = readl(DEVICE_ID);
54 partnum = (id >> 12) & 0xffff;
55
56 return partnum;
57}
58
59/**
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)
62 */
63u32 get_board_rev(void)
64{
65 return BOARD_REV_ID;
66}
67
68/**
69 * get_device_type(): tell if GP/HS/EMU/TST
70 */
71u32 get_device_type(void)
72{
73 int mode;
74 mode = readl(&cstat->statusreg) & (DEVICE_MASK);
75 return mode >>= 8;
76}
77
78/**
79 * get_sysboot_value(void) - return SYS_BOOT[4:0]
80 */
81u32 get_sysboot_value(void)
82{
83 int mode;
84 mode = readl(&cstat->statusreg) & (SYSBOOT_MASK);
85 return mode;
86}
87
88#ifdef CONFIG_DISPLAY_CPUINFO
89/**
90 * Print CPU information
91 */
92int print_cpuinfo(void)
93{
94 char *cpu_s, *sec_s;
5655108a
CN
95
96 switch (get_cpu_type()) {
97 case AM335X:
98 cpu_s = "AM335X";
99 break;
8b029f22
MP
100 case TI81XX:
101 cpu_s = "TI81XX";
102 break;
5655108a
CN
103 default:
104 cpu_s = "Unknown cpu type";
105 break;
106 }
107
108 switch (get_device_type()) {
109 case TST_DEVICE:
110 sec_s = "TST";
111 break;
112 case EMU_DEVICE:
113 sec_s = "EMU";
114 break;
115 case HS_DEVICE:
116 sec_s = "HS";
117 break;
118 case GP_DEVICE:
119 sec_s = "GP";
120 break;
121 default:
122 sec_s = "?";
123 }
124
30bba017 125 printf("%s-%s rev %d\n", cpu_s, sec_s, get_cpu_rev());
5655108a
CN
126
127 return 0;
128}
129#endif /* CONFIG_DISPLAY_CPUINFO */