Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, Google Inc. |
| 3 | * All rights reserved. |
Channagoud Kadabi | bfdadc6 | 2013-05-08 13:05:12 -0700 | [diff] [blame^] | 4 | * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 5 | * |
| 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 Jadi | 2dfe339 | 2011-07-19 16:03:37 -0700 | [diff] [blame] | 33 | #include <reg.h> |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 34 | #include <debug.h> |
| 35 | #include <dev/keys.h> |
Kinson Chik | ea64624 | 2011-09-01 13:53:16 -0700 | [diff] [blame] | 36 | #include <dev/ssbi.h> |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 37 | #include <lib/ptable.h> |
| 38 | #include <dev/flash.h> |
| 39 | #include <smem.h> |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 40 | #include <mmc.h> |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 41 | #include <platform/iomap.h> |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 42 | #include <target/board.h> |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 43 | #include <platform.h> |
Deepa Dinamani | 5e5c21a | 2012-02-16 18:59:57 -0800 | [diff] [blame] | 44 | #include <crypto_hash.h> |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 45 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 46 | #define VARIABLE_LENGTH 0x10101010 |
| 47 | #define DIFF_START_ADDR 0xF0F0F0F0 |
| 48 | #define NUM_PAGES_PER_BLOCK 0x40 |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 49 | #define RECOVERY_MODE 0x77665502 |
| 50 | #define FOTA_COOKIE 0x64645343 |
| 51 | |
| 52 | unsigned int fota_cookie[1]; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 53 | |
| 54 | static struct ptable flash_ptable; |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 55 | unsigned hw_platform = 0; |
| 56 | unsigned target_msm_id = 0; |
Aparna Mallavarapu | c1eb99b | 2012-09-24 20:13:42 +0530 | [diff] [blame] | 57 | unsigned msm_version = 0; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 58 | |
Deepa Dinamani | 5e5c21a | 2012-02-16 18:59:57 -0800 | [diff] [blame] | 59 | /* Setting this variable to different values defines the |
| 60 | * behavior of CE engine: |
| 61 | * platform_ce_type = CRYPTO_ENGINE_TYPE_NONE : No CE engine |
| 62 | * platform_ce_type = CRYPTO_ENGINE_TYPE_SW : Software CE engine |
| 63 | * platform_ce_type = CRYPTO_ENGINE_TYPE_HW : Hardware CE engine |
| 64 | * Behavior is determined in the target code. |
| 65 | */ |
| 66 | static crypto_engine_type platform_ce_type = CRYPTO_ENGINE_TYPE_SW; |
| 67 | |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 68 | int machine_is_evb(); |
Channagoud Kadabi | d53664b | 2011-12-28 16:39:15 +0530 | [diff] [blame] | 69 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 70 | /* for these partitions, start will be offset by either what we get from |
| 71 | * smem, or from the above offset if smem is not useful. Also, we should |
| 72 | * probably have smem_ptable code populate our flash_ptable. |
| 73 | * |
| 74 | * When smem provides us with a full partition table, we can get rid of |
| 75 | * this altogether. |
| 76 | * |
| 77 | */ |
Channagoud Kadabi | b3e0803 | 2012-09-25 16:04:16 +0530 | [diff] [blame] | 78 | static struct ptentry board_part_list_default[] = { |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 79 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 80 | .start = 0, |
| 81 | .length = 10 /* In MB */ , |
| 82 | .name = "boot", |
| 83 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 84 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 85 | .start = DIFF_START_ADDR, |
Channagoud Kadabi | 7196188 | 2012-02-09 16:32:41 +0530 | [diff] [blame] | 86 | .length = 253 /* In MB */ , |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 87 | .name = "system", |
| 88 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 89 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 90 | .start = DIFF_START_ADDR, |
Channagoud Kadabi | 2ce6741 | 2012-09-11 18:26:27 +0530 | [diff] [blame] | 91 | .length = 80 /* In MB */ , |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 92 | .name = "cache", |
| 93 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 94 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 95 | .start = DIFF_START_ADDR, |
| 96 | .length = 4 /* In MB */ , |
| 97 | .name = "misc", |
| 98 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 99 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 100 | .start = DIFF_START_ADDR, |
| 101 | .length = VARIABLE_LENGTH, |
| 102 | .name = "userdata", |
| 103 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 104 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 105 | .start = DIFF_START_ADDR, |
| 106 | .length = 4 /* In MB */ , |
| 107 | .name = "persist", |
| 108 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 109 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 110 | .start = DIFF_START_ADDR, |
| 111 | .length = 10 /* In MB */ , |
| 112 | .name = "recovery", |
| 113 | }, |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 114 | }; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 115 | |
Channagoud Kadabi | b3e0803 | 2012-09-25 16:04:16 +0530 | [diff] [blame] | 116 | /* |
| 117 | * SKU3 & SKU PVT devices use the same micron NAND device with different density, |
| 118 | * due to this SKU3 partition creation fails as the number of blocks calculated |
| 119 | * from flash density is wrong, To avoid this use a different partition table & |
| 120 | * move the variable length partition to the end, this way kernel will truncate |
| 121 | * the variable length partition & we need not add target checks in the shared |
| 122 | * nand driver code. |
| 123 | */ |
| 124 | |
| 125 | static struct ptentry board_part_list_sku3[] = { |
| 126 | { |
| 127 | .start = 0, |
| 128 | .length = 10 /* In MB */ , |
| 129 | .name = "boot", |
| 130 | }, |
| 131 | { |
| 132 | .start = DIFF_START_ADDR, |
| 133 | .length = 253 /* In MB */ , |
| 134 | .name = "system", |
| 135 | }, |
| 136 | { |
| 137 | .start = DIFF_START_ADDR, |
| 138 | .length = 80 /* In MB */ , |
| 139 | .name = "cache", |
| 140 | }, |
| 141 | { |
| 142 | .start = DIFF_START_ADDR, |
| 143 | .length = 4 /* In MB */ , |
| 144 | .name = "misc", |
| 145 | }, |
| 146 | { |
| 147 | .start = DIFF_START_ADDR, |
| 148 | .length = 4 /* In MB */ , |
| 149 | .name = "persist", |
| 150 | }, |
| 151 | { |
| 152 | .start = DIFF_START_ADDR, |
| 153 | .length = 10 /* In MB */ , |
| 154 | .name = "recovery", |
| 155 | }, |
| 156 | { |
| 157 | .start = DIFF_START_ADDR, |
| 158 | .length = VARIABLE_LENGTH, |
| 159 | .name = "userdata", |
| 160 | }, |
| 161 | }; |
| 162 | |
| 163 | static int num_parts = sizeof(board_part_list_default) / sizeof(struct ptentry); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 164 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 165 | void smem_ptable_init(void); |
| 166 | unsigned smem_get_apps_flash_start(void); |
| 167 | |
| 168 | void keypad_init(void); |
| 169 | |
| 170 | int target_is_emmc_boot(void); |
| 171 | |
| 172 | void target_init(void) |
| 173 | { |
| 174 | unsigned offset; |
| 175 | struct flash_info *flash_info; |
Channagoud Kadabi | b3e0803 | 2012-09-25 16:04:16 +0530 | [diff] [blame] | 176 | struct ptentry *board_part_list; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 177 | unsigned total_num_of_blocks; |
| 178 | unsigned next_ptr_start_adr = 0; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 179 | unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive */ |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 180 | int i; |
| 181 | |
| 182 | dprintf(INFO, "target_init()\n"); |
| 183 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 184 | #if (!ENABLE_NANDWRITE) |
| 185 | keys_init(); |
| 186 | keypad_init(); |
| 187 | #endif |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 188 | |
Kinson Chik | ce306ff | 2011-07-08 15:23:33 -0700 | [diff] [blame] | 189 | /* Display splash screen if enabled */ |
| 190 | #if DISPLAY_SPLASH_SCREEN |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 191 | display_init(); |
| 192 | dprintf(SPEW, "Diplay initialized\n"); |
Kinson Chik | ce306ff | 2011-07-08 15:23:33 -0700 | [diff] [blame] | 193 | #endif |
| 194 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 195 | if (target_is_emmc_boot()) { |
Amol Jadi | 2dfe339 | 2011-07-19 16:03:37 -0700 | [diff] [blame] | 196 | /* Must wait for modem-up before we can intialize MMC. |
| 197 | */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 198 | while (readl(MSM_SHARED_BASE + 0x14) != 1) ; |
Amol Jadi | 2dfe339 | 2011-07-19 16:03:37 -0700 | [diff] [blame] | 199 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 200 | if (mmc_boot_main(MMC_SLOT, MSM_SDC3_BASE)) { |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 201 | dprintf(CRITICAL, "mmc init failed!"); |
| 202 | ASSERT(0); |
| 203 | } |
| 204 | return; |
| 205 | } |
| 206 | |
| 207 | ptable_init(&flash_ptable); |
| 208 | smem_ptable_init(); |
| 209 | |
| 210 | flash_init(); |
| 211 | flash_info = flash_get_info(); |
| 212 | ASSERT(flash_info); |
| 213 | |
| 214 | offset = smem_get_apps_flash_start(); |
| 215 | if (offset == 0xffffffff) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 216 | while (1) ; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 217 | |
| 218 | total_num_of_blocks = flash_info->num_blocks; |
| 219 | blocks_per_1MB = (1 << 20) / (flash_info->block_size); |
| 220 | |
Channagoud Kadabi | b3e0803 | 2012-09-25 16:04:16 +0530 | [diff] [blame] | 221 | if (target_is_sku3()) |
| 222 | board_part_list = board_part_list_sku3; |
| 223 | else |
| 224 | board_part_list = board_part_list_default; |
| 225 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 226 | for (i = 0; i < num_parts; i++) { |
| 227 | struct ptentry *ptn = &board_part_list[i]; |
| 228 | unsigned len = ((ptn->length) * blocks_per_1MB); |
| 229 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 230 | if (ptn->start != 0) |
| 231 | ASSERT(ptn->start == DIFF_START_ADDR); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 232 | |
| 233 | ptn->start = next_ptr_start_adr; |
| 234 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 235 | if (ptn->length == VARIABLE_LENGTH) { |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 236 | unsigned length_for_prt = 0; |
| 237 | unsigned j; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 238 | for (j = i + 1; j < num_parts; j++) { |
| 239 | struct ptentry *temp_ptn = &board_part_list[j]; |
| 240 | ASSERT(temp_ptn->length != VARIABLE_LENGTH); |
| 241 | length_for_prt += |
| 242 | ((temp_ptn->length) * blocks_per_1MB); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 243 | } |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 244 | len = |
| 245 | (total_num_of_blocks - 1) - (offset + ptn->start + |
| 246 | length_for_prt); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 247 | ASSERT(len >= 0); |
| 248 | } |
| 249 | next_ptr_start_adr = ptn->start + len; |
| 250 | ptable_add(&flash_ptable, ptn->name, offset + ptn->start, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 251 | len, ptn->flags, TYPE_APPS_PARTITION, |
| 252 | PERM_WRITEABLE); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | smem_add_modem_partitions(&flash_ptable); |
| 256 | |
| 257 | ptable_dump(&flash_ptable); |
| 258 | flash_set_ptable(&flash_ptable); |
| 259 | } |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 260 | void board_info(void) |
| 261 | { |
| 262 | struct smem_board_info_v4 board_info_v4; |
| 263 | unsigned int board_info_len = 0; |
| 264 | unsigned smem_status; |
| 265 | unsigned format = 0; |
| 266 | unsigned id = 0; |
| 267 | |
| 268 | if (hw_platform && target_msm_id) |
| 269 | return; |
| 270 | |
| 271 | hw_platform = MSM7X27A_SURF; |
| 272 | target_msm_id = MSM7225A; |
| 273 | |
| 274 | smem_status = smem_read_alloc_entry_offset(SMEM_BOARD_INFO_LOCATION, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 275 | &format, sizeof(format), 0); |
| 276 | if (!smem_status) { |
| 277 | if (format == 4) { |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 278 | board_info_len = sizeof(board_info_v4); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 279 | smem_status = |
| 280 | smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION, |
| 281 | &board_info_v4, |
| 282 | board_info_len); |
| 283 | if (!smem_status) { |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 284 | id = board_info_v4.board_info_v3.hw_platform; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 285 | target_msm_id = |
| 286 | board_info_v4.board_info_v3.msm_id; |
Aparna Mallavarapu | c1eb99b | 2012-09-24 20:13:42 +0530 | [diff] [blame] | 287 | msm_version = |
| 288 | board_info_v4.board_info_v3.msm_version; |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 289 | } |
| 290 | } |
| 291 | |
Channagoud Kadabi | 4c41c41 | 2011-09-08 15:38:30 +0530 | [diff] [blame] | 292 | /* Detect SURF v/s FFA v/s QRD */ |
Aparna Mallavarapu | 5187941 | 2012-08-27 12:55:50 +0530 | [diff] [blame] | 293 | if (target_msm_id >= MSM8225 && target_msm_id <= MSM8625 |
Aparna Mallavarapu | 11e7287 | 2012-10-11 15:57:05 +0530 | [diff] [blame] | 294 | || (target_msm_id == MSM8125A) |
| 295 | || (target_msm_id == MSM8125)) { |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 296 | switch (id) { |
| 297 | case 0x1: |
| 298 | hw_platform = MSM8X25_SURF; |
| 299 | break; |
Aparna Mallavarapu | 1bb3367 | 2012-04-20 16:07:24 +0530 | [diff] [blame] | 300 | case 0x2: |
| 301 | hw_platform = MSM8X25_FFA; |
| 302 | break; |
Aparna Mallavarapu | bac9a72 | 2012-05-22 10:15:29 +0530 | [diff] [blame] | 303 | case 0x10: |
Aparna Mallavarapu | 287d89c | 2012-05-11 14:27:03 +0530 | [diff] [blame] | 304 | hw_platform = MSM8X25_EVT; |
| 305 | break; |
Aparna Mallavarapu | 332887b | 2012-10-11 15:51:26 +0530 | [diff] [blame] | 306 | case 0x11: |
| 307 | hw_platform = MSM8X25Q_SKUD; |
| 308 | break; |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 309 | case 0xC: |
| 310 | hw_platform = MSM8X25_EVB; |
| 311 | break; |
Aparna Mallavarapu | ac33298 | 2012-03-18 14:02:38 +0530 | [diff] [blame] | 312 | case 0xF: |
| 313 | hw_platform = MSM8X25_QRD7; |
| 314 | break; |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 315 | default: |
| 316 | hw_platform = MSM8X25_SURF; |
| 317 | } |
| 318 | } else { |
| 319 | switch (id) { |
| 320 | case 0x1: |
| 321 | /* Set the machine type based on msm ID */ |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 322 | if (msm_is_7x25a(target_msm_id)) |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 323 | hw_platform = MSM7X25A_SURF; |
Channagoud Kadabi | 849ad5e | 2012-04-02 23:21:21 +0530 | [diff] [blame] | 324 | else |
| 325 | hw_platform = MSM7X27A_SURF; |
| 326 | break; |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 327 | case 0x2: |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 328 | if (msm_is_7x25a(target_msm_id)) |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 329 | hw_platform = MSM7X25A_FFA; |
Channagoud Kadabi | 849ad5e | 2012-04-02 23:21:21 +0530 | [diff] [blame] | 330 | else |
| 331 | hw_platform = MSM7X27A_FFA; |
| 332 | break; |
| 333 | case 0xB: |
| 334 | if(target_is_emmc_boot()) |
| 335 | hw_platform = MSM7X27A_QRD1; |
| 336 | else |
| 337 | hw_platform = MSM7X27A_QRD3; |
| 338 | break; |
| 339 | case 0xC: |
| 340 | hw_platform = MSM7X27A_EVB; |
| 341 | break; |
| 342 | case 0xF: |
Channagoud Kadabi | b33d483 | 2012-02-06 17:10:56 +0530 | [diff] [blame] | 343 | hw_platform = MSM7X27A_QRD3; |
Channagoud Kadabi | 849ad5e | 2012-04-02 23:21:21 +0530 | [diff] [blame] | 344 | break; |
| 345 | default: |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 346 | if (msm_is_7x25a(target_msm_id)) |
Channagoud Kadabi | 849ad5e | 2012-04-02 23:21:21 +0530 | [diff] [blame] | 347 | hw_platform = MSM7X25A_SURF; |
| 348 | else |
| 349 | hw_platform = MSM7X27A_SURF; |
| 350 | }; |
| 351 | } |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 352 | /* Set msm ID for target variants based on values read from smem */ |
| 353 | switch (target_msm_id) { |
| 354 | case MSM7225A: |
| 355 | case MSM7625A: |
| 356 | case ESM7225A: |
| 357 | case MSM7225AA: |
| 358 | case MSM7625AA: |
| 359 | case ESM7225AA: |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 360 | case MSM7225AB: |
| 361 | case MSM7625AB: |
| 362 | case ESM7225AB: |
Channagoud Kadabi | 647f085 | 2012-06-08 11:51:45 +0530 | [diff] [blame] | 363 | case MSM7125A: |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 364 | target_msm_id = MSM7625A; |
| 365 | break; |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 366 | case MSM8225: |
| 367 | case MSM8625: |
Aparna Mallavarapu | 5187941 | 2012-08-27 12:55:50 +0530 | [diff] [blame] | 368 | case MSM8125A: |
Aparna Mallavarapu | 11e7287 | 2012-10-11 15:57:05 +0530 | [diff] [blame] | 369 | case MSM8125: |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 370 | target_msm_id = MSM8625; |
| 371 | break; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 372 | default: |
| 373 | target_msm_id = MSM7627A; |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 374 | } |
| 375 | } |
| 376 | return; |
| 377 | } |
| 378 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 379 | unsigned board_machtype(void) |
| 380 | { |
Shashank Mittal | cb25d25 | 2011-04-05 12:13:30 -0700 | [diff] [blame] | 381 | board_info(); |
| 382 | return hw_platform; |
| 383 | } |
| 384 | |
| 385 | unsigned board_msm_id(void) |
| 386 | { |
| 387 | board_info(); |
| 388 | return target_msm_id; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 389 | } |
| 390 | |
Aparna Mallavarapu | c1eb99b | 2012-09-24 20:13:42 +0530 | [diff] [blame] | 391 | unsigned board_msm_version(void) |
| 392 | { |
| 393 | board_info(); |
| 394 | msm_version = (msm_version & 0xffff0000) >> 16; |
| 395 | return msm_version; |
| 396 | } |
| 397 | |
Deepa Dinamani | 5e5c21a | 2012-02-16 18:59:57 -0800 | [diff] [blame] | 398 | crypto_engine_type board_ce_type(void) |
| 399 | { |
| 400 | return platform_ce_type; |
| 401 | } |
| 402 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 403 | void reboot_device(unsigned reboot_reason) |
| 404 | { |
| 405 | reboot(reboot_reason); |
| 406 | } |
| 407 | |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 408 | static int read_from_flash(struct ptentry* ptn, int offset, int size, void *dest) |
| 409 | { |
| 410 | void *buffer = NULL; |
| 411 | unsigned page_size = flash_page_size(); |
| 412 | unsigned page_mask = page_size - 1; |
| 413 | int read_size = (size + page_mask) & (~page_mask); |
| 414 | |
| 415 | buffer = malloc(read_size); |
| 416 | if(!buffer){ |
| 417 | dprintf(CRITICAL, "ERROR : Malloc failed for read_from_flash \n"); |
| 418 | return -1; |
| 419 | } |
| 420 | |
| 421 | if(flash_read(ptn, offset, buffer, read_size)){ |
| 422 | dprintf(CRITICAL, "ERROR : Flash read failed \n"); |
| 423 | return -1; |
| 424 | } |
| 425 | memcpy(dest, buffer, size); |
| 426 | free(buffer); |
| 427 | return 0; |
| 428 | } |
| 429 | |
| 430 | static unsigned int get_fota_cookie_mtd(void) |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 431 | { |
| 432 | struct ptentry *ptn; |
| 433 | struct ptable *ptable; |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 434 | unsigned int cookie = 0; |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 435 | |
| 436 | ptable = flash_get_ptable(); |
| 437 | if (ptable == NULL) { |
| 438 | dprintf(CRITICAL, "ERROR: Partition table not found\n"); |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 439 | return 0; |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | ptn = ptable_find(ptable, "FOTA"); |
| 443 | if (ptn == NULL) { |
| 444 | dprintf(CRITICAL, "ERROR: No FOTA partition found\n"); |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 445 | return 0; |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 446 | } |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 447 | |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 448 | if (read_from_flash(ptn, 0, sizeof(unsigned int), &cookie) == -1) { |
| 449 | dprintf(CRITICAL, "ERROR: failed to read fota cookie from flash\n"); |
| 450 | return 0; |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 451 | } |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 452 | return cookie; |
| 453 | } |
| 454 | |
| 455 | static int read_from_mmc(struct ptentry* ptn, int size, void *dest) |
| 456 | { |
| 457 | void *buffer = NULL; |
| 458 | unsigned sector_mask = 511; |
| 459 | int read_size = (size + sector_mask) & (~sector_mask); |
| 460 | |
| 461 | buffer = malloc(read_size); |
| 462 | if(!buffer){ |
| 463 | dprintf(CRITICAL, "ERROR : Malloc failed for read_from_flash \n"); |
| 464 | return -1; |
| 465 | } |
| 466 | |
| 467 | if(mmc_read(ptn, buffer, read_size)) { |
| 468 | dprintf(CRITICAL, "ERROR : Flash read failed \n"); |
| 469 | return -1; |
| 470 | } |
| 471 | memcpy(dest, buffer, size); |
| 472 | free(buffer); |
| 473 | return 0; |
| 474 | } |
| 475 | |
| 476 | static int get_fota_cookie_mmc(void) |
| 477 | { |
| 478 | unsigned long long ptn = 0; |
| 479 | int index = -1; |
| 480 | unsigned int cookie = 0; |
| 481 | |
| 482 | index = partition_get_index("FOTA"); |
| 483 | ptn = partition_get_offset(index); |
| 484 | |
| 485 | if(ptn == 0) { |
| 486 | dprintf(CRITICAL,"ERROR: FOTA partition not found\n"); |
| 487 | return 0; |
| 488 | } |
| 489 | if(read_from_mmc(ptn, sizeof(unsigned int), &cookie)) { |
| 490 | dprintf(CRITICAL, "ERROR: Cannot read cookie info\n"); |
| 491 | return 0; |
| 492 | } |
| 493 | return cookie; |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 494 | } |
| 495 | |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 496 | unsigned check_reboot_mode(void) |
| 497 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 498 | unsigned mode[2] = { 0, 0 }; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 499 | unsigned int mode_len = sizeof(mode); |
| 500 | unsigned smem_status; |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 501 | unsigned int cookie = 0; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 502 | |
| 503 | smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 504 | &mode, mode_len); |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 505 | |
| 506 | /* |
| 507 | * SMEM value is relied upon on power shutdown. Check either of SMEM |
| 508 | * or FOTA update cookie is set |
| 509 | */ |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 510 | if (target_is_emmc_boot()) |
| 511 | cookie = get_fota_cookie_mmc(); |
| 512 | else |
| 513 | cookie = get_fota_cookie_mtd(); |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 514 | |
Channagoud Kadabi | 16f5095 | 2012-04-02 16:24:07 +0530 | [diff] [blame] | 515 | if ((mode[0] == RECOVERY_MODE) || (cookie == FOTA_COOKIE)) |
Channagoud Kadabi | 16da3a2 | 2011-10-24 20:25:07 +0530 | [diff] [blame] | 516 | return RECOVERY_MODE; |
| 517 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 518 | if (smem_status) { |
| 519 | dprintf(CRITICAL, |
| 520 | "ERROR: unable to read shared memory for reboot mode\n"); |
| 521 | return 0; |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 522 | } |
| 523 | return mode[0]; |
| 524 | } |
| 525 | |
| 526 | static unsigned target_check_power_on_reason(void) |
| 527 | { |
| 528 | unsigned power_on_status = 0; |
| 529 | unsigned int status_len = sizeof(power_on_status); |
| 530 | unsigned smem_status; |
| 531 | |
| 532 | smem_status = smem_read_alloc_entry(SMEM_POWER_ON_STATUS_INFO, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 533 | &power_on_status, status_len); |
| 534 | if (smem_status) { |
| 535 | dprintf(CRITICAL, |
| 536 | "ERROR: unable to read shared memory for power on reason\n"); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | return power_on_status; |
| 540 | } |
| 541 | |
| 542 | unsigned target_pause_for_battery_charge(void) |
| 543 | { |
Ajay Dudani | ba82233 | 2011-11-25 13:37:31 -0800 | [diff] [blame] | 544 | if (target_check_power_on_reason() == PWR_ON_EVENT_WALL_CHG) |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 545 | return 1; |
| 546 | return 0; |
| 547 | } |
| 548 | |
| 549 | void target_battery_charging_enable(unsigned enable, unsigned disconnect) |
| 550 | { |
| 551 | } |
Shashank Mittal | 59392f3 | 2011-05-01 20:49:56 -0700 | [diff] [blame] | 552 | |
| 553 | #if _EMMC_BOOT |
| 554 | void target_serialno(unsigned char *buf) |
| 555 | { |
| 556 | unsigned int serialno; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 557 | serialno = mmc_get_psn(); |
| 558 | sprintf(buf, "%x", serialno); |
Shashank Mittal | 59392f3 | 2011-05-01 20:49:56 -0700 | [diff] [blame] | 559 | } |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 560 | |
| 561 | int emmc_recovery_init(void) |
| 562 | { |
| 563 | int rc; |
| 564 | rc = _emmc_recovery_init(); |
| 565 | return rc; |
| 566 | } |
Shashank Mittal | 59392f3 | 2011-05-01 20:49:56 -0700 | [diff] [blame] | 567 | #endif |
Channagoud Kadabi | d53664b | 2011-12-28 16:39:15 +0530 | [diff] [blame] | 568 | |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 569 | int machine_is_evb() |
Channagoud Kadabi | d53664b | 2011-12-28 16:39:15 +0530 | [diff] [blame] | 570 | { |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 571 | int ret = 0; |
| 572 | unsigned mach_type = board_machtype(); |
| 573 | |
| 574 | switch(mach_type) { |
| 575 | case MSM7X27A_EVB: |
| 576 | case MSM8X25_EVB: |
Aparna Mallavarapu | 287d89c | 2012-05-11 14:27:03 +0530 | [diff] [blame] | 577 | case MSM8X25_EVT: |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 578 | ret = 1; |
| 579 | break; |
| 580 | default: |
| 581 | ret = 0; |
| 582 | } |
| 583 | return ret; |
Channagoud Kadabi | d53664b | 2011-12-28 16:39:15 +0530 | [diff] [blame] | 584 | } |
Aparna Mallavarapu | ac33298 | 2012-03-18 14:02:38 +0530 | [diff] [blame] | 585 | int machine_is_qrd() |
Channagoud Kadabi | b33d483 | 2012-02-06 17:10:56 +0530 | [diff] [blame] | 586 | { |
Aparna Mallavarapu | ac33298 | 2012-03-18 14:02:38 +0530 | [diff] [blame] | 587 | int ret = 0; |
| 588 | unsigned mach_type = board_machtype(); |
Channagoud Kadabi | b33d483 | 2012-02-06 17:10:56 +0530 | [diff] [blame] | 589 | |
Aparna Mallavarapu | ac33298 | 2012-03-18 14:02:38 +0530 | [diff] [blame] | 590 | switch(mach_type) { |
| 591 | case MSM7X27A_QRD1: |
| 592 | case MSM7X27A_QRD3: |
| 593 | case MSM8X25_QRD7: |
| 594 | ret = 1; |
| 595 | break; |
| 596 | default: |
| 597 | ret = 0; |
| 598 | } |
| 599 | return ret; |
Channagoud Kadabi | b33d483 | 2012-02-06 17:10:56 +0530 | [diff] [blame] | 600 | } |
Aparna Mallavarapu | 332887b | 2012-10-11 15:51:26 +0530 | [diff] [blame] | 601 | int machine_is_skud() |
| 602 | { |
| 603 | int ret = 0; |
| 604 | unsigned mach_type = board_machtype(); |
| 605 | |
| 606 | switch(mach_type) { |
| 607 | case MSM8X25Q_SKUD: |
| 608 | ret = 1; |
| 609 | break; |
| 610 | default: |
| 611 | ret = 0; |
| 612 | } |
| 613 | return ret; |
| 614 | } |
Channagoud Kadabi | 81ba110 | 2011-10-01 16:37:59 +0530 | [diff] [blame] | 615 | int machine_is_8x25() |
| 616 | { |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 617 | int ret = 0; |
| 618 | unsigned mach_type = board_machtype(); |
| 619 | |
| 620 | switch(mach_type) { |
| 621 | case MSM8X25_SURF: |
Aparna Mallavarapu | 1bb3367 | 2012-04-20 16:07:24 +0530 | [diff] [blame] | 622 | case MSM8X25_FFA: |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 623 | case MSM8X25_EVB: |
Aparna Mallavarapu | 287d89c | 2012-05-11 14:27:03 +0530 | [diff] [blame] | 624 | case MSM8X25_EVT: |
Aparna Mallavarapu | ac33298 | 2012-03-18 14:02:38 +0530 | [diff] [blame] | 625 | case MSM8X25_QRD7: |
Aparna Mallavarapu | 332887b | 2012-10-11 15:51:26 +0530 | [diff] [blame] | 626 | case MSM8X25Q_SKUD: |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 627 | ret = 1; |
| 628 | break; |
| 629 | default: |
| 630 | ret = 0; |
| 631 | } |
| 632 | return ret; |
Channagoud Kadabi | 81ba110 | 2011-10-01 16:37:59 +0530 | [diff] [blame] | 633 | } |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 634 | |
| 635 | int msm_is_7x25a(int msm_id) |
| 636 | { |
| 637 | int ret = 0; |
| 638 | |
| 639 | switch (msm_id) { |
| 640 | case MSM7225A: |
| 641 | case MSM7625A: |
| 642 | case ESM7225A: |
| 643 | case MSM7225AA: |
| 644 | case MSM7625AA: |
| 645 | case ESM7225AA: |
| 646 | case MSM7225AB: |
| 647 | case MSM7625AB: |
| 648 | case ESM7225AB: |
Channagoud Kadabi | 647f085 | 2012-06-08 11:51:45 +0530 | [diff] [blame] | 649 | case MSM7125A: |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 650 | ret = 1; |
| 651 | break; |
| 652 | default: |
| 653 | ret = 0; |
| 654 | }; |
| 655 | return ret; |
| 656 | } |
Amol Jadi | da118b9 | 2012-07-06 19:53:18 -0700 | [diff] [blame] | 657 | |
| 658 | static void target_ulpi_init(void) |
| 659 | { |
| 660 | unsigned int reg; |
| 661 | |
| 662 | ulpi_read(0x31); |
| 663 | dprintf(INFO, " Value of ulpi read 0x31 is %08x\n", reg); |
| 664 | /* todo : the write back value should be calculated according to |
| 665 | * reg &= 0xF3 but sometimes the value that is read initially |
| 666 | * doesnt look right |
| 667 | */ |
| 668 | ulpi_write(0x4A, 0x31); |
| 669 | reg = ulpi_read(0x31); |
| 670 | dprintf(INFO, " Value of ulpi read 0x31 after write is %08x\n", reg); |
| 671 | |
| 672 | reg = ulpi_read(0x32); |
| 673 | dprintf(INFO, " Value of ulpi read 0x32 is %08x\n", reg); |
| 674 | ulpi_write(0x30, 0x32); |
| 675 | reg = ulpi_read(0x32); |
| 676 | dprintf(INFO, " Value of ulpi read 0x32 after write is %08x\n", reg); |
| 677 | |
| 678 | reg = ulpi_read(0x36); |
| 679 | dprintf(INFO, " Value of ulpi read 0x36 is %08x\n", reg); |
| 680 | ulpi_write(reg | 0x2, 0x36); |
| 681 | reg = ulpi_read(0x36); |
| 682 | dprintf(INFO, " Value of ulpi read 0x36 after write is %08x\n", reg); |
| 683 | } |
| 684 | |
| 685 | void target_usb_init(void) |
| 686 | { |
| 687 | target_ulpi_init(); |
| 688 | } |
Channagoud Kadabi | f248846 | 2012-06-12 15:22:48 +0530 | [diff] [blame] | 689 | |
| 690 | int target_cont_splash_screen() |
| 691 | { |
| 692 | int ret = 0; |
| 693 | unsigned mach_type = 0; |
| 694 | |
| 695 | mach_type = board_machtype(); |
| 696 | |
| 697 | switch(mach_type) { |
| 698 | case MSM8X25_EVB: |
| 699 | case MSM8X25_EVT: |
Channagoud Kadabi | cdda0fe | 2012-07-13 11:44:28 +0530 | [diff] [blame] | 700 | case MSM8X25_QRD7: |
Channagoud Kadabi | f248846 | 2012-06-12 15:22:48 +0530 | [diff] [blame] | 701 | ret = 1; |
| 702 | break; |
| 703 | default: |
| 704 | ret = 0; |
| 705 | }; |
| 706 | return ret; |
| 707 | } |
Channagoud Kadabi | b3e0803 | 2012-09-25 16:04:16 +0530 | [diff] [blame] | 708 | |
| 709 | int target_is_sku3() |
| 710 | { |
| 711 | int ret = 0; |
| 712 | unsigned mach_type = 0; |
| 713 | |
| 714 | mach_type = board_machtype(); |
| 715 | |
| 716 | switch(mach_type) { |
| 717 | case MSM7X27A_QRD3: |
| 718 | ret = 1; |
| 719 | break; |
| 720 | default: |
| 721 | ret = 0; |
| 722 | }; |
| 723 | return ret; |
| 724 | } |
Channagoud Kadabi | bfdadc6 | 2013-05-08 13:05:12 -0700 | [diff] [blame^] | 725 | |
| 726 | /* Function to set the capabilities for the host */ |
| 727 | void target_mmc_caps(struct mmc_host *host) |
| 728 | { |
| 729 | host->caps.ddr_mode = 0; |
| 730 | host->caps.hs200_mode = 0; |
| 731 | host->caps.bus_width = MMC_BOOT_BUS_WIDTH_4_BIT; |
| 732 | host->caps.hs_clk_rate = MMC_CLK_50MHZ; |
| 733 | } |