Taniya Das | 6b81bcd | 2022-07-04 21:02:31 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <assert.h> |
| 4 | #include <commonlib/helpers.h> |
| 5 | #include <device/mmio.h> |
| 6 | #include <types.h> |
| 7 | #include <soc/socinfo.h> |
| 8 | #include <soc/addressmap.h> |
| 9 | |
| 10 | #define JTAG_OFFSET 0xB1014 |
| 11 | |
| 12 | static struct chipinfo chipinfolut[] = { |
| 13 | { CHIPINFO_ID_SM_KODIAK, CHIPINFO_PARTNUM_SM_KODIAK, CHIPINFO_MODEM_SUPPORTED}, |
| 14 | { CHIPINFO_ID_SC_KODIAK_CHROME, CHIPINFO_PARTNUM_SC_KODIAK_CHROME, |
| 15 | CHIPINFO_MODEM_SUPPORTED }, |
| 16 | { CHIPINFO_ID_SC_KODIAK_WINDOWS, CHIPINFO_PARTNUM_SC_KODIAK_WINDOWS, |
| 17 | CHIPINFO_MODEM_SUPPORTED}, |
| 18 | { CHIPINFO_ID_QCM_KODIAK, CHIPINFO_PARTNUM_QCM_KODIAK, CHIPINFO_MODEM_SUPPORTED }, |
| 19 | { CHIPINFO_ID_QCS_KODIAK, CHIPINFO_PARTNUM_QCS_KODIAK, CHIPINFO_MODEM_UNKNOWN }, |
| 20 | { CHIPINFO_ID_SMP_KODIAK, CHIPINFO_PARTNUM_SMP_KODIAK, CHIPINFO_MODEM_UNKNOWN }, |
| 21 | { CHIPINFO_ID_SM_KODIAK_LTE_ONLY, CHIPINFO_PARTNUM_SM_KODIAK_LTE_ONLY, |
| 22 | CHIPINFO_MODEM_SUPPORTED }, |
| 23 | { CHIPINFO_ID_SCP_KODIAK, CHIPINFO_PARTNUM_SCP_KODIAK, CHIPINFO_MODEM_UNKNOWN }, |
| 24 | { CHIPINFO_ID_SC_8CGEN3, CHIPINFO_PARTNUM_SC_8CGEN3, CHIPINFO_MODEM_SUPPORTED }, |
| 25 | { CHIPINFO_ID_SCP_8CGEN3, CHIPINFO_PARTNUM_SCP_8CGEN3, CHIPINFO_MODEM_UNKNOWN }, |
| 26 | { CHIPINFO_ID_KODIAK_SCP_7CGEN3, CHIPINFO_PARTNUM_KODIAK_SCP_7CGEN3, |
| 27 | CHIPINFO_MODEM_UNKNOWN }, |
| 28 | { CHIPINFO_ID_QCS_KODIAK_LITE, CHIPINFO_PARTNUM_QCS_KODIAK_LITE, |
| 29 | CHIPINFO_MODEM_UNKNOWN }, |
| 30 | { CHIPINFO_ID_QCM_KODIAK_LITE, CHIPINFO_PARTNUM_QCM_KODIAK_LITE, |
| 31 | CHIPINFO_MODEM_UNKNOWN }, |
| 32 | }; |
| 33 | |
| 34 | bool socinfo_modem_supported(void) |
| 35 | { |
| 36 | uint32_t jtagid; |
| 37 | int i; |
| 38 | |
| 39 | jtagid = read32((void *)(TLMM_TILE_BASE + JTAG_OFFSET)) & DEVICE_ID; |
| 40 | |
| 41 | for (i = 0; i < ARRAY_SIZE(chipinfolut); i++) |
| 42 | if (chipinfolut[i].jtagid == jtagid) |
| 43 | return chipinfolut[i].modem; |
| 44 | |
| 45 | return false; |
| 46 | } |