diff --git a/src/soc/qualcomm/sc7280/include/soc/socinfo.h b/src/soc/qualcomm/sc7280/include/soc/socinfo.h index 1034bf95f0..e51d7938bd 100644 --- a/src/soc/qualcomm/sc7280/include/soc/socinfo.h +++ b/src/soc/qualcomm/sc7280/include/soc/socinfo.h @@ -1,31 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/** - Chip identification type. Any new ids must be added to the end. - */ - -typedef enum{ - CHIPINFO_ID_UNKNOWN = 0, - CHIPINFO_ID_SM_KODIAK = 475, - CHIPINFO_ID_SC_KODIAK_CHROME = 487, - CHIPINFO_ID_SC_7CPLUSGEN3 = CHIPINFO_ID_SC_KODIAK_CHROME, - CHIPINFO_ID_SC_KODIAK_WINDOWS = 488, - CHIPINFO_ID_QCM_KODIAK = 497, - CHIPINFO_ID_QCS_KODIAK = 498, - CHIPINFO_ID_SMP_KODIAK = 499, - CHIPINFO_ID_SM_KODIAK_LTE_ONLY = 515, - CHIPINFO_ID_SCP_KODIAK = 546, - CHIPINFO_ID_SCP_7CPLUSGEN3 = CHIPINFO_ID_SCP_KODIAK, - CHIPINFO_ID_SC_8CGEN3 = 553, - CHIPINFO_ID_SCP_8CGEN3 = 563, - CHIPINFO_ID_KODIAK_SCP_7CGEN3 = 567, - CHIPINFO_ID_QCS_KODIAK_LITE = 575, - CHIPINFO_ID_QCM_KODIAK_LITE = 576, - - CHIPINFO_NUM_IDS, - CHIPINFO_ID_32BITS = 0x7FFFFFF - } ChipInfoIdType; - /* * CHIPINFO_PARTNUM_* * @@ -46,14 +20,13 @@ typedef enum{ #define CHIPINFO_PARTNUM_QCM_KODIAK_LITE 0x20E -#define CHIPINFO_MODEM_SUPPORTED 0x1 -#define CHIPINFO_MODEM_UNKNOWN 0x0 #define DEVICE_ID 0xFFFF struct chipinfo { - uint32_t chipid; - uint32_t jtagid; - bool modem; + uint16_t jtagid : 14; + uint16_t modem : 1; + uint16_t pro : 1; }; -bool socinfo_modem_supported(void); +uint16_t socinfo_modem_supported(void); +uint16_t socinfo_pro_part(void); diff --git a/src/soc/qualcomm/sc7280/socinfo.c b/src/soc/qualcomm/sc7280/socinfo.c index 6e66abea67..80462373fb 100644 --- a/src/soc/qualcomm/sc7280/socinfo.c +++ b/src/soc/qualcomm/sc7280/socinfo.c @@ -10,37 +10,75 @@ #define JTAG_OFFSET 0xB1014 static struct chipinfo chipinfolut[] = { - { CHIPINFO_ID_SM_KODIAK, CHIPINFO_PARTNUM_SM_KODIAK, CHIPINFO_MODEM_SUPPORTED}, - { CHIPINFO_ID_SC_KODIAK_CHROME, CHIPINFO_PARTNUM_SC_KODIAK_CHROME, - CHIPINFO_MODEM_SUPPORTED }, - { CHIPINFO_ID_SC_KODIAK_WINDOWS, CHIPINFO_PARTNUM_SC_KODIAK_WINDOWS, - CHIPINFO_MODEM_SUPPORTED}, - { CHIPINFO_ID_QCM_KODIAK, CHIPINFO_PARTNUM_QCM_KODIAK, CHIPINFO_MODEM_SUPPORTED }, - { CHIPINFO_ID_QCS_KODIAK, CHIPINFO_PARTNUM_QCS_KODIAK, CHIPINFO_MODEM_UNKNOWN }, - { CHIPINFO_ID_SMP_KODIAK, CHIPINFO_PARTNUM_SMP_KODIAK, CHIPINFO_MODEM_UNKNOWN }, - { CHIPINFO_ID_SM_KODIAK_LTE_ONLY, CHIPINFO_PARTNUM_SM_KODIAK_LTE_ONLY, - CHIPINFO_MODEM_SUPPORTED }, - { CHIPINFO_ID_SCP_KODIAK, CHIPINFO_PARTNUM_SCP_KODIAK, CHIPINFO_MODEM_UNKNOWN }, - { CHIPINFO_ID_SC_8CGEN3, CHIPINFO_PARTNUM_SC_8CGEN3, CHIPINFO_MODEM_SUPPORTED }, - { CHIPINFO_ID_SCP_8CGEN3, CHIPINFO_PARTNUM_SCP_8CGEN3, CHIPINFO_MODEM_UNKNOWN }, - { CHIPINFO_ID_KODIAK_SCP_7CGEN3, CHIPINFO_PARTNUM_KODIAK_SCP_7CGEN3, - CHIPINFO_MODEM_UNKNOWN }, - { CHIPINFO_ID_QCS_KODIAK_LITE, CHIPINFO_PARTNUM_QCS_KODIAK_LITE, - CHIPINFO_MODEM_UNKNOWN }, - { CHIPINFO_ID_QCM_KODIAK_LITE, CHIPINFO_PARTNUM_QCM_KODIAK_LITE, - CHIPINFO_MODEM_UNKNOWN }, + /* CHIPINFO_ID_SM_KODIAK = 475 */ + { .jtagid = CHIPINFO_PARTNUM_SM_KODIAK, .modem = 1, .pro = 0 }, + /* CHIPINFO_ID_SC_KODIAK_CHROME = 487 */ + { .jtagid = CHIPINFO_PARTNUM_SC_KODIAK_CHROME, .modem = 1, .pro = 0 }, + /* CHIPINFO_ID_SC_KODIAK_WINDOWS = 488 */ + { .jtagid = CHIPINFO_PARTNUM_SC_KODIAK_WINDOWS, .modem = 1, .pro = 0 }, + /* CHIPINFO_ID_QCM_KODIAK = 497 */ + { .jtagid = CHIPINFO_PARTNUM_QCM_KODIAK, .modem = 1, .pro = 0 }, + /* CHIPINFO_ID_QCS_KODIAK = 498 */ + { .jtagid = CHIPINFO_PARTNUM_QCS_KODIAK, .modem = 0, .pro = 0 }, + /* CHIPINFO_ID_SMP_KODIAK = 499 */ + { .jtagid = CHIPINFO_PARTNUM_SMP_KODIAK, .modem = 0, .pro = 0 }, + /* CHIPINFO_ID_SM_KODIAK_LTE_ONLY = 515 */ + { .jtagid = CHIPINFO_PARTNUM_SM_KODIAK_LTE_ONLY, .modem = 1, .pro = 0 }, + /* CHIPINFO_ID_SCP_KODIAK = 546 */ + { .jtagid = CHIPINFO_PARTNUM_SCP_KODIAK, .modem = 0, .pro = 0 }, + /* CHIPINFO_ID_SC_8CGEN3 = 553 */ + { .jtagid = CHIPINFO_PARTNUM_SC_8CGEN3, .modem = 1, .pro = 1 }, + /* CHIPINFO_ID_SCP_8CGEN3 = 563 */ + { .jtagid = CHIPINFO_PARTNUM_SCP_8CGEN3, .modem = 0, .pro = 1 }, + /* CHIPINFO_ID_KODIAK_SCP_7CGEN3 = 567 */ + { .jtagid = CHIPINFO_PARTNUM_KODIAK_SCP_7CGEN3, .modem = 0, .pro = 0 }, + /* CHIPINFO_ID_QCS_KODIAK_LITE = 575 */ + { .jtagid = CHIPINFO_PARTNUM_QCS_KODIAK_LITE, .modem = 0, .pro = 0 }, + /* CHIPINFO_ID_QCM_KODIAK_LITE = 576 */ + { .jtagid = CHIPINFO_PARTNUM_QCM_KODIAK_LITE, .modem = 0, .pro = 0 }, }; -bool socinfo_modem_supported(void) +static uint16_t read_jtagid(void) { - uint32_t jtagid; - int i; + return (read32((void *)(TLMM_TILE_BASE + JTAG_OFFSET)) & DEVICE_ID); +} - jtagid = read32((void *)(TLMM_TILE_BASE + JTAG_OFFSET)) & DEVICE_ID; +static int match_jtagid(uint16_t jtagid) +{ + int i; for (i = 0; i < ARRAY_SIZE(chipinfolut); i++) if (chipinfolut[i].jtagid == jtagid) - return chipinfolut[i].modem; + return i; + + return -1; +} + +uint16_t socinfo_modem_supported(void) +{ + uint16_t jtagid; + int ret; + + jtagid = read_jtagid(); + + ret = match_jtagid(jtagid); + if (ret != -1) + return chipinfolut[ret].modem; + + die("could not match jtagid\n"); +} + +uint16_t socinfo_pro_part(void) +{ + uint16_t jtagid; + int ret; + + jtagid = read_jtagid(); + + ret = match_jtagid(jtagid); + if (ret != -1) + return chipinfolut[ret].pro; + + die("could not match jtagid\n"); - return false; }