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