mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / src / soc / qualcomm / sc7280 / socinfo.c
blob4f207850eeb671e8e76f72af7f0aada526cdc1a4
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <commonlib/helpers.h>
4 #include <console/console.h>
5 #include <device/mmio.h>
6 #include <types.h>
7 #include <soc/socinfo.h>
8 #include <soc/addressmap.h>
10 #define JTAG_OFFSET 0xB1014
12 static struct chipinfo chipinfolut[] = {
13 /* CHIPINFO_ID_SM_KODIAK = 475 */
14 { .jtagid = CHIPINFO_PARTNUM_SM_KODIAK, .modem = 1, .pro = 0 },
15 /* CHIPINFO_ID_SC_KODIAK_CHROME = 487 */
16 { .jtagid = CHIPINFO_PARTNUM_SC_KODIAK_CHROME, .modem = 1, .pro = 0 },
17 /* CHIPINFO_ID_SC_KODIAK_WINDOWS = 488 */
18 { .jtagid = CHIPINFO_PARTNUM_SC_KODIAK_WINDOWS, .modem = 1, .pro = 0 },
19 /* CHIPINFO_ID_QCM_KODIAK = 497 */
20 { .jtagid = CHIPINFO_PARTNUM_QCM_KODIAK, .modem = 1, .pro = 0 },
21 /* CHIPINFO_ID_QCS_KODIAK = 498 */
22 { .jtagid = CHIPINFO_PARTNUM_QCS_KODIAK, .modem = 0, .pro = 0 },
23 /* CHIPINFO_ID_SMP_KODIAK = 499 */
24 { .jtagid = CHIPINFO_PARTNUM_SMP_KODIAK, .modem = 0, .pro = 0 },
25 /* CHIPINFO_ID_SM_KODIAK_LTE_ONLY = 515 */
26 { .jtagid = CHIPINFO_PARTNUM_SM_KODIAK_LTE_ONLY, .modem = 1, .pro = 0 },
27 /* CHIPINFO_ID_SCP_KODIAK = 546 */
28 { .jtagid = CHIPINFO_PARTNUM_SCP_KODIAK, .modem = 0, .pro = 0 },
29 /* CHIPINFO_ID_SC_8CGEN3 = 553 */
30 { .jtagid = CHIPINFO_PARTNUM_SC_8CGEN3, .modem = 1, .pro = 1 },
31 /* CHIPINFO_ID_SCP_8CGEN3 = 563 */
32 { .jtagid = CHIPINFO_PARTNUM_SCP_8CGEN3, .modem = 0, .pro = 1 },
33 /* CHIPINFO_ID_KODIAK_SCP_7CGEN3 = 567 */
34 { .jtagid = CHIPINFO_PARTNUM_KODIAK_SCP_7CGEN3, .modem = 0, .pro = 0 },
35 /* CHIPINFO_ID_QCS_KODIAK_LITE = 575 */
36 { .jtagid = CHIPINFO_PARTNUM_QCS_KODIAK_LITE, .modem = 0, .pro = 0 },
37 /* CHIPINFO_ID_QCM_KODIAK_LITE = 576 */
38 { .jtagid = CHIPINFO_PARTNUM_QCM_KODIAK_LITE, .modem = 0, .pro = 0 },
41 static uint16_t read_jtagid(void)
43 return (read32((void *)(TLMM_TILE_BASE + JTAG_OFFSET)) & DEVICE_ID);
46 static int match_jtagid(uint16_t jtagid)
48 int i;
50 for (i = 0; i < ARRAY_SIZE(chipinfolut); i++)
51 if (chipinfolut[i].jtagid == jtagid)
52 return i;
54 return -1;
57 uint16_t socinfo_modem_supported(void)
59 uint16_t jtagid;
60 int ret;
62 jtagid = read_jtagid();
64 ret = match_jtagid(jtagid);
65 if (ret != -1)
66 return chipinfolut[ret].modem;
68 die("could not match jtagid\n");
71 uint16_t socinfo_pro_part(void)
73 uint16_t jtagid;
74 int ret;
76 jtagid = read_jtagid();
78 ret = match_jtagid(jtagid);
79 if (ret != -1)
80 return chipinfolut[ret].pro;
82 die("could not match jtagid\n");