Bhargav Gurappadi | a9e6ab4 | 2016-08-01 23:35:54 -0700 | [diff] [blame] | 1 | /* |
Jingbiao Lu | 2107434 | 2018-01-10 15:54:54 +0800 | [diff] [blame] | 2 | * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved. |
Bhargav Gurappadi | a9e6ab4 | 2016-08-01 23:35:54 -0700 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef _ARCH_ARM_MACH_MSM_SOCINFO_H_ |
| 16 | #define _ARCH_ARM_MACH_MSM_SOCINFO_H_ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/errno.h> |
| 21 | #include <linux/of_fdt.h> |
| 22 | #include <linux/of.h> |
| 23 | |
| 24 | #include <asm/cputype.h> |
| 25 | /* |
| 26 | * SOC version type with major number in the upper 16 bits and minor |
| 27 | * number in the lower 16 bits. For example: |
| 28 | * 1.0 -> 0x00010000 |
| 29 | * 2.3 -> 0x00020003 |
| 30 | */ |
| 31 | #define SOCINFO_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) |
| 32 | #define SOCINFO_VERSION_MINOR(ver) ((ver) & 0x0000ffff) |
| 33 | #define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff)) |
| 34 | |
| 35 | #ifdef CONFIG_OF |
| 36 | #define of_board_is_cdp() of_machine_is_compatible("qcom,cdp") |
| 37 | #define of_board_is_sim() of_machine_is_compatible("qcom,sim") |
| 38 | #define of_board_is_rumi() of_machine_is_compatible("qcom,rumi") |
| 39 | #define of_board_is_fluid() of_machine_is_compatible("qcom,fluid") |
| 40 | #define of_board_is_liquid() of_machine_is_compatible("qcom,liquid") |
| 41 | #define of_board_is_dragonboard() \ |
| 42 | of_machine_is_compatible("qcom,dragonboard") |
| 43 | #define of_board_is_cdp() of_machine_is_compatible("qcom,cdp") |
| 44 | #define of_board_is_mtp() of_machine_is_compatible("qcom,mtp") |
| 45 | #define of_board_is_qrd() of_machine_is_compatible("qcom,qrd") |
| 46 | #define of_board_is_xpm() of_machine_is_compatible("qcom,xpm") |
| 47 | #define of_board_is_skuf() of_machine_is_compatible("qcom,skuf") |
| 48 | #define of_board_is_sbc() of_machine_is_compatible("qcom,sbc") |
| 49 | |
| 50 | #define machine_is_msm8974() of_machine_is_compatible("qcom,msm8974") |
| 51 | #define machine_is_msm9625() of_machine_is_compatible("qcom,msm9625") |
| 52 | #define machine_is_msm8610() of_machine_is_compatible("qcom,msm8610") |
| 53 | #define machine_is_msm8226() of_machine_is_compatible("qcom,msm8226") |
| 54 | #define machine_is_apq8074() of_machine_is_compatible("qcom,apq8074") |
| 55 | #define machine_is_msm8926() of_machine_is_compatible("qcom,msm8926") |
| 56 | |
| 57 | #define early_machine_is_msm8610() \ |
| 58 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8610") |
| 59 | #define early_machine_is_msm8909() \ |
| 60 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8909") |
| 61 | #define early_machine_is_msm8916() \ |
| 62 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8916") |
| 63 | #define early_machine_is_msm8936() \ |
| 64 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8936") |
| 65 | #define early_machine_is_msm8939() \ |
| 66 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8939") |
| 67 | #define early_machine_is_apq8084() \ |
| 68 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,apq8084") |
| 69 | #define early_machine_is_mdm9630() \ |
| 70 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,mdm9630") |
| 71 | #define early_machine_is_msmzirc() \ |
| 72 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmzirc") |
| 73 | #define early_machine_is_fsm9900() \ |
| 74 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,fsm9900") |
| 75 | #define early_machine_is_msm8994() \ |
| 76 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8994") |
| 77 | #define early_machine_is_msm8992() \ |
| 78 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8992") |
| 79 | #define early_machine_is_fsm9010() \ |
| 80 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,fsm9010") |
| 81 | #define early_machine_is_msm8976() \ |
| 82 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8976") |
| 83 | #define early_machine_is_msmtellurium() \ |
| 84 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmtellurium") |
| 85 | #define early_machine_is_msm8996() \ |
| 86 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8996") |
| 87 | #define early_machine_is_msm8996_auto() \ |
| 88 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8996-cdp") |
| 89 | #define early_machine_is_msm8929() \ |
| 90 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8929") |
| 91 | #define early_machine_is_msmcobalt() \ |
| 92 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmcobalt") |
| 93 | #define early_machine_is_apqcobalt() \ |
| 94 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,apqcobalt") |
| 95 | #define early_machine_is_msmhamster() \ |
| 96 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmhamster") |
| 97 | #define early_machine_is_msmfalcon() \ |
| 98 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmfalcon") |
Runmin Wang | 88a6fcb | 2017-04-19 15:28:07 -0700 | [diff] [blame] | 99 | #define early_machine_is_sdxpoorwills() \ |
| 100 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdxpoorwills") |
Kyle Yan | 6a20fae | 2017-02-14 13:34:41 -0800 | [diff] [blame] | 101 | #define early_machine_is_sdm845() \ |
| 102 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm845") |
Imran Khan | 04f0831 | 2017-03-30 15:07:43 +0530 | [diff] [blame] | 103 | #define early_machine_is_sdm670() \ |
| 104 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm670") |
Kaushal Kumar | 9809470 | 2017-09-18 13:00:08 +0530 | [diff] [blame] | 105 | #define early_machine_is_qcs605() \ |
| 106 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs605") |
Kaushal Kumar | a7de06d | 2017-09-18 16:53:53 +0530 | [diff] [blame] | 107 | #define early_machine_is_sda670() \ |
| 108 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda670") |
Kaushal Kumar | bf346d5 | 2018-03-16 15:06:39 +0530 | [diff] [blame] | 109 | #define early_machine_is_sdm710() \ |
| 110 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm670") |
Srinivas Ramana | b95fcfd | 2017-09-07 15:57:22 +0530 | [diff] [blame] | 111 | #define early_machine_is_msm8953() \ |
| 112 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8953") |
Jingbiao Lu | 2107434 | 2018-01-10 15:54:54 +0800 | [diff] [blame] | 113 | #define early_machine_is_msm8937() \ |
| 114 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8937") |
Abinaya P | a28c903 | 2018-03-18 10:48:17 +0530 | [diff] [blame] | 115 | #define early_machine_is_mdm9607() \ |
| 116 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,mdm9607") |
Maria Yu | 9bf05cc | 2017-09-28 16:23:51 +0800 | [diff] [blame] | 117 | #define early_machine_is_sdm450() \ |
| 118 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm450") |
Maria Yu | 06dc21e | 2017-12-22 13:03:53 +0800 | [diff] [blame] | 119 | #define early_machine_is_sdm632() \ |
| 120 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm632") |
Jingbiao Lu | 6c7a3bd | 2018-01-31 17:08:12 +0800 | [diff] [blame] | 121 | #define early_machine_is_sdm439() \ |
| 122 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm439") |
| 123 | #define early_machine_is_sdm429() \ |
| 124 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm429") |
Tingwei Zhang | 89b9927 | 2018-04-12 13:14:36 +0800 | [diff] [blame] | 125 | #define early_machine_is_sda439() \ |
| 126 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda439") |
| 127 | #define early_machine_is_sda429() \ |
| 128 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda429") |
Abinaya P | b444e83 | 2018-03-08 12:45:23 +0530 | [diff] [blame] | 129 | #define early_machine_is_mdm9650() \ |
| 130 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,mdm9650") |
Bhargav Gurappadi | a9e6ab4 | 2016-08-01 23:35:54 -0700 | [diff] [blame] | 131 | #else |
| 132 | #define of_board_is_sim() 0 |
| 133 | #define of_board_is_rumi() 0 |
| 134 | #define of_board_is_fluid() 0 |
| 135 | #define of_board_is_liquid() 0 |
| 136 | #define of_board_is_dragonboard() 0 |
| 137 | #define of_board_is_cdp() 0 |
| 138 | #define of_board_is_mtp() 0 |
| 139 | #define of_board_is_qrd() 0 |
| 140 | #define of_board_is_xpm() 0 |
| 141 | #define of_board_is_skuf() 0 |
| 142 | #define of_board_is_sbc() 0 |
| 143 | |
| 144 | #define machine_is_msm8974() 0 |
| 145 | #define machine_is_msm9625() 0 |
| 146 | #define machine_is_msm8610() 0 |
| 147 | #define machine_is_msm8226() 0 |
| 148 | #define machine_is_apq8074() 0 |
| 149 | #define machine_is_msm8926() 0 |
| 150 | |
| 151 | #define early_machine_is_msm8610() 0 |
| 152 | #define early_machine_is_msm8909() 0 |
| 153 | #define early_machine_is_msm8916() 0 |
| 154 | #define early_machine_is_msm8936() 0 |
| 155 | #define early_machine_is_msm8939() 0 |
| 156 | #define early_machine_is_apq8084() 0 |
| 157 | #define early_machine_is_mdm9630() 0 |
| 158 | #define early_machine_is_fsm9900() 0 |
| 159 | #define early_machine_is_fsm9010() 0 |
| 160 | #define early_machine_is_msmtellurium() 0 |
| 161 | #define early_machine_is_msm8996() 0 |
| 162 | #define early_machine_is_msm8976() 0 |
| 163 | #define early_machine_is_msm8929() 0 |
| 164 | #define early_machine_is_msmcobalt() 0 |
| 165 | #define early_machine_is_apqcobalt() 0 |
| 166 | #define early_machine_is_msmhamster() 0 |
| 167 | #define early_machine_is_msmfalcon() 0 |
Abinaya P | a28c903 | 2018-03-18 10:48:17 +0530 | [diff] [blame] | 168 | #define early_machine_is_mdm9607() 0 |
Runmin Wang | 88a6fcb | 2017-04-19 15:28:07 -0700 | [diff] [blame] | 169 | #define early_machine_is_sdxpoorwills() 0 |
Kyle Yan | 6a20fae | 2017-02-14 13:34:41 -0800 | [diff] [blame] | 170 | #define early_machine_is_sdm845() 0 |
Imran Khan | 04f0831 | 2017-03-30 15:07:43 +0530 | [diff] [blame] | 171 | #define early_machine_is_sdm670() 0 |
Kaushal Kumar | 9809470 | 2017-09-18 13:00:08 +0530 | [diff] [blame] | 172 | #define early_machine_is_qcs605() 0 |
Kaushal Kumar | a7de06d | 2017-09-18 16:53:53 +0530 | [diff] [blame] | 173 | #define early_machine_is_sda670() 0 |
Kaushal Kumar | bf346d5 | 2018-03-16 15:06:39 +0530 | [diff] [blame] | 174 | #define early_machine_is_sdm710() 0 |
Srinivas Ramana | b95fcfd | 2017-09-07 15:57:22 +0530 | [diff] [blame] | 175 | #define early_machine_is_msm8953() 0 |
Jingbiao Lu | 2107434 | 2018-01-10 15:54:54 +0800 | [diff] [blame] | 176 | #define early_machine_is_msm8937() 0 |
Maria Yu | 9bf05cc | 2017-09-28 16:23:51 +0800 | [diff] [blame] | 177 | #define early_machine_is_sdm450() 0 |
Maria Yu | 06dc21e | 2017-12-22 13:03:53 +0800 | [diff] [blame] | 178 | #define early_machine_is_sdm632() 0 |
Jingbiao Lu | 6c7a3bd | 2018-01-31 17:08:12 +0800 | [diff] [blame] | 179 | #define early_machine_is_sdm439() 0 |
| 180 | #define early_machine_is_sdm429() 0 |
Tingwei Zhang | 89b9927 | 2018-04-12 13:14:36 +0800 | [diff] [blame] | 181 | #define early_machine_is_sda439() 0 |
| 182 | #define early_machine_is_sda429() 0 |
Abinaya P | b444e83 | 2018-03-08 12:45:23 +0530 | [diff] [blame] | 183 | #define early_machine_is_mdm9650() 0 |
Bhargav Gurappadi | a9e6ab4 | 2016-08-01 23:35:54 -0700 | [diff] [blame] | 184 | #endif |
| 185 | |
| 186 | #define PLATFORM_SUBTYPE_MDM 1 |
| 187 | #define PLATFORM_SUBTYPE_INTERPOSERV3 2 |
| 188 | #define PLATFORM_SUBTYPE_SGLTE 6 |
| 189 | |
| 190 | enum msm_cpu { |
| 191 | MSM_CPU_UNKNOWN = 0, |
| 192 | MSM_CPU_7X01, |
| 193 | MSM_CPU_7X25, |
| 194 | MSM_CPU_7X27, |
| 195 | MSM_CPU_8X50, |
| 196 | MSM_CPU_8X50A, |
| 197 | MSM_CPU_7X30, |
| 198 | MSM_CPU_8X55, |
| 199 | MSM_CPU_8X60, |
| 200 | MSM_CPU_8960, |
| 201 | MSM_CPU_8960AB, |
| 202 | MSM_CPU_7X27A, |
| 203 | FSM_CPU_9XXX, |
| 204 | MSM_CPU_7X25A, |
| 205 | MSM_CPU_7X25AA, |
| 206 | MSM_CPU_7X25AB, |
| 207 | MSM_CPU_8064, |
| 208 | MSM_CPU_8064AB, |
| 209 | MSM_CPU_8064AA, |
| 210 | MSM_CPU_8930, |
| 211 | MSM_CPU_8930AA, |
| 212 | MSM_CPU_8930AB, |
| 213 | MSM_CPU_7X27AA, |
| 214 | MSM_CPU_9615, |
| 215 | MSM_CPU_8974, |
| 216 | MSM_CPU_8974PRO_AA, |
| 217 | MSM_CPU_8974PRO_AB, |
| 218 | MSM_CPU_8974PRO_AC, |
| 219 | MSM_CPU_8627, |
| 220 | MSM_CPU_8625, |
| 221 | MSM_CPU_9625, |
| 222 | MSM_CPU_8909, |
| 223 | MSM_CPU_8916, |
| 224 | MSM_CPU_8936, |
| 225 | MSM_CPU_8939, |
| 226 | MSM_CPU_8226, |
| 227 | MSM_CPU_8610, |
| 228 | MSM_CPU_8625Q, |
| 229 | MSM_CPU_8084, |
| 230 | MSM_CPU_9630, |
| 231 | FSM_CPU_9900, |
| 232 | MSM_CPU_ZIRC, |
| 233 | MSM_CPU_8994, |
| 234 | MSM_CPU_8992, |
| 235 | FSM_CPU_9010, |
| 236 | MSM_CPU_TELLURIUM, |
| 237 | MSM_CPU_8996, |
| 238 | MSM_CPU_8976, |
| 239 | MSM_CPU_8929, |
| 240 | MSM_CPU_COBALT, |
| 241 | MSM_CPU_HAMSTER, |
| 242 | MSM_CPU_FALCON, |
Runmin Wang | 88a6fcb | 2017-04-19 15:28:07 -0700 | [diff] [blame] | 243 | SDX_CPU_SDXPOORWILLS, |
Kyle Yan | 6a20fae | 2017-02-14 13:34:41 -0800 | [diff] [blame] | 244 | MSM_CPU_SDM845, |
Imran Khan | 04f0831 | 2017-03-30 15:07:43 +0530 | [diff] [blame] | 245 | MSM_CPU_SDM670, |
Kaushal Kumar | 9809470 | 2017-09-18 13:00:08 +0530 | [diff] [blame] | 246 | MSM_CPU_QCS605, |
Kaushal Kumar | a7de06d | 2017-09-18 16:53:53 +0530 | [diff] [blame] | 247 | MSM_CPU_SDA670, |
Kaushal Kumar | bf346d5 | 2018-03-16 15:06:39 +0530 | [diff] [blame] | 248 | MSM_CPU_SDM710, |
Srinivas Ramana | b95fcfd | 2017-09-07 15:57:22 +0530 | [diff] [blame] | 249 | MSM_CPU_8953, |
Maria Yu | 9bf05cc | 2017-09-28 16:23:51 +0800 | [diff] [blame] | 250 | MSM_CPU_SDM450, |
Maria Yu | 06dc21e | 2017-12-22 13:03:53 +0800 | [diff] [blame] | 251 | MSM_CPU_SDM632, |
| 252 | MSM_CPU_SDA632, |
Jingbiao Lu | 6c7a3bd | 2018-01-31 17:08:12 +0800 | [diff] [blame] | 253 | MSM_CPU_8937, |
Abinaya P | a28c903 | 2018-03-18 10:48:17 +0530 | [diff] [blame] | 254 | MSM_CPU_9607, |
Jingbiao Lu | 6c7a3bd | 2018-01-31 17:08:12 +0800 | [diff] [blame] | 255 | MSM_CPU_SDM439, |
| 256 | MSM_CPU_SDM429, |
Tingwei Zhang | 89b9927 | 2018-04-12 13:14:36 +0800 | [diff] [blame] | 257 | MSM_CPU_SDA439, |
| 258 | MSM_CPU_SDA429, |
Abinaya P | b444e83 | 2018-03-08 12:45:23 +0530 | [diff] [blame] | 259 | MSM_CPU_9650, |
Bhargav Gurappadi | a9e6ab4 | 2016-08-01 23:35:54 -0700 | [diff] [blame] | 260 | }; |
| 261 | |
| 262 | struct msm_soc_info { |
| 263 | enum msm_cpu generic_soc_type; |
| 264 | char *soc_id_string; |
| 265 | }; |
| 266 | |
| 267 | enum pmic_model { |
| 268 | PMIC_MODEL_PM8058 = 13, |
| 269 | PMIC_MODEL_PM8028 = 14, |
| 270 | PMIC_MODEL_PM8901 = 15, |
| 271 | PMIC_MODEL_PM8027 = 16, |
| 272 | PMIC_MODEL_ISL_9519 = 17, |
| 273 | PMIC_MODEL_PM8921 = 18, |
| 274 | PMIC_MODEL_PM8018 = 19, |
| 275 | PMIC_MODEL_PM8015 = 20, |
| 276 | PMIC_MODEL_PM8014 = 21, |
| 277 | PMIC_MODEL_PM8821 = 22, |
| 278 | PMIC_MODEL_PM8038 = 23, |
| 279 | PMIC_MODEL_PM8922 = 24, |
| 280 | PMIC_MODEL_PM8917 = 25, |
| 281 | PMIC_MODEL_UNKNOWN = 0xFFFFFFFF |
| 282 | }; |
| 283 | |
| 284 | enum msm_cpu socinfo_get_msm_cpu(void); |
| 285 | uint32_t socinfo_get_id(void); |
| 286 | uint32_t socinfo_get_version(void); |
| 287 | uint32_t socinfo_get_raw_id(void); |
| 288 | char *socinfo_get_build_id(void); |
Lingutla Chandrasekhar | 47692de | 2017-06-29 20:13:48 +0530 | [diff] [blame] | 289 | char *socinfo_get_id_string(void); |
Bhargav Gurappadi | a9e6ab4 | 2016-08-01 23:35:54 -0700 | [diff] [blame] | 290 | uint32_t socinfo_get_platform_type(void); |
| 291 | uint32_t socinfo_get_platform_subtype(void); |
| 292 | uint32_t socinfo_get_platform_version(void); |
| 293 | uint32_t socinfo_get_serial_number(void); |
| 294 | enum pmic_model socinfo_get_pmic_model(void); |
| 295 | uint32_t socinfo_get_pmic_die_revision(void); |
| 296 | int __init socinfo_init(void) __must_check; |
| 297 | |
| 298 | #endif |