]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/cpu/armv7/am33xx/sys_info.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[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 *
1a459660 12 * SPDX-License-Identifier: GPL-2.0+
5655108a
CN
13 */
14
15#include <common.h>
16#include <asm/io.h>
17#include <asm/arch/sys_proto.h>
18#include <asm/arch/cpu.h>
19#include <asm/arch/clock.h>
20
21struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
22
23/**
24 * get_cpu_rev(void) - extract rev info
25 */
26u32 get_cpu_rev(void)
27{
28 u32 id;
29 u32 rev;
30
31 id = readl(DEVICE_ID);
32 rev = (id >> 28) & 0xff;
33
34 return rev;
35}
36
37/**
38 * get_cpu_type(void) - extract cpu info
39 */
40u32 get_cpu_type(void)
41{
42 u32 id = 0;
43 u32 partnum;
44
45 id = readl(DEVICE_ID);
46 partnum = (id >> 12) & 0xffff;
47
48 return partnum;
49}
50
51/**
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)
54 */
55u32 get_board_rev(void)
56{
57 return BOARD_REV_ID;
58}
59
60/**
61 * get_device_type(): tell if GP/HS/EMU/TST
62 */
63u32 get_device_type(void)
64{
65 int mode;
66 mode = readl(&cstat->statusreg) & (DEVICE_MASK);
67 return mode >>= 8;
68}
69
70/**
71 * get_sysboot_value(void) - return SYS_BOOT[4:0]
72 */
73u32 get_sysboot_value(void)
74{
75 int mode;
76 mode = readl(&cstat->statusreg) & (SYSBOOT_MASK);
77 return mode;
78}
79
80#ifdef CONFIG_DISPLAY_CPUINFO
81/**
82 * Print CPU information
83 */
84int print_cpuinfo(void)
85{
86 char *cpu_s, *sec_s;
5655108a
CN
87
88 switch (get_cpu_type()) {
89 case AM335X:
90 cpu_s = "AM335X";
91 break;
8b029f22
MP
92 case TI81XX:
93 cpu_s = "TI81XX";
94 break;
5655108a
CN
95 default:
96 cpu_s = "Unknown cpu type";
97 break;
98 }
99
100 switch (get_device_type()) {
101 case TST_DEVICE:
102 sec_s = "TST";
103 break;
104 case EMU_DEVICE:
105 sec_s = "EMU";
106 break;
107 case HS_DEVICE:
108 sec_s = "HS";
109 break;
110 case GP_DEVICE:
111 sec_s = "GP";
112 break;
113 default:
114 sec_s = "?";
115 }
116
30bba017 117 printf("%s-%s rev %d\n", cpu_s, sec_s, get_cpu_rev());
5655108a
CN
118
119 return 0;
120}
121#endif /* CONFIG_DISPLAY_CPUINFO */