1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <commonlib/helpers.h>
5 #include <console/console.h>
6 #include <device/mmio.h>
8 #include <soc/socinfo.h>
9 #include <soc/addressmap.h>
11 #define JTAG_OFFSET 0xB1014
13 static struct chipinfo chipinfolut
[] = {
14 /* CHIPINFO_ID_SM_KODIAK = 475 */
15 { .jtagid
= CHIPINFO_PARTNUM_SM_KODIAK
, .modem
= 1, .pro
= 0 },
16 /* CHIPINFO_ID_SC_KODIAK_CHROME = 487 */
17 { .jtagid
= CHIPINFO_PARTNUM_SC_KODIAK_CHROME
, .modem
= 1, .pro
= 0 },
18 /* CHIPINFO_ID_SC_KODIAK_WINDOWS = 488 */
19 { .jtagid
= CHIPINFO_PARTNUM_SC_KODIAK_WINDOWS
, .modem
= 1, .pro
= 0 },
20 /* CHIPINFO_ID_QCM_KODIAK = 497 */
21 { .jtagid
= CHIPINFO_PARTNUM_QCM_KODIAK
, .modem
= 1, .pro
= 0 },
22 /* CHIPINFO_ID_QCS_KODIAK = 498 */
23 { .jtagid
= CHIPINFO_PARTNUM_QCS_KODIAK
, .modem
= 0, .pro
= 0 },
24 /* CHIPINFO_ID_SMP_KODIAK = 499 */
25 { .jtagid
= CHIPINFO_PARTNUM_SMP_KODIAK
, .modem
= 0, .pro
= 0 },
26 /* CHIPINFO_ID_SM_KODIAK_LTE_ONLY = 515 */
27 { .jtagid
= CHIPINFO_PARTNUM_SM_KODIAK_LTE_ONLY
, .modem
= 1, .pro
= 0 },
28 /* CHIPINFO_ID_SCP_KODIAK = 546 */
29 { .jtagid
= CHIPINFO_PARTNUM_SCP_KODIAK
, .modem
= 0, .pro
= 0 },
30 /* CHIPINFO_ID_SC_8CGEN3 = 553 */
31 { .jtagid
= CHIPINFO_PARTNUM_SC_8CGEN3
, .modem
= 1, .pro
= 1 },
32 /* CHIPINFO_ID_SCP_8CGEN3 = 563 */
33 { .jtagid
= CHIPINFO_PARTNUM_SCP_8CGEN3
, .modem
= 0, .pro
= 1 },
34 /* CHIPINFO_ID_KODIAK_SCP_7CGEN3 = 567 */
35 { .jtagid
= CHIPINFO_PARTNUM_KODIAK_SCP_7CGEN3
, .modem
= 0, .pro
= 0 },
36 /* CHIPINFO_ID_QCS_KODIAK_LITE = 575 */
37 { .jtagid
= CHIPINFO_PARTNUM_QCS_KODIAK_LITE
, .modem
= 0, .pro
= 0 },
38 /* CHIPINFO_ID_QCM_KODIAK_LITE = 576 */
39 { .jtagid
= CHIPINFO_PARTNUM_QCM_KODIAK_LITE
, .modem
= 0, .pro
= 0 },
42 static uint16_t read_jtagid(void)
44 return (read32((void *)(TLMM_TILE_BASE
+ JTAG_OFFSET
)) & DEVICE_ID
);
47 static int match_jtagid(uint16_t jtagid
)
51 for (i
= 0; i
< ARRAY_SIZE(chipinfolut
); i
++)
52 if (chipinfolut
[i
].jtagid
== jtagid
)
58 uint16_t socinfo_modem_supported(void)
63 jtagid
= read_jtagid();
65 ret
= match_jtagid(jtagid
);
67 return chipinfolut
[ret
].modem
;
69 die("could not match jtagid\n");
72 uint16_t socinfo_pro_part(void)
77 jtagid
= read_jtagid();
79 ret
= match_jtagid(jtagid
);
81 return chipinfolut
[ret
].pro
;
83 die("could not match jtagid\n");