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>
20 #include <power/tps65910.h>
21 #include <linux/compiler.h>
23 struct ctrl_stat *cstat = (struct ctrl_stat *)CTRL_BASE;
26 * get_cpu_rev(void) - extract rev info
33 id = readl(DEVICE_ID);
34 rev = (id >> 28) & 0xff;
40 * get_cpu_type(void) - extract cpu info
42 u32 get_cpu_type(void)
47 id = readl(DEVICE_ID);
48 partnum = (id >> 12) & 0xffff;
54 * get_device_type(): tell if GP/HS/EMU/TST
56 u32 get_device_type(void)
59 mode = readl(&cstat->statusreg) & (DEVICE_MASK);
64 * get_sysboot_value(void) - return SYS_BOOT[4:0]
66 u32 get_sysboot_value(void)
68 return readl(&cstat->statusreg) & SYSBOOT_MASK;
71 #ifdef CONFIG_DISPLAY_CPUINFO
72 static char *cpu_revs[] = {
77 static char *cpu_revs_am43xx[] = {
82 static char *dev_types[] = {
89 * Print CPU information
91 int print_cpuinfo(void)
93 char *cpu_s, *sec_s, *rev_s;
94 char **cpu_rev_arr = cpu_revs;
96 switch (get_cpu_type()) {
105 cpu_rev_arr = cpu_revs_am43xx;
108 cpu_s = "Unknown CPU type";
112 if (get_cpu_rev() < ARRAY_SIZE(cpu_revs))
113 rev_s = cpu_rev_arr[get_cpu_rev()];
117 if (get_device_type() < ARRAY_SIZE(dev_types))
118 sec_s = dev_types[get_device_type()];
122 printf("CPU : %s-%s rev %s\n", cpu_s, sec_s, rev_s);
126 #endif /* CONFIG_DISPLAY_CPUINFO */
129 int am335x_get_efuse_mpu_max_freq(struct ctrl_dev *cdev)
133 sil_rev = readl(&cdev->deviceid) >> 28;
136 /* No efuse in PG 1.0. Use max speed */
138 } else if (sil_rev >= 1) {
139 /* Check what the efuse says our max speed is. */
140 int efuse_arm_mpu_max_freq, package_type;
141 efuse_arm_mpu_max_freq = readl(&cdev->efuse_sma);
142 package_type = (efuse_arm_mpu_max_freq & PACKAGE_TYPE_MASK) >>
145 /* PG 2.0, efuse may not be set. */
146 if (package_type == PACKAGE_TYPE_UNDEFINED || package_type ==
147 PACKAGE_TYPE_RESERVED)
150 switch ((efuse_arm_mpu_max_freq & DEVICE_ID_MASK)) {
151 case AM335X_ZCZ_1000:
152 return MPUPLL_M_1000;
166 /* unknown, use the PG1.0 max */
170 int am335x_get_tps65910_mpu_vdd(int sil_rev, int frequency)
172 /* For PG2.0 and later, we have one set of values. */
176 return TPS65910_OP_REG_SEL_1_3_2_5;
178 return TPS65910_OP_REG_SEL_1_2_6;
180 return TPS65910_OP_REG_SEL_1_2_0;
184 return TPS65910_OP_REG_SEL_1_1_0;
188 /* Default to PG1.0 values. */
189 return TPS65910_OP_REG_SEL_1_2_6;