blob: 5e68cf7528c23614ab64316c6e06bd76c43f9dc2 [file] [log] [blame]
Shashank Mittal246f8d02011-01-21 17:12:27 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
Channagoud Kadabi3acfb742011-11-15 18:19:32 +05304 * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
Shashank Mittal246f8d02011-01-21 17:12:27 -08005 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google, Inc. nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
Amol Jadi2dfe3392011-07-19 16:03:37 -070033#include <reg.h>
Shashank Mittal246f8d02011-01-21 17:12:27 -080034#include <debug.h>
35#include <dev/keys.h>
Kinson Chikea646242011-09-01 13:53:16 -070036#include <dev/ssbi.h>
Shashank Mittal246f8d02011-01-21 17:12:27 -080037#include <lib/ptable.h>
38#include <dev/flash.h>
39#include <smem.h>
Greg Griscod6250552011-06-29 14:40:23 -070040#include <mmc.h>
Shashank Mittal246f8d02011-01-21 17:12:27 -080041#include <platform/iomap.h>
Greg Griscod6250552011-06-29 14:40:23 -070042#include <platform.h>
Deepa Dinamani5e5c21a2012-02-16 18:59:57 -080043#include <crypto_hash.h>
Shashank Mittal246f8d02011-01-21 17:12:27 -080044
45#define MSM7X27A_FFA 3351
46#define MSM7X27A_SURF 3352
47#define MSM7X27A_RUMI3 3353
Channagoud Kadabi4c41c412011-09-08 15:38:30 +053048#define MSM7X27A_QRD1 3756
Channagoud Kadabi81100682011-07-26 16:14:29 +053049#define MSM7X25A_SURF 3772
50#define MSM7X25A_FFA 3771
Channagoud Kadabid53664b2011-12-28 16:39:15 +053051#define MSM7X27A_EVB 3934
Channagoud Kadabib33d4832012-02-06 17:10:56 +053052#define MSM7X27A_QRD3 4005
Channagoud Kadabi81ba1102011-10-01 16:37:59 +053053#define MSM8X25_RUMI3 3871
Channagoud Kadabi4c41c412011-09-08 15:38:30 +053054
Channagoud Kadabi3acfb742011-11-15 18:19:32 +053055#define MSM8X25_SURF 4037
56#define MSM8X25_EVB 4042
Aparna Mallavarapuac332982012-03-18 14:02:38 +053057#define MSM8X25_QRD7 4095
Channagoud Kadabi3acfb742011-11-15 18:19:32 +053058
Shashank Mittalef325412011-04-01 13:48:26 -070059#define LINUX_MACHTYPE MSM7X27A_SURF
Shashank Mittal246f8d02011-01-21 17:12:27 -080060
61#define VARIABLE_LENGTH 0x10101010
62#define DIFF_START_ADDR 0xF0F0F0F0
63#define NUM_PAGES_PER_BLOCK 0x40
Channagoud Kadabi16da3a22011-10-24 20:25:07 +053064#define RECOVERY_MODE 0x77665502
65#define FOTA_COOKIE 0x64645343
66
67unsigned int fota_cookie[1];
Shashank Mittal246f8d02011-01-21 17:12:27 -080068
69static struct ptable flash_ptable;
Shashank Mittalcb25d252011-04-05 12:13:30 -070070unsigned hw_platform = 0;
71unsigned target_msm_id = 0;
Shashank Mittal246f8d02011-01-21 17:12:27 -080072
Deepa Dinamani5e5c21a2012-02-16 18:59:57 -080073/* Setting this variable to different values defines the
74 * behavior of CE engine:
75 * platform_ce_type = CRYPTO_ENGINE_TYPE_NONE : No CE engine
76 * platform_ce_type = CRYPTO_ENGINE_TYPE_SW : Software CE engine
77 * platform_ce_type = CRYPTO_ENGINE_TYPE_HW : Hardware CE engine
78 * Behavior is determined in the target code.
79 */
80static crypto_engine_type platform_ce_type = CRYPTO_ENGINE_TYPE_SW;
81
Channagoud Kadabi3acfb742011-11-15 18:19:32 +053082int machine_is_evb();
Channagoud Kadabid53664b2011-12-28 16:39:15 +053083
Shashank Mittal246f8d02011-01-21 17:12:27 -080084/* for these partitions, start will be offset by either what we get from
85 * smem, or from the above offset if smem is not useful. Also, we should
86 * probably have smem_ptable code populate our flash_ptable.
87 *
88 * When smem provides us with a full partition table, we can get rid of
89 * this altogether.
90 *
91 */
Channagoud Kadabie57173d2011-12-19 15:42:44 +053092static struct ptentry board_part_list[] = {
Shashank Mittal246f8d02011-01-21 17:12:27 -080093 {
Ajay Dudanib01e5062011-12-03 23:23:42 -080094 .start = 0,
95 .length = 10 /* In MB */ ,
96 .name = "boot",
97 },
Shashank Mittal246f8d02011-01-21 17:12:27 -080098 {
Ajay Dudanib01e5062011-12-03 23:23:42 -080099 .start = DIFF_START_ADDR,
Channagoud Kadabi71961882012-02-09 16:32:41 +0530100 .length = 253 /* In MB */ ,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800101 .name = "system",
102 },
Shashank Mittal246f8d02011-01-21 17:12:27 -0800103 {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800104 .start = DIFF_START_ADDR,
105 .length = 40 /* In MB */ ,
106 .name = "cache",
107 },
Shashank Mittal246f8d02011-01-21 17:12:27 -0800108 {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800109 .start = DIFF_START_ADDR,
110 .length = 4 /* In MB */ ,
111 .name = "misc",
112 },
Shashank Mittal246f8d02011-01-21 17:12:27 -0800113 {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800114 .start = DIFF_START_ADDR,
115 .length = VARIABLE_LENGTH,
116 .name = "userdata",
117 },
Shashank Mittal246f8d02011-01-21 17:12:27 -0800118 {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800119 .start = DIFF_START_ADDR,
120 .length = 4 /* In MB */ ,
121 .name = "persist",
122 },
Shashank Mittal246f8d02011-01-21 17:12:27 -0800123 {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800124 .start = DIFF_START_ADDR,
125 .length = 10 /* In MB */ ,
126 .name = "recovery",
127 },
Shashank Mittal246f8d02011-01-21 17:12:27 -0800128};
Ajay Dudanib01e5062011-12-03 23:23:42 -0800129
Channagoud Kadabie57173d2011-12-19 15:42:44 +0530130static int num_parts = sizeof(board_part_list) / sizeof(struct ptentry);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800131
Shashank Mittal246f8d02011-01-21 17:12:27 -0800132void smem_ptable_init(void);
133unsigned smem_get_apps_flash_start(void);
134
135void keypad_init(void);
136
137int target_is_emmc_boot(void);
138
139void target_init(void)
140{
141 unsigned offset;
142 struct flash_info *flash_info;
143 unsigned total_num_of_blocks;
144 unsigned next_ptr_start_adr = 0;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800145 unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive */
Shashank Mittal246f8d02011-01-21 17:12:27 -0800146 int i;
147
148 dprintf(INFO, "target_init()\n");
149
Shashank Mittal246f8d02011-01-21 17:12:27 -0800150#if (!ENABLE_NANDWRITE)
151 keys_init();
152 keypad_init();
153#endif
Shashank Mittal246f8d02011-01-21 17:12:27 -0800154
Kinson Chikce306ff2011-07-08 15:23:33 -0700155 /* Display splash screen if enabled */
156#if DISPLAY_SPLASH_SCREEN
Channagoud Kadabid53664b2011-12-28 16:39:15 +0530157 /* EVB platform comes with a new display panel, Until
158 * support for new panel is added disable splash screen
159 * for EVB
160 */
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530161 if (!machine_is_evb()) {
Channagoud Kadabid53664b2011-12-28 16:39:15 +0530162 display_init();
163 dprintf(SPEW, "Diplay initialized\n");
164 display_image_on_screen();
165 }
Kinson Chikce306ff2011-07-08 15:23:33 -0700166#endif
167
Ajay Dudanib01e5062011-12-03 23:23:42 -0800168 if (target_is_emmc_boot()) {
Amol Jadi2dfe3392011-07-19 16:03:37 -0700169 /* Must wait for modem-up before we can intialize MMC.
170 */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800171 while (readl(MSM_SHARED_BASE + 0x14) != 1) ;
Amol Jadi2dfe3392011-07-19 16:03:37 -0700172
Ajay Dudanib01e5062011-12-03 23:23:42 -0800173 if (mmc_boot_main(MMC_SLOT, MSM_SDC3_BASE)) {
Shashank Mittal246f8d02011-01-21 17:12:27 -0800174 dprintf(CRITICAL, "mmc init failed!");
175 ASSERT(0);
176 }
177 return;
178 }
179
180 ptable_init(&flash_ptable);
181 smem_ptable_init();
182
183 flash_init();
184 flash_info = flash_get_info();
185 ASSERT(flash_info);
186
187 offset = smem_get_apps_flash_start();
188 if (offset == 0xffffffff)
Ajay Dudanib01e5062011-12-03 23:23:42 -0800189 while (1) ;
Shashank Mittal246f8d02011-01-21 17:12:27 -0800190
191 total_num_of_blocks = flash_info->num_blocks;
192 blocks_per_1MB = (1 << 20) / (flash_info->block_size);
193
194 for (i = 0; i < num_parts; i++) {
195 struct ptentry *ptn = &board_part_list[i];
196 unsigned len = ((ptn->length) * blocks_per_1MB);
197
Ajay Dudanib01e5062011-12-03 23:23:42 -0800198 if (ptn->start != 0)
199 ASSERT(ptn->start == DIFF_START_ADDR);
Shashank Mittal246f8d02011-01-21 17:12:27 -0800200
201 ptn->start = next_ptr_start_adr;
202
Ajay Dudanib01e5062011-12-03 23:23:42 -0800203 if (ptn->length == VARIABLE_LENGTH) {
Shashank Mittal246f8d02011-01-21 17:12:27 -0800204 unsigned length_for_prt = 0;
205 unsigned j;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800206 for (j = i + 1; j < num_parts; j++) {
207 struct ptentry *temp_ptn = &board_part_list[j];
208 ASSERT(temp_ptn->length != VARIABLE_LENGTH);
209 length_for_prt +=
210 ((temp_ptn->length) * blocks_per_1MB);
Shashank Mittal246f8d02011-01-21 17:12:27 -0800211 }
Ajay Dudanib01e5062011-12-03 23:23:42 -0800212 len =
213 (total_num_of_blocks - 1) - (offset + ptn->start +
214 length_for_prt);
Shashank Mittal246f8d02011-01-21 17:12:27 -0800215 ASSERT(len >= 0);
216 }
217 next_ptr_start_adr = ptn->start + len;
218 ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800219 len, ptn->flags, TYPE_APPS_PARTITION,
220 PERM_WRITEABLE);
Shashank Mittal246f8d02011-01-21 17:12:27 -0800221 }
222
223 smem_add_modem_partitions(&flash_ptable);
224
225 ptable_dump(&flash_ptable);
226 flash_set_ptable(&flash_ptable);
227}
228
Shashank Mittalcb25d252011-04-05 12:13:30 -0700229void board_info(void)
230{
231 struct smem_board_info_v4 board_info_v4;
232 unsigned int board_info_len = 0;
233 unsigned smem_status;
234 unsigned format = 0;
235 unsigned id = 0;
236
237 if (hw_platform && target_msm_id)
238 return;
239
240 hw_platform = MSM7X27A_SURF;
241 target_msm_id = MSM7225A;
242
243 smem_status = smem_read_alloc_entry_offset(SMEM_BOARD_INFO_LOCATION,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800244 &format, sizeof(format), 0);
245 if (!smem_status) {
246 if (format == 4) {
Shashank Mittalcb25d252011-04-05 12:13:30 -0700247 board_info_len = sizeof(board_info_v4);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800248 smem_status =
249 smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION,
250 &board_info_v4,
251 board_info_len);
252 if (!smem_status) {
Shashank Mittalcb25d252011-04-05 12:13:30 -0700253 id = board_info_v4.board_info_v3.hw_platform;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800254 target_msm_id =
255 board_info_v4.board_info_v3.msm_id;
Shashank Mittalcb25d252011-04-05 12:13:30 -0700256 }
257 }
258
Channagoud Kadabi4c41c412011-09-08 15:38:30 +0530259 /* Detect SURF v/s FFA v/s QRD */
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530260 if (target_msm_id >= MSM8225 && target_msm_id <= MSM8625) {
261 switch (id) {
262 case 0x1:
263 hw_platform = MSM8X25_SURF;
264 break;
265 case 0xC:
266 hw_platform = MSM8X25_EVB;
267 break;
Aparna Mallavarapuac332982012-03-18 14:02:38 +0530268 case 0xF:
269 hw_platform = MSM8X25_QRD7;
270 break;
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530271 default:
272 hw_platform = MSM8X25_SURF;
273 }
274 } else {
275 switch (id) {
276 case 0x1:
277 /* Set the machine type based on msm ID */
278 if (target_msm_id == MSM7225A
279 || target_msm_id == MSM7625A
280 || target_msm_id == ESM7225A
281 || (target_msm_id >= MSM7225AA
282 && target_msm_id <= ESM7225AA))
283 hw_platform = MSM7X25A_SURF;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800284 else
285 hw_platform = MSM7X27A_SURF;
286 break;
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530287 case 0x2:
288 if (target_msm_id == MSM7225A
289 || target_msm_id == MSM7625A
290 || target_msm_id == ESM7225A
291 || (target_msm_id >= MSM7225AA
292 && target_msm_id <= ESM7225AA))
293 hw_platform = MSM7X25A_FFA;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800294 else
295 hw_platform = MSM7X27A_FFA;
296 break;
297 case 0xB:
Channagoud Kadabib33d4832012-02-06 17:10:56 +0530298 if(target_is_emmc_boot())
299 hw_platform = MSM7X27A_QRD1;
300 else
301 hw_platform = MSM7X27A_QRD3;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800302 break;
Channagoud Kadabid53664b2011-12-28 16:39:15 +0530303 case 0xC:
304 hw_platform = MSM7X27A_EVB;
305 break;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800306 default:
307 if (target_msm_id == MSM7225A
308 || target_msm_id == MSM7625A
309 || target_msm_id == ESM7225A
310 || (target_msm_id >= MSM7225AA
311 && target_msm_id <= ESM7225AA))
312 hw_platform = MSM7X25A_SURF;
313 else
314 hw_platform = MSM7X27A_SURF;
Shashank Mittalcb25d252011-04-05 12:13:30 -0700315 };
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530316 }
Ajay Dudanib01e5062011-12-03 23:23:42 -0800317 /* Set msm ID for target variants based on values read from smem */
318 switch (target_msm_id) {
319 case MSM7225A:
320 case MSM7625A:
321 case ESM7225A:
322 case MSM7225AA:
323 case MSM7625AA:
324 case ESM7225AA:
325 target_msm_id = MSM7625A;
326 break;
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530327 case MSM8225:
328 case MSM8625:
329 target_msm_id = MSM8625;
330 break;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800331 default:
332 target_msm_id = MSM7627A;
Shashank Mittalcb25d252011-04-05 12:13:30 -0700333 }
334 }
335 return;
336}
337
Shashank Mittal246f8d02011-01-21 17:12:27 -0800338unsigned board_machtype(void)
339{
Shashank Mittalcb25d252011-04-05 12:13:30 -0700340 board_info();
341 return hw_platform;
342}
343
344unsigned board_msm_id(void)
345{
346 board_info();
347 return target_msm_id;
Shashank Mittal246f8d02011-01-21 17:12:27 -0800348}
349
Deepa Dinamani5e5c21a2012-02-16 18:59:57 -0800350crypto_engine_type board_ce_type(void)
351{
352 return platform_ce_type;
353}
354
Shashank Mittal246f8d02011-01-21 17:12:27 -0800355void reboot_device(unsigned reboot_reason)
356{
357 reboot(reboot_reason);
358}
359
Channagoud Kadabi16da3a22011-10-24 20:25:07 +0530360static void check_fota_cookie(void)
361{
362 struct ptentry *ptn;
363 struct ptable *ptable;
364 unsigned page_size = flash_page_size();
365 unsigned pagemask = page_size - 1;
366 int n = 0;
367
368 ptable = flash_get_ptable();
369 if (ptable == NULL) {
370 dprintf(CRITICAL, "ERROR: Partition table not found\n");
371 return;
372 }
373
374 ptn = ptable_find(ptable, "FOTA");
375 if (ptn == NULL) {
376 dprintf(CRITICAL, "ERROR: No FOTA partition found\n");
377 return;
378 }
379 n = (sizeof(fota_cookie) + pagemask) & (~pagemask);
380
381 if (flash_read(ptn, 0, fota_cookie, n)) {
382 dprintf(CRITICAL, "ERROR: flash read fail!\n");
383 return;
384 }
385 return;
386}
387
Shashank Mittal246f8d02011-01-21 17:12:27 -0800388unsigned check_reboot_mode(void)
389{
Ajay Dudanib01e5062011-12-03 23:23:42 -0800390 unsigned mode[2] = { 0, 0 };
Shashank Mittal246f8d02011-01-21 17:12:27 -0800391 unsigned int mode_len = sizeof(mode);
392 unsigned smem_status;
393
394 smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800395 &mode, mode_len);
Channagoud Kadabi16da3a22011-10-24 20:25:07 +0530396
397 /*
398 * SMEM value is relied upon on power shutdown. Check either of SMEM
399 * or FOTA update cookie is set
400 */
401 check_fota_cookie();
402
Ajay Dudanib01e5062011-12-03 23:23:42 -0800403 if ((mode[0] == RECOVERY_MODE) || (fota_cookie[0] == FOTA_COOKIE))
Channagoud Kadabi16da3a22011-10-24 20:25:07 +0530404 return RECOVERY_MODE;
405
Ajay Dudanib01e5062011-12-03 23:23:42 -0800406 if (smem_status) {
407 dprintf(CRITICAL,
408 "ERROR: unable to read shared memory for reboot mode\n");
409 return 0;
Shashank Mittal246f8d02011-01-21 17:12:27 -0800410 }
411 return mode[0];
412}
413
414static unsigned target_check_power_on_reason(void)
415{
416 unsigned power_on_status = 0;
417 unsigned int status_len = sizeof(power_on_status);
418 unsigned smem_status;
419
420 smem_status = smem_read_alloc_entry(SMEM_POWER_ON_STATUS_INFO,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800421 &power_on_status, status_len);
422 if (smem_status) {
423 dprintf(CRITICAL,
424 "ERROR: unable to read shared memory for power on reason\n");
Shashank Mittal246f8d02011-01-21 17:12:27 -0800425 }
426
427 return power_on_status;
428}
429
430unsigned target_pause_for_battery_charge(void)
431{
Ajay Dudaniba822332011-11-25 13:37:31 -0800432 if (target_check_power_on_reason() == PWR_ON_EVENT_WALL_CHG)
Shashank Mittal246f8d02011-01-21 17:12:27 -0800433 return 1;
434 return 0;
435}
436
437void target_battery_charging_enable(unsigned enable, unsigned disconnect)
438{
439}
Shashank Mittal59392f32011-05-01 20:49:56 -0700440
441#if _EMMC_BOOT
442void target_serialno(unsigned char *buf)
443{
444 unsigned int serialno;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800445 serialno = mmc_get_psn();
446 sprintf(buf, "%x", serialno);
Shashank Mittal59392f32011-05-01 20:49:56 -0700447}
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700448
449int emmc_recovery_init(void)
450{
451 int rc;
452 rc = _emmc_recovery_init();
453 return rc;
454}
Shashank Mittal59392f32011-05-01 20:49:56 -0700455#endif
Channagoud Kadabid53664b2011-12-28 16:39:15 +0530456
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530457int machine_is_evb()
Channagoud Kadabid53664b2011-12-28 16:39:15 +0530458{
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530459 int ret = 0;
460 unsigned mach_type = board_machtype();
461
462 switch(mach_type) {
463 case MSM7X27A_EVB:
464 case MSM8X25_EVB:
465 ret = 1;
466 break;
467 default:
468 ret = 0;
469 }
470 return ret;
Channagoud Kadabid53664b2011-12-28 16:39:15 +0530471}
Aparna Mallavarapuac332982012-03-18 14:02:38 +0530472int machine_is_qrd()
Channagoud Kadabib33d4832012-02-06 17:10:56 +0530473{
Aparna Mallavarapuac332982012-03-18 14:02:38 +0530474 int ret = 0;
475 unsigned mach_type = board_machtype();
Channagoud Kadabib33d4832012-02-06 17:10:56 +0530476
Aparna Mallavarapuac332982012-03-18 14:02:38 +0530477 switch(mach_type) {
478 case MSM7X27A_QRD1:
479 case MSM7X27A_QRD3:
480 case MSM8X25_QRD7:
481 ret = 1;
482 break;
483 default:
484 ret = 0;
485 }
486 return ret;
Channagoud Kadabib33d4832012-02-06 17:10:56 +0530487}
Channagoud Kadabi81ba1102011-10-01 16:37:59 +0530488int machine_is_8x25()
489{
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530490 int ret = 0;
491 unsigned mach_type = board_machtype();
492
493 switch(mach_type) {
494 case MSM8X25_SURF:
495 case MSM8X25_EVB:
Aparna Mallavarapuac332982012-03-18 14:02:38 +0530496 case MSM8X25_QRD7:
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530497 ret = 1;
498 break;
499 default:
500 ret = 0;
501 }
502 return ret;
Channagoud Kadabi81ba1102011-10-01 16:37:59 +0530503}