Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef _ARCH_ARM_MACH_MSM_SOCINFO_H_ |
| 15 | #define _ARCH_ARM_MACH_MSM_SOCINFO_H_ |
| 16 | |
Stepan Moskovchenko | 8719236 | 2011-08-05 18:02:01 -0700 | [diff] [blame] | 17 | #include <linux/kernel.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 18 | #include <linux/init.h> |
Sathish Ambley | a99d685 | 2011-10-31 15:50:55 -0700 | [diff] [blame] | 19 | #include <linux/errno.h> |
| 20 | #include <linux/of_fdt.h> |
| 21 | #include <linux/of.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 22 | |
| 23 | #include <asm/cputype.h> |
| 24 | #include <asm/mach-types.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 | |
Sathish Ambley | a99d685 | 2011-10-31 15:50:55 -0700 | [diff] [blame] | 34 | #ifdef CONFIG_OF |
Stepan Moskovchenko | 82f0eab | 2013-04-02 19:52:28 -0700 | [diff] [blame^] | 35 | #define of_board_is_sim() of_machine_is_compatible("qcom,sim") |
| 36 | #define of_board_is_rumi() of_machine_is_compatible("qcom,rumi") |
| 37 | #define of_board_is_fluid() of_machine_is_compatible("qcom,fluid") |
| 38 | #define of_board_is_liquid() of_machine_is_compatible("qcom,liquid") |
| 39 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 40 | #define machine_is_msm8974() \ |
| 41 | of_machine_is_compatible("qcom,msm8974") |
Rohit Vaswani | 47ee9e9 | 2012-04-23 18:42:03 -0700 | [diff] [blame] | 42 | #define machine_is_msm9625() \ |
| 43 | of_machine_is_compatible("qcom,msm9625") |
Ravi Kumar V | 754282d | 2012-08-31 22:32:20 +0530 | [diff] [blame] | 44 | #define early_machine_is_mpq8092() \ |
| 45 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,mpq8092") |
Syed Rameez Mustafa | d6084d3 | 2012-08-23 15:47:50 -0700 | [diff] [blame] | 46 | #define machine_is_msm8226() \ |
| 47 | of_machine_is_compatible("qcom,msm8226") |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 48 | #define early_machine_is_msm8610() \ |
| 49 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8610") |
| 50 | #define machine_is_msm8610() \ |
| 51 | of_machine_is_compatible("qcom,msm8610") |
Stepan Moskovchenko | 55dfdc3 | 2013-01-24 15:48:23 -0800 | [diff] [blame] | 52 | #define early_machine_is_msmzinc() \ |
| 53 | of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmzinc") |
Sathish Ambley | a99d685 | 2011-10-31 15:50:55 -0700 | [diff] [blame] | 54 | #else |
Stepan Moskovchenko | 82f0eab | 2013-04-02 19:52:28 -0700 | [diff] [blame^] | 55 | #define of_board_is_sim() 0 |
| 56 | #define of_board_is_rumi() 0 |
| 57 | #define of_board_is_fluid() 0 |
| 58 | #define of_board_is_liquid() 0 |
| 59 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 60 | #define machine_is_msm8974() 0 |
Rohit Vaswani | 47ee9e9 | 2012-04-23 18:42:03 -0700 | [diff] [blame] | 61 | #define machine_is_msm9625() 0 |
Ravi Kumar V | 754282d | 2012-08-31 22:32:20 +0530 | [diff] [blame] | 62 | #define early_machine_is_mpq8092() 0 |
Syed Rameez Mustafa | d6084d3 | 2012-08-23 15:47:50 -0700 | [diff] [blame] | 63 | #define machine_is_msm8226() 0 |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 64 | #define early_machine_is_msm8610() 0 |
| 65 | #define machine_is_msm8610() 0 |
Stepan Moskovchenko | 55dfdc3 | 2013-01-24 15:48:23 -0800 | [diff] [blame] | 66 | #define early_machine_is_msmzinc() 0 |
Syed Rameez Mustafa | d6084d3 | 2012-08-23 15:47:50 -0700 | [diff] [blame] | 67 | |
Sathish Ambley | a99d685 | 2011-10-31 15:50:55 -0700 | [diff] [blame] | 68 | #endif |
| 69 | |
Stepan Moskovchenko | 2b4b1cd | 2012-03-29 18:21:04 -0700 | [diff] [blame] | 70 | #define PLATFORM_SUBTYPE_SGLTE 6 |
| 71 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 72 | enum msm_cpu { |
| 73 | MSM_CPU_UNKNOWN = 0, |
| 74 | MSM_CPU_7X01, |
| 75 | MSM_CPU_7X25, |
| 76 | MSM_CPU_7X27, |
| 77 | MSM_CPU_8X50, |
| 78 | MSM_CPU_8X50A, |
| 79 | MSM_CPU_7X30, |
| 80 | MSM_CPU_8X55, |
| 81 | MSM_CPU_8X60, |
| 82 | MSM_CPU_8960, |
Stepan Moskovchenko | ec6a803 | 2012-07-06 15:42:01 -0700 | [diff] [blame] | 83 | MSM_CPU_8960AB, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 84 | MSM_CPU_7X27A, |
| 85 | FSM_CPU_9XXX, |
| 86 | MSM_CPU_7X25A, |
| 87 | MSM_CPU_7X25AA, |
Pankaj Kumar | fee56a8 | 2012-04-17 14:26:49 +0530 | [diff] [blame] | 88 | MSM_CPU_7X25AB, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 89 | MSM_CPU_8064, |
Jay Chokshi | b2de509 | 2012-09-19 18:28:12 -0700 | [diff] [blame] | 90 | MSM_CPU_8064AB, |
Jay Chokshi | f929474 | 2013-01-15 13:06:27 -0800 | [diff] [blame] | 91 | MSM_CPU_8064AA, |
Stepan Moskovchenko | a822219 | 2011-10-24 18:32:30 -0700 | [diff] [blame] | 92 | MSM_CPU_8930, |
Stepan Moskovchenko | 8b38bb3 | 2012-07-06 16:57:34 -0700 | [diff] [blame] | 93 | MSM_CPU_8930AA, |
Stepan Moskovchenko | a03e761 | 2012-10-16 18:34:17 -0700 | [diff] [blame] | 94 | MSM_CPU_8930AB, |
Rohit Vaswani | 8a28b4a | 2011-08-10 19:07:00 -0700 | [diff] [blame] | 95 | MSM_CPU_7X27AA, |
| 96 | MSM_CPU_9615, |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 97 | MSM_CPU_8974, |
Stepan Moskovchenko | db71cd6 | 2011-11-23 14:28:57 -0800 | [diff] [blame] | 98 | MSM_CPU_8627, |
Taniya Das | a04e189 | 2011-11-16 14:49:12 +0530 | [diff] [blame] | 99 | MSM_CPU_8625, |
Ravi Kumar V | 754282d | 2012-08-31 22:32:20 +0530 | [diff] [blame] | 100 | MSM_CPU_9625, |
Syed Rameez Mustafa | d6084d3 | 2012-08-23 15:47:50 -0700 | [diff] [blame] | 101 | MSM_CPU_8092, |
Syed Rameez Mustafa | 158d668 | 2012-09-21 18:25:50 -0700 | [diff] [blame] | 102 | MSM_CPU_8226, |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 103 | MSM_CPU_8610, |
Utsab Bose | 89b3299 | 2012-11-08 11:15:45 +0530 | [diff] [blame] | 104 | MSM_CPU_8625Q, |
Stepan Moskovchenko | 55dfdc3 | 2013-01-24 15:48:23 -0800 | [diff] [blame] | 105 | MSM_CPU_ZINC, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 106 | }; |
| 107 | |
Jin Hong | 9b556c3 | 2012-08-13 23:06:26 -0700 | [diff] [blame] | 108 | enum pmic_model { |
| 109 | PMIC_MODEL_PM8058 = 13, |
| 110 | PMIC_MODEL_PM8028 = 14, |
| 111 | PMIC_MODEL_PM8901 = 15, |
| 112 | PMIC_MODEL_PM8027 = 16, |
| 113 | PMIC_MODEL_ISL_9519 = 17, |
| 114 | PMIC_MODEL_PM8921 = 18, |
| 115 | PMIC_MODEL_PM8018 = 19, |
| 116 | PMIC_MODEL_PM8015 = 20, |
| 117 | PMIC_MODEL_PM8014 = 21, |
| 118 | PMIC_MODEL_PM8821 = 22, |
| 119 | PMIC_MODEL_PM8038 = 23, |
| 120 | PMIC_MODEL_PM8922 = 24, |
| 121 | PMIC_MODEL_PM8917 = 25, |
| 122 | PMIC_MODEL_UNKNOWN = 0xFFFFFFFF |
| 123 | }; |
| 124 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 125 | enum msm_cpu socinfo_get_msm_cpu(void); |
| 126 | uint32_t socinfo_get_id(void); |
| 127 | uint32_t socinfo_get_version(void); |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 128 | uint32_t socinfo_get_raw_id(void); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 129 | char *socinfo_get_build_id(void); |
| 130 | uint32_t socinfo_get_platform_type(void); |
| 131 | uint32_t socinfo_get_platform_subtype(void); |
| 132 | uint32_t socinfo_get_platform_version(void); |
Jin Hong | 9b556c3 | 2012-08-13 23:06:26 -0700 | [diff] [blame] | 133 | enum pmic_model socinfo_get_pmic_model(void); |
| 134 | uint32_t socinfo_get_pmic_die_revision(void); |
Abhimanyu Kapur | 91a0a50 | 2013-01-11 19:24:59 -0800 | [diff] [blame] | 135 | int __init socinfo_init(void) __must_check; |
Stepan Moskovchenko | eff783a | 2011-08-22 19:01:58 -0700 | [diff] [blame] | 136 | const int read_msm_cpu_type(void); |
| 137 | const int get_core_count(void); |
Jin Hong | 12b8b43 | 2012-07-18 10:00:31 -0700 | [diff] [blame] | 138 | const int cpu_is_krait(void); |
Stepan Moskovchenko | 70dc7cf | 2011-08-22 19:08:42 -0700 | [diff] [blame] | 139 | const int cpu_is_krait_v1(void); |
Jin Hong | 12b8b43 | 2012-07-18 10:00:31 -0700 | [diff] [blame] | 140 | const int cpu_is_krait_v2(void); |
Joel King | 824bd1f | 2012-08-19 12:55:49 -0700 | [diff] [blame] | 141 | const int cpu_is_krait_v3(void); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 142 | |
| 143 | static inline int cpu_is_msm7x01(void) |
| 144 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 145 | #ifdef CONFIG_ARCH_MSM7X01A |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 146 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 147 | |
| 148 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 149 | return cpu == MSM_CPU_7X01; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 150 | #else |
| 151 | return 0; |
| 152 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | static inline int cpu_is_msm7x25(void) |
| 156 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 157 | #ifdef CONFIG_ARCH_MSM7X25 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 158 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 159 | |
| 160 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 161 | return cpu == MSM_CPU_7X25; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 162 | #else |
| 163 | return 0; |
| 164 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | static inline int cpu_is_msm7x27(void) |
| 168 | { |
Taniya Das | 8e352a4 | 2012-02-20 16:49:48 +0530 | [diff] [blame] | 169 | #if defined(CONFIG_ARCH_MSM7X27) && !defined(CONFIG_ARCH_MSM7X27A) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 170 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 171 | |
| 172 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 173 | return cpu == MSM_CPU_7X27; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 174 | #else |
| 175 | return 0; |
| 176 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | static inline int cpu_is_msm7x27a(void) |
| 180 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 181 | #ifdef CONFIG_ARCH_MSM7X27A |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 182 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 183 | |
| 184 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 185 | return cpu == MSM_CPU_7X27A; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 186 | #else |
| 187 | return 0; |
| 188 | #endif |
| 189 | } |
| 190 | |
| 191 | static inline int cpu_is_msm7x27aa(void) |
| 192 | { |
| 193 | #ifdef CONFIG_ARCH_MSM7X27A |
| 194 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 195 | |
| 196 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 197 | return cpu == MSM_CPU_7X27AA; |
| 198 | #else |
| 199 | return 0; |
| 200 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | static inline int cpu_is_msm7x25a(void) |
| 204 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 205 | #ifdef CONFIG_ARCH_MSM7X27A |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 206 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 207 | |
| 208 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 209 | return cpu == MSM_CPU_7X25A; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 210 | #else |
| 211 | return 0; |
| 212 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | static inline int cpu_is_msm7x25aa(void) |
| 216 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 217 | #ifdef CONFIG_ARCH_MSM7X27A |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 218 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 219 | |
| 220 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 221 | return cpu == MSM_CPU_7X25AA; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 222 | #else |
| 223 | return 0; |
| 224 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 225 | } |
| 226 | |
Pankaj Kumar | fee56a8 | 2012-04-17 14:26:49 +0530 | [diff] [blame] | 227 | static inline int cpu_is_msm7x25ab(void) |
| 228 | { |
| 229 | #ifdef CONFIG_ARCH_MSM7X27A |
| 230 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 231 | |
| 232 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 233 | return cpu == MSM_CPU_7X25AB; |
| 234 | #else |
| 235 | return 0; |
| 236 | #endif |
| 237 | } |
| 238 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 239 | static inline int cpu_is_msm7x30(void) |
| 240 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 241 | #ifdef CONFIG_ARCH_MSM7X30 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 242 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 243 | |
| 244 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 245 | return cpu == MSM_CPU_7X30; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 246 | #else |
| 247 | return 0; |
| 248 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | static inline int cpu_is_qsd8x50(void) |
| 252 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 253 | #ifdef CONFIG_ARCH_QSD8X50 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 254 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 255 | |
| 256 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 257 | return cpu == MSM_CPU_8X50; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 258 | #else |
| 259 | return 0; |
| 260 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | static inline int cpu_is_msm8x55(void) |
| 264 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 265 | #ifdef CONFIG_ARCH_MSM7X30 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 266 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 267 | |
| 268 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 269 | return cpu == MSM_CPU_8X55; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 270 | #else |
| 271 | return 0; |
| 272 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | static inline int cpu_is_msm8x60(void) |
| 276 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 277 | #ifdef CONFIG_ARCH_MSM8X60 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 278 | return read_msm_cpu_type() == MSM_CPU_8X60; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 279 | #else |
| 280 | return 0; |
| 281 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | static inline int cpu_is_msm8960(void) |
| 285 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 286 | #ifdef CONFIG_ARCH_MSM8960 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 287 | return read_msm_cpu_type() == MSM_CPU_8960; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 288 | #else |
| 289 | return 0; |
| 290 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Stepan Moskovchenko | ec6a803 | 2012-07-06 15:42:01 -0700 | [diff] [blame] | 293 | static inline int cpu_is_msm8960ab(void) |
| 294 | { |
| 295 | #ifdef CONFIG_ARCH_MSM8960 |
| 296 | return read_msm_cpu_type() == MSM_CPU_8960AB; |
| 297 | #else |
| 298 | return 0; |
| 299 | #endif |
| 300 | } |
| 301 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 302 | static inline int cpu_is_apq8064(void) |
| 303 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 304 | #ifdef CONFIG_ARCH_APQ8064 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 305 | return read_msm_cpu_type() == MSM_CPU_8064; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 306 | #else |
| 307 | return 0; |
| 308 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 309 | } |
| 310 | |
Jay Chokshi | b2de509 | 2012-09-19 18:28:12 -0700 | [diff] [blame] | 311 | static inline int cpu_is_apq8064ab(void) |
| 312 | { |
| 313 | #ifdef CONFIG_ARCH_APQ8064 |
| 314 | return read_msm_cpu_type() == MSM_CPU_8064AB; |
| 315 | #else |
| 316 | return 0; |
| 317 | #endif |
| 318 | } |
| 319 | |
Jay Chokshi | f929474 | 2013-01-15 13:06:27 -0800 | [diff] [blame] | 320 | static inline int cpu_is_apq8064aa(void) |
| 321 | { |
| 322 | #ifdef CONFIG_ARCH_APQ8064 |
| 323 | return read_msm_cpu_type() == MSM_CPU_8064AA; |
| 324 | #else |
| 325 | return 0; |
| 326 | #endif |
| 327 | } |
| 328 | |
Stepan Moskovchenko | a822219 | 2011-10-24 18:32:30 -0700 | [diff] [blame] | 329 | static inline int cpu_is_msm8930(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 330 | { |
Stepan Moskovchenko | a8f0a22 | 2011-10-24 18:53:17 -0700 | [diff] [blame] | 331 | #ifdef CONFIG_ARCH_MSM8930 |
Stepan Moskovchenko | aba208d | 2012-07-05 20:33:55 -0700 | [diff] [blame] | 332 | return read_msm_cpu_type() == MSM_CPU_8930; |
Stepan Moskovchenko | db71cd6 | 2011-11-23 14:28:57 -0800 | [diff] [blame] | 333 | #else |
| 334 | return 0; |
| 335 | #endif |
| 336 | } |
| 337 | |
Stepan Moskovchenko | 8b38bb3 | 2012-07-06 16:57:34 -0700 | [diff] [blame] | 338 | static inline int cpu_is_msm8930aa(void) |
| 339 | { |
| 340 | #ifdef CONFIG_ARCH_MSM8930 |
| 341 | return read_msm_cpu_type() == MSM_CPU_8930AA; |
| 342 | #else |
| 343 | return 0; |
| 344 | #endif |
| 345 | } |
| 346 | |
Stepan Moskovchenko | a03e761 | 2012-10-16 18:34:17 -0700 | [diff] [blame] | 347 | static inline int cpu_is_msm8930ab(void) |
| 348 | { |
| 349 | #ifdef CONFIG_ARCH_MSM8930 |
| 350 | return read_msm_cpu_type() == MSM_CPU_8930AB; |
| 351 | #else |
| 352 | return 0; |
| 353 | #endif |
| 354 | } |
| 355 | |
Stepan Moskovchenko | db71cd6 | 2011-11-23 14:28:57 -0800 | [diff] [blame] | 356 | static inline int cpu_is_msm8627(void) |
| 357 | { |
| 358 | /* 8930 and 8627 will share the same CONFIG_ARCH type unless otherwise needed */ |
| 359 | #ifdef CONFIG_ARCH_MSM8930 |
| 360 | return read_msm_cpu_type() == MSM_CPU_8627; |
Stepan Moskovchenko | a8f0a22 | 2011-10-24 18:53:17 -0700 | [diff] [blame] | 361 | #else |
| 362 | return 0; |
| 363 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | static inline int cpu_is_fsm9xxx(void) |
| 367 | { |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 368 | #ifdef CONFIG_ARCH_FSM9XXX |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 369 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 370 | |
| 371 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 372 | return cpu == FSM_CPU_9XXX; |
Stepan Moskovchenko | 03804a0 | 2011-08-09 15:24:21 -0700 | [diff] [blame] | 373 | #else |
| 374 | return 0; |
| 375 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 376 | } |
| 377 | |
Rohit Vaswani | 8a28b4a | 2011-08-10 19:07:00 -0700 | [diff] [blame] | 378 | static inline int cpu_is_msm9615(void) |
| 379 | { |
| 380 | #ifdef CONFIG_ARCH_MSM9615 |
| 381 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 382 | |
| 383 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 384 | return cpu == MSM_CPU_9615; |
| 385 | #else |
| 386 | return 0; |
| 387 | #endif |
| 388 | } |
Taniya Das | a04e189 | 2011-11-16 14:49:12 +0530 | [diff] [blame] | 389 | |
| 390 | static inline int cpu_is_msm8625(void) |
| 391 | { |
| 392 | #ifdef CONFIG_ARCH_MSM8625 |
| 393 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 394 | |
| 395 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 396 | return cpu == MSM_CPU_8625; |
| 397 | #else |
| 398 | return 0; |
| 399 | #endif |
| 400 | } |
| 401 | |
Stepan Moskovchenko | 02c4d0c | 2012-07-26 14:33:02 -0700 | [diff] [blame] | 402 | static inline int cpu_is_msm8974(void) |
| 403 | { |
| 404 | #ifdef CONFIG_ARCH_MSM8974 |
| 405 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 406 | |
| 407 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 408 | return cpu == MSM_CPU_8974; |
| 409 | #else |
| 410 | return 0; |
| 411 | #endif |
| 412 | } |
| 413 | |
Ravi Kumar V | 754282d | 2012-08-31 22:32:20 +0530 | [diff] [blame] | 414 | static inline int cpu_is_mpq8092(void) |
| 415 | { |
| 416 | #ifdef CONFIG_ARCH_MPQ8092 |
| 417 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 418 | |
| 419 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 420 | return cpu == MSM_CPU_8092; |
| 421 | #else |
| 422 | return 0; |
| 423 | #endif |
| 424 | |
| 425 | } |
Syed Rameez Mustafa | d6084d3 | 2012-08-23 15:47:50 -0700 | [diff] [blame] | 426 | |
| 427 | static inline int cpu_is_msm8226(void) |
| 428 | { |
| 429 | #ifdef CONFIG_ARCH_MSM8226 |
| 430 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 431 | |
| 432 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 433 | return cpu == MSM_CPU_8226; |
| 434 | #else |
| 435 | return 0; |
| 436 | #endif |
| 437 | } |
| 438 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 439 | static inline int cpu_is_msm8610(void) |
Syed Rameez Mustafa | 158d668 | 2012-09-21 18:25:50 -0700 | [diff] [blame] | 440 | { |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 441 | #ifdef CONFIG_ARCH_MSM8610 |
Syed Rameez Mustafa | 158d668 | 2012-09-21 18:25:50 -0700 | [diff] [blame] | 442 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 443 | |
| 444 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 445 | return cpu == MSM_CPU_8610; |
Syed Rameez Mustafa | 158d668 | 2012-09-21 18:25:50 -0700 | [diff] [blame] | 446 | #else |
| 447 | return 0; |
| 448 | #endif |
| 449 | } |
Stepan Moskovchenko | 5b9e776 | 2012-09-21 20:32:17 -0700 | [diff] [blame] | 450 | |
Utsab Bose | 89b3299 | 2012-11-08 11:15:45 +0530 | [diff] [blame] | 451 | static inline int cpu_is_msm8625q(void) |
| 452 | { |
| 453 | #ifdef CONFIG_ARCH_MSM8625 |
| 454 | enum msm_cpu cpu = socinfo_get_msm_cpu(); |
| 455 | |
| 456 | BUG_ON(cpu == MSM_CPU_UNKNOWN); |
| 457 | return cpu == MSM_CPU_8625Q; |
| 458 | #else |
| 459 | return 0; |
| 460 | #endif |
| 461 | } |
| 462 | |
Stepan Moskovchenko | 5b9e776 | 2012-09-21 20:32:17 -0700 | [diff] [blame] | 463 | static inline int soc_class_is_msm8960(void) |
| 464 | { |
| 465 | return cpu_is_msm8960() || cpu_is_msm8960ab(); |
| 466 | } |
| 467 | |
| 468 | static inline int soc_class_is_apq8064(void) |
| 469 | { |
Jay Chokshi | f929474 | 2013-01-15 13:06:27 -0800 | [diff] [blame] | 470 | return cpu_is_apq8064() || cpu_is_apq8064ab() || cpu_is_apq8064aa(); |
Stepan Moskovchenko | 5b9e776 | 2012-09-21 20:32:17 -0700 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | static inline int soc_class_is_msm8930(void) |
| 474 | { |
Stepan Moskovchenko | ecb0d9b | 2012-10-16 18:35:34 -0700 | [diff] [blame] | 475 | return cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8930ab() || |
| 476 | cpu_is_msm8627(); |
Stepan Moskovchenko | 5b9e776 | 2012-09-21 20:32:17 -0700 | [diff] [blame] | 477 | } |
| 478 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 479 | #endif |