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