1/****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19#define LOG_TAG "NfcNciHal" 20 21#include "_OverrideLog.h" 22#include "config.h" 23#include "nfc_hal_int.h" 24#include "userial.h" 25extern "C" { 26#include "nfc_hal_post_reset.h" 27} 28#include <cutils/properties.h> 29#include <inttypes.h> 30#include <malloc.h> 31#include <string> 32#include "StartupConfig.h" 33#include "spdhelper.h" 34 35#define FW_PRE_PATCH "FW_PRE_PATCH" 36#define FW_PATCH "FW_PATCH" 37#define MAX_RF_DATA_CREDITS "MAX_RF_DATA_CREDITS" 38 39#define MAX_BUFFER (512) 40static char sPrePatchFn[MAX_BUFFER + 1]; 41static char sPatchFn[MAX_BUFFER + 1]; 42static void* sPrmBuf = NULL; 43static void* sI2cFixPrmBuf = NULL; 44 45#define CONFIG_MAX_LEN 256 46static uint8_t sConfig[CONFIG_MAX_LEN]; 47static StartupConfig sStartupConfig; 48static StartupConfig sLptdConfig; 49static StartupConfig sPreDiscoveryConfig; 50static StartupConfig sXtalCustomParam; 51extern uint8_t* p_nfc_hal_dm_start_up_cfg; // defined in the HAL 52static uint8_t nfa_dm_start_up_vsc_cfg[CONFIG_MAX_LEN]; 53extern uint8_t* p_nfc_hal_dm_start_up_vsc_cfg; // defined in the HAL 54extern uint8_t* p_nfc_hal_dm_lptd_cfg; // defined in the HAL 55static uint8_t sDontSendLptd[] = {0}; 56extern uint8_t* p_nfc_hal_pre_discover_cfg; // defined in the HAL 57extern uint8_t* p_nfc_hal_dm_xtal_params_cfg; // defined in HAL 58 59extern tSNOOZE_MODE_CONFIG gSnoozeModeCfg; 60extern tNFC_HAL_CFG* p_nfc_hal_cfg; 61static void mayDisableSecureElement(StartupConfig& config); 62 63/* Default patchfile (in NCD format) */ 64#ifndef NFA_APP_DEFAULT_PATCHFILE_NAME 65#define NFA_APP_DEFAULT_PATCHFILE_NAME "\0" 66#endif 67 68/* Default patchfile (in NCD format) */ 69#ifndef NFA_APP_DEFAULT_I2C_PATCHFILE_NAME 70#define NFA_APP_DEFAULT_I2C_PATCHFILE_NAME "\0" 71#endif 72 73tNFC_POST_RESET_CB nfc_post_reset_cb = { 74 /* Default Patch & Pre-Patch */ 75 NFA_APP_DEFAULT_PATCHFILE_NAME, 76 NULL, 77 NFA_APP_DEFAULT_I2C_PATCHFILE_NAME, 78 NULL, 79 80 /* Default UART baud rate */ 81 NFC_HAL_DEFAULT_BAUD, 82 83 /* Default tNFC_HAL_DEV_INIT_CFG (flags, num_xtal_cfg, {brcm_hw_id, 84 xtal-freq, xtal-index} ) */ 85 {2, /* number of valid entries */ 86 { 87 {0x43341000, 37400, 88 NFC_HAL_XTAL_INDEX_37400}, // All revisions of 43341 use 37,400 89 {0x20795000, 26000, NFC_HAL_XTAL_INDEX_26000}, 90 {0, 0, 0}, 91 {0, 0, 0}, 92 {0, 0, 0}, 93 }}, 94 95 /* Default low power mode settings */ 96 NFC_HAL_LP_SNOOZE_MODE_NONE, /* Snooze Mode */ 97 NFC_HAL_LP_IDLE_THRESHOLD_HOST, /* Idle Threshold Host */ 98 NFC_HAL_LP_IDLE_THRESHOLD_HC, /* Idle Threshold HC */ 99 NFC_HAL_LP_ACTIVE_LOW, /* NFC_WAKE Active Mode */ 100 NFC_HAL_LP_ACTIVE_HIGH, /* DH_WAKE Active Mode */ 101 102 NFA_APP_MAX_NUM_REINIT, /* max retry to get NVM type */ 103 0, /* current retry count */ 104 TRUE, /* debug mode for downloading patchram */ 105 FALSE /* skip downloading patchram after reinit because of patch download 106 failure */ 107}; 108 109/******************************************************************************* 110** 111** Function getFileLength 112** 113** Description return the size of a file 114** 115** Returns file size in number of bytes 116** 117*******************************************************************************/ 118static long getFileLength(FILE* fp) { 119 long sz; 120 fseek(fp, 0L, SEEK_END); 121 sz = ftell(fp); 122 fseek(fp, 0L, SEEK_SET); 123 124 return (sz > 0) ? sz : 0; 125} 126 127/******************************************************************************* 128** 129** Function isFileExist 130** 131** Description Check if file name exists (android does not support fexists) 132** 133** Returns TRUE if file exists 134** 135*******************************************************************************/ 136static bool isFileExist(const char* pFilename) { 137 FILE* pf; 138 139 pf = fopen(pFilename, "r"); 140 if (pf != NULL) { 141 fclose(pf); 142 return TRUE; 143 } 144 return FALSE; 145} 146 147/******************************************************************************* 148** 149** Function findPatchramFile 150** 151** Description Find the patchram file name specified in the .conf 152** 153** Returns pointer to the file name 154** 155*******************************************************************************/ 156static const char* findPatchramFile(const char* pConfigName, char* pBuffer, 157 int bufferLen) { 158 ALOGD("%s: config=%s", __func__, pConfigName); 159 160 if (pConfigName == NULL) { 161 ALOGD("%s No patchfile defined\n", __func__); 162 return NULL; 163 } 164 165 if (GetStrValue(pConfigName, &pBuffer[0], bufferLen)) { 166 ALOGD("%s found patchfile %s\n", __func__, pBuffer); 167 return (pBuffer[0] == '\0') ? NULL : pBuffer; 168 } 169 170 ALOGD("%s Cannot find patchfile '%s'\n", __func__, pConfigName); 171 return NULL; 172} 173 174/******************************************************************************* 175** 176** Function: continueAfterSetSnoozeMode 177** 178** Description: Called after Snooze Mode is enabled. 179** 180** Returns: none 181** 182*******************************************************************************/ 183static void continueAfterSetSnoozeMode(tHAL_NFC_STATUS status) { 184 ALOGD("%s: status=%u", __func__, status); 185 // let stack download firmware during next initialization 186 nfc_post_reset_cb.spd_skip_on_power_cycle = FALSE; 187 if (status == NCI_STATUS_OK) 188 HAL_NfcPreInitDone(HAL_NFC_STATUS_OK); 189 else 190 HAL_NfcPreInitDone(HAL_NFC_STATUS_FAILED); 191} 192 193/******************************************************************************* 194** 195** Function: postDownloadPatchram 196** 197** Description: Called after patch download 198** 199** Returns: none 200** 201*******************************************************************************/ 202static void postDownloadPatchram(tHAL_NFC_STATUS status) { 203 ALOGD("%s: status=%i", __func__, status); 204 GetStrValue(NAME_SNOOZE_MODE_CFG, (char*)&gSnoozeModeCfg, 205 sizeof(gSnoozeModeCfg)); 206 if (status != HAL_NFC_STATUS_OK) { 207 ALOGE("%s: Patch download failed", __func__); 208 if (status == HAL_NFC_STATUS_REFUSED) { 209 SpdHelper::setPatchAsBad(); 210 } else 211 SpdHelper::incErrorCount(); 212 213 /* If in SPD Debug mode, fail immediately and obviously */ 214 if (SpdHelper::isSpdDebug()) 215 HAL_NfcPreInitDone(HAL_NFC_STATUS_FAILED); 216 else { 217 /* otherwise, power cycle the chip and let the stack startup normally */ 218 ALOGD("%s: re-init; don't download firmware", __func__); 219 // stop stack from downloading firmware during next initialization 220 nfc_post_reset_cb.spd_skip_on_power_cycle = TRUE; 221 USERIAL_PowerupDevice(0); 222 HAL_NfcReInit(); 223 } 224 } 225 /* Set snooze mode here */ 226 else if (gSnoozeModeCfg.snooze_mode != NFC_HAL_LP_SNOOZE_MODE_NONE) { 227 status = HAL_NfcSetSnoozeMode( 228 gSnoozeModeCfg.snooze_mode, gSnoozeModeCfg.idle_threshold_dh, 229 gSnoozeModeCfg.idle_threshold_nfcc, gSnoozeModeCfg.nfc_wake_active_mode, 230 gSnoozeModeCfg.dh_wake_active_mode, continueAfterSetSnoozeMode); 231 if (status != NCI_STATUS_OK) { 232 ALOGE("%s: Setting snooze mode failed, status=%i", __func__, status); 233 HAL_NfcPreInitDone(HAL_NFC_STATUS_FAILED); 234 } 235 } else { 236 ALOGD("%s: Not using Snooze Mode", __func__); 237 HAL_NfcPreInitDone(HAL_NFC_STATUS_OK); 238 } 239} 240 241/******************************************************************************* 242** 243** Function: prmCallback 244** 245** Description: Patchram callback (for static patchram mode) 246** 247** Returns: none 248** 249*******************************************************************************/ 250void prmCallback(uint8_t event) { 251 ALOGD("%s: event=0x%x", __func__, event); 252 switch (event) { 253 case NFC_HAL_PRM_CONTINUE_EVT: 254 /* This event does not occur if static patchram buf is used */ 255 break; 256 257 case NFC_HAL_PRM_COMPLETE_EVT: 258 postDownloadPatchram(HAL_NFC_STATUS_OK); 259 break; 260 261 case NFC_HAL_PRM_ABORT_EVT: 262 postDownloadPatchram(HAL_NFC_STATUS_FAILED); 263 break; 264 265 case NFC_HAL_PRM_ABORT_INVALID_PATCH_EVT: 266 ALOGD("%s: invalid patch...skipping patch download", __func__); 267 postDownloadPatchram(HAL_NFC_STATUS_REFUSED); 268 break; 269 270 case NFC_HAL_PRM_ABORT_BAD_SIGNATURE_EVT: 271 ALOGD("%s: patch authentication failed", __func__); 272 postDownloadPatchram(HAL_NFC_STATUS_REFUSED); 273 break; 274 275 case NFC_HAL_PRM_ABORT_NO_NVM_EVT: 276 ALOGD("%s: No NVM detected", __func__); 277 HAL_NfcPreInitDone(HAL_NFC_STATUS_FAILED); 278 break; 279 280 default: 281 ALOGD("%s: not handled event=0x%x", __func__, event); 282 break; 283 } 284} 285 286/******************************************************************************* 287** 288** Function getNfaValues 289** 290** Description Get configuration values needed by NFA layer 291** 292** Returns: None 293** 294*******************************************************************************/ 295static void getNfaValues(uint32_t chipid) { 296 unsigned long num = 0; 297 int actualLen = 0; 298 299 sStartupConfig.initialize(); 300 sLptdConfig.initialize(); 301 sPreDiscoveryConfig.initialize(); 302 303 actualLen = 304 GetStrValue(NAME_NFA_DM_START_UP_CFG, (char*)sConfig, sizeof(sConfig)); 305 if (actualLen) sStartupConfig.append(sConfig, actualLen); 306 307 // Set antenna tuning configuration if configured. 308 actualLen = 309 GetStrValue(NAME_PREINIT_DSP_CFG, (char*)sConfig, sizeof(sConfig)); 310 if (actualLen) sStartupConfig.append(sConfig, actualLen); 311 312 if (GetStrValue(NAME_NFA_DM_START_UP_VSC_CFG, (char*)nfa_dm_start_up_vsc_cfg, 313 sizeof(nfa_dm_start_up_vsc_cfg))) { 314 p_nfc_hal_dm_start_up_vsc_cfg = &nfa_dm_start_up_vsc_cfg[0]; 315 ALOGD("START_UP_VSC_CFG[0] = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", 316 nfa_dm_start_up_vsc_cfg[0], nfa_dm_start_up_vsc_cfg[1], 317 nfa_dm_start_up_vsc_cfg[2], nfa_dm_start_up_vsc_cfg[3], 318 nfa_dm_start_up_vsc_cfg[4], nfa_dm_start_up_vsc_cfg[5], 319 nfa_dm_start_up_vsc_cfg[6], nfa_dm_start_up_vsc_cfg[7]); 320 } 321 322 actualLen = GetStrValue(NAME_LPTD_CFG, (char*)sConfig, sizeof(sConfig)); 323 if (actualLen) { 324 sLptdConfig.append(sConfig, actualLen); 325 p_nfc_hal_dm_lptd_cfg = 326 const_cast<uint8_t*>(sLptdConfig.getInternalBuffer()); 327 } else { 328 // Default to not sending any LPTD setting. 329 p_nfc_hal_dm_lptd_cfg = sDontSendLptd; 330 } 331 332 mayDisableSecureElement(sStartupConfig); 333 p_nfc_hal_dm_start_up_cfg = 334 const_cast<uint8_t*>(sStartupConfig.getInternalBuffer()); 335 336 actualLen = GetStrValue(NAME_NFA_DM_PRE_DISCOVERY_CFG, (char*)sConfig, 337 sizeof(sConfig)); 338 if (actualLen) { 339 sPreDiscoveryConfig.append(sConfig, actualLen); 340 mayDisableSecureElement(sPreDiscoveryConfig); 341 p_nfc_hal_pre_discover_cfg = 342 const_cast<uint8_t*>(sPreDiscoveryConfig.getInternalBuffer()); 343 } 344 345 // configure how many secure elements are available for each type of chip 346 if (p_nfc_hal_cfg->nfc_hal_hci_uicc_support > 0) { 347 if ((chipid & BRCM_NFC_GEN_MASK) == BRCM_NFC_20791_GEN) { 348 nfc_hal_cb.max_ee = BRCM_NFC_20791_GEN_MAX_EE; 349 p_nfc_hal_cfg->nfc_hal_hci_uicc_support = 350 HAL_NFC_HCI_UICC0_HOST | HAL_NFC_HCI_UICC1_HOST; 351 } else if ((chipid & BRCM_NFC_GEN_MASK) == BRCM_NFC_43341_GEN) { 352 nfc_hal_cb.max_ee = BRCM_NFC_43341_GEN_MAX_EE; 353 p_nfc_hal_cfg->nfc_hal_hci_uicc_support = 354 HAL_NFC_HCI_UICC0_HOST | HAL_NFC_HCI_UICC1_HOST; 355 } else if ((chipid & BRCM_NFC_GEN_MASK) == BRCM_NFC_20795_GEN) { 356 nfc_hal_cb.max_ee = BRCM_NFC_20795_GEN_MAX_EE; 357 p_nfc_hal_cfg->nfc_hal_hci_uicc_support = HAL_NFC_HCI_UICC0_HOST | 358 HAL_NFC_HCI_UICC1_HOST | 359 HAL_NFC_HCI_UICC2_HOST; 360 } 361 362 // let .conf variable determine how many EE's to discover 363 if (GetNumValue(NAME_NFA_MAX_EE_SUPPORTED, &num, sizeof(num))) 364 nfc_hal_cb.max_ee = num; 365 } 366} 367 368/******************************************************************************* 369** 370** Function StartPatchDownload 371** 372** Description Reads configuration settings, and begins the download 373** process if patch files are configured. 374** 375** Returns: None 376** 377*******************************************************************************/ 378static void StartPatchDownload(uint32_t chipid) { 379 ALOGD("%s: chipid=%" PRIu32, __func__, chipid); 380 381 char chipID[30]; 382 sprintf(chipID, "%" PRIu32, chipid); 383 ALOGD("%s: chidId=%s", __func__, chipID); 384 385 readOptionalConfig(chipID); // Read optional chip specific settings 386 readOptionalConfig("fime"); // Read optional FIME specific settings 387 getNfaValues(chipid); // Get NFA configuration values into variables 388 389 findPatchramFile(FW_PATCH, sPatchFn, sizeof(sPatchFn)); 390 findPatchramFile(FW_PRE_PATCH, sPrePatchFn, sizeof(sPatchFn)); 391 392 { 393 FILE* fd; 394 /* If an I2C fix patch file was specified, then tell the stack about it */ 395 if (sPrePatchFn[0] != '\0') { 396 fd = fopen(sPrePatchFn, "rb"); 397 if (fd != NULL) { 398 uint32_t lenPrmBuffer = getFileLength(fd); 399 400 sI2cFixPrmBuf = malloc(lenPrmBuffer); 401 if (sI2cFixPrmBuf != NULL) { 402 size_t actualLen = fread(sI2cFixPrmBuf, 1, lenPrmBuffer, fd); 403 if (actualLen == lenPrmBuffer) { 404 ALOGD("%s Setting I2C fix to %s (size: %" PRIu32 ")", __func__, 405 sPrePatchFn, lenPrmBuffer); 406 HAL_NfcPrmSetI2cPatch((uint8_t*)sI2cFixPrmBuf, 407 (uint16_t)lenPrmBuffer, 0); 408 } else 409 ALOGE( 410 "%s fail reading i2c fix; actual len=%zu; expected len=" 411 "%" PRIu32, 412 __func__, actualLen, lenPrmBuffer); 413 } else { 414 ALOGE("%s Unable to get buffer to i2c fix (%" PRIu32 " bytes)", 415 __func__, lenPrmBuffer); 416 } 417 418 fclose(fd); 419 } else { 420 ALOGE("%s Unable to open i2c fix patchfile %s", __func__, sPrePatchFn); 421 } 422 } 423 } 424 425 { 426 FILE* fd; 427 428 /* If a patch file was specified, then download it now */ 429 if (sPatchFn[0] != '\0') { 430 uint32_t bDownloadStarted = false; 431 432 /* open patchfile, read it into a buffer */ 433 fd = fopen(sPatchFn, "rb"); 434 if (fd != NULL) { 435 uint32_t lenPrmBuffer = getFileLength(fd); 436 ALOGD("%s Downloading patchfile %s (size: %" PRIu32 ") format=%u", 437 __func__, sPatchFn, lenPrmBuffer, NFC_HAL_PRM_FORMAT_NCD); 438 sPrmBuf = malloc(lenPrmBuffer); 439 if (sPrmBuf != NULL) { 440 size_t actualLen = fread(sPrmBuf, 1, lenPrmBuffer, fd); 441 if (actualLen == lenPrmBuffer) { 442 if (!SpdHelper::isPatchBad((uint8_t*)sPrmBuf, lenPrmBuffer)) { 443 /* Download patch using static memeory mode */ 444 HAL_NfcPrmDownloadStart(NFC_HAL_PRM_FORMAT_NCD, 0, 445 (uint8_t*)sPrmBuf, lenPrmBuffer, 0, 446 prmCallback); 447 bDownloadStarted = true; 448 } 449 } else 450 ALOGE("%s fail reading patchram", __func__); 451 } else 452 ALOGE("%s Unable to buffer to hold patchram (%" PRIu32 " bytes)", 453 __func__, lenPrmBuffer); 454 455 fclose(fd); 456 } else 457 ALOGE("%s Unable to open patchfile %s", __func__, sPatchFn); 458 459 /* If the download never got started */ 460 if (!bDownloadStarted) { 461 /* If debug mode, fail in an obvious way, otherwise try to start stack 462 */ 463 postDownloadPatchram(SpdHelper::isSpdDebug() ? HAL_NFC_STATUS_FAILED 464 : HAL_NFC_STATUS_OK); 465 } 466 } else { 467 ALOGE( 468 "%s: No patchfile specified or disabled. Proceeding to post-download " 469 "procedure...", 470 __func__); 471 postDownloadPatchram(HAL_NFC_STATUS_OK); 472 } 473 } 474 475 ALOGD("%s: exit", __func__); 476} 477 478/******************************************************************************* 479** 480** Function: nfc_hal_post_reset_init 481** 482** Description: Called by the NFC HAL after controller has been reset. 483** Begin to download firmware patch files. 484** 485** Returns: none 486** 487*******************************************************************************/ 488void nfc_hal_post_reset_init(uint32_t brcm_hw_id, uint8_t nvm_type) { 489 ALOGD("%s: brcm_hw_id=0x%" PRIu32 ", nvm_type=%d", __func__, brcm_hw_id, 490 nvm_type); 491 tHAL_NFC_STATUS stat = HAL_NFC_STATUS_FAILED; 492 uint8_t max_credits = 1, allow_no_nvm = 0; 493 494 p_nfc_hal_cfg->nfc_hal_prm_nvm_required = 495 TRUE; // don't download firmware if controller cannot detect EERPOM 496 497 if (nvm_type == NCI_SPD_NVM_TYPE_NONE) { 498 GetNumValue(NAME_ALLOW_NO_NVM, &allow_no_nvm, sizeof(allow_no_nvm)); 499 if (allow_no_nvm == 0) { 500 ALOGD("%s: No NVM detected, FAIL the init stage to force a retry", 501 __func__); 502 USERIAL_PowerupDevice(0); 503 stat = HAL_NfcReInit(); 504 return; 505 } 506 507 p_nfc_hal_cfg->nfc_hal_prm_nvm_required = 508 FALSE; // allow download firmware if controller cannot detect EERPOM 509 } 510 511 /* Start downloading the patch files */ 512 StartPatchDownload(brcm_hw_id); 513 514 if (GetNumValue(MAX_RF_DATA_CREDITS, &max_credits, sizeof(max_credits)) && 515 (max_credits > 0)) { 516 ALOGD("%s : max_credits=%d", __func__, max_credits); 517 HAL_NfcSetMaxRfDataCredits(max_credits); 518 } 519} 520 521/******************************************************************************* 522** 523** Function: mayDisableSecureElement 524** 525** Description: Optionally adjust a TLV to disable secure element. This 526*feature 527** is enabled by setting the system property 528** nfc.disable_secure_element to a bit mask represented by a 529*hex 530** octet: C0 = do not detect any secure element. 531** 40 = do not detect secure element in slot 0. 532** 80 = do not detect secure element in slot 1. 533** 534** config: a sequence of TLV's. 535** 536*******************************************************************************/ 537void mayDisableSecureElement(StartupConfig& config) { 538 unsigned int bitmask = 0; 539 char valueStr[PROPERTY_VALUE_MAX] = {0}; 540 int len = property_get("nfc.disable_secure_element", valueStr, ""); 541 if (len > 0) { 542 sscanf(valueStr, "%x", &bitmask); // read system property as a hex octet 543 ALOGD("%s: disable 0x%02X", __func__, (uint8_t)bitmask); 544 config.disableSecureElement((uint8_t)(bitmask & 0xC0)); 545 } 546} 547 548/******************************************************************************* 549** 550** Function: configureCrystalFrequency 551** 552** Description: Configure controller's crystal frequency by reading values from 553** .conf file. If .conf file does not define any value, then use 554** default values defined in struct nfc_post_reset_cb. 555** 556** Returns: none 557** 558*******************************************************************************/ 559void configureCrystalFrequency() { 560 unsigned long num = 0; 561 uint32_t hwId = 0; 562 uint16_t xtalFreq = 0; 563 uint8_t xtalIndex = 0; 564 int actualLen = 0; 565 566 if (GetNumValue(NAME_XTAL_HARDWARE_ID, &num, sizeof(num))) hwId = num; 567 568 if (GetNumValue(NAME_XTAL_FREQUENCY, &num, sizeof(num))) 569 xtalFreq = (uint16_t)num; 570 571 if (GetNumValue(NAME_XTAL_FREQ_INDEX, &num, sizeof(num))) 572 xtalIndex = (uint8_t)num; 573 574 actualLen = 575 GetStrValue(NAME_XTAL_PARAMS_CFG, (char*)sConfig, sizeof(sConfig)); 576 if (actualLen && 577 (xtalIndex == 578 NFC_HAL_XTAL_INDEX_SPECIAL)) // whether to use custom crystal frequency 579 { 580 sXtalCustomParam.append(sConfig, actualLen); 581 p_nfc_hal_dm_xtal_params_cfg = 582 const_cast<uint8_t*>(sXtalCustomParam.getInternalBuffer()); 583 } 584 585 if ((hwId == 0) && (xtalFreq == 0) && (xtalIndex == 0)) return; 586 587 ALOGD("%s: hwId=0x%" PRIX32 "; freq=%u; index=%u", __func__, hwId, xtalFreq, 588 xtalIndex); 589 nfc_post_reset_cb.dev_init_config.xtal_cfg[0].brcm_hw_id = 590 (hwId & BRCM_NFC_GEN_MASK); 591 nfc_post_reset_cb.dev_init_config.xtal_cfg[0].xtal_freq = xtalFreq; 592 nfc_post_reset_cb.dev_init_config.xtal_cfg[0].xtal_index = xtalIndex; 593 nfc_post_reset_cb.dev_init_config.num_xtal_cfg = 1; 594} 595