Skip to content

Commit 81995a4

Browse files
committed
R2.1 release update
1 parent 2a9df38 commit 81995a4

File tree

12 files changed

+425
-17
lines changed

12 files changed

+425
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Further details about the stack [here](https://github.com/NXPNFCLinux/linux_libn
88

99
Release version
1010
---------------
11-
R2.1 includes support for PN7150 NFC Controller IC
11+
R2.1 includes support for PN7150 NFC Controller IC and some bug fixes (refer to the [documentation](https://github.com/NXPNFCLinux/linux_libnfc-nci/blob/master/doc/AN11697%20-%20PN71x0%20Linux%20Software%20Stack%20Integration%20Guidelines.pdf) for more details).
1212

1313
R2.0 includes LLCP1.3 support and some bug fixes (refer to the [documentation](https://github.com/NXPNFCLinux/linux_libnfc-nci/blob/master/doc/AN11697%20-%20PN71x0%20Linux%20Software%20Stack%20Integration%20Guidelines.pdf) for more details).
1414

conf/PN7150/libnfc-nxp.conf

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ NXP_EXT_TVDD_CFG_2={20, 02, 07, 01, A0, 0E, 03, 06, 64, 00}
7575
###############################################################################
7676
# NXP Proprietary core configuration extensions
7777
# For more details refer to the NFC Controller User Manual
78-
NXP_CORE_CONF_EXTN={20, 02, 10, 03,
78+
NXP_CORE_CONF_EXTN={20, 02, 24, 04,
7979
A0, 5E, 01, 01,
8080
A0, 40, 01, 00,
81-
A0, 0D, 04, 34, 44, 22, 00
82-
}
81+
A0, 0D, 04, 34, 44, 22, 00,
82+
A0, 1D, 11, 57, 33, 14, 17, 00, AA, 85, 00, 80, 55, 2A, 04, 00, 63, 00, 00, 00
83+
}
8384

8485
###############################################################################
8586
# To enable i2c fragmentation set i2c fragmentation enable 0x01 to disable set to 0x00
@@ -101,4 +102,28 @@ NXP_CORE_CONF={ 20, 02, 2B, 0D,
101102
81, 01, 01,
102103
82, 01, 0E,
103104
18, 01, 01
104-
}
105+
}
106+
107+
###############################################################################
108+
# RF configuration settings
109+
NXP_RF_CONF_BLK_1={ 20, 02, A3, 13,
110+
A0, 0D, 06, 04, 35, 90, 01, F4, 01,
111+
A0, 0D, 06, 06, 44, 01, 90, 03, 00,
112+
A0, 0D, 06, 06, 30, B0, 01, 10, 00,
113+
A0, 0D, 06, 06, 42, 02, 00, FF, FF,
114+
A0, 0D, 03, 06, 3F, 06,
115+
A0, 0D, 06, 20, 42, 88, 00, FF, FF,
116+
A0, 0D, 04, 22, 44, 23, 00,
117+
A0, 0D, 06, 22, 2D, 50, 34, 0C, 00,
118+
A0, 0D, 06, 32, 42, F8, 00, FF, FF,
119+
A0, 0D, 06, 34, 2D, 24, 37, 0C, 00,
120+
A0, 0D, 06, 34, 33, 86, 80, 00, 70,
121+
A0, 0D, 04, 34, 44, 22, 00,
122+
A0, 0D, 06, 42, 2D, 15, 45, 0D, 00,
123+
A0, 0D, 04, 46, 44, 22, 00,
124+
A0, 0D, 06, 46, 2D, 05, 59, 0E, 00,
125+
A0, 0D, 06, 44, 42, 88, 00, FF, FF,
126+
A0, 0D, 06, 56, 2D, 05, 9F, 0C, 00,
127+
A0, 0D, 06, 54, 42, 88, 00, FF, FF,
128+
A0, 0D, 06, 0A, 33, 80, 86, 00, 70
129+
}
Binary file not shown.

src/halimpl/pn54x/common/phNfcStatus.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@
182182
*/
183183
#define NFCSTATUS_NOT_ALLOWED (0x003A)
184184

185+
/*
186+
* FW version error while performing FW download,
187+
* FW major version mismatch (cannot downgrade FW major version) or FW version already upto date
188+
* User may be trying to flash Mobile FW on top of Infra FW, which is not allowed
189+
* Download appropriate version of FW
190+
*/
191+
#define NFCSTATUS_FW_VERSION_ERROR (0x003C)
192+
185193
/*
186194
* The system is busy with the previous operation.
187195
*/

src/halimpl/pn54x/dnld/phDnldNfc.c

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
static void *pFwLibHandle; /* Global firmware lib handle used in this file only */
2929
uint16_t wMwVer = 0; /* Middleware version no */
3030
uint16_t wFwVer = 0; /* Firmware version no */
31+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
32+
uint8_t gRecFWDwnld; // flag set to true to indicate dummy FW download
33+
#endif
3134
static pphDnldNfc_DlContext_t gpphDnldContext = NULL; /* Download contex */
3235
static pphDnldNfc_RspCb_t UserCb; /* Upper layer call back function */
3336
static void* UserCtxt; /* Pointer to upper layer context */
@@ -869,7 +872,12 @@ NFCSTATUS phDnldNfc_InitImgInfo(void)
869872
phDnldNfc_SetHwDevHandle();
870873

871874
/* load the library and get the image info pointer */
872-
wStatus = phDnldNfc_LoadFW(FW_LIB_PATH, &pImageInfo, &ImageInfoLen);
875+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
876+
if (gRecFWDwnld == TRUE)
877+
wStatus = phDnldNfc_LoadRecoveryFW (FW_LIB_PATH, &pImageInfo, &ImageInfoLen);
878+
else
879+
#endif
880+
wStatus = phDnldNfc_LoadFW (FW_LIB_PATH, &pImageInfo, &ImageInfoLen);
873881

874882
NXPLOG_FWDNLD_D("FW Image Length - ImageInfoLen %d",ImageInfoLen);
875883
NXPLOG_FWDNLD_D("FW Image Info Pointer - pImageInfo %x",(uintptr_t)pImageInfo);
@@ -940,7 +948,12 @@ NFCSTATUS phDnldNfc_LoadRecInfo(void)
940948
/* if memory is not allocated then allocate memory for donwload context structure */
941949
phDnldNfc_SetHwDevHandle();
942950

943-
wStatus = phDnldNfc_LoadFW(PLATFORM_LIB_PATH, &pImageInfo, &ImageInfoLen);
951+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
952+
if (gRecFWDwnld == TRUE)
953+
wStatus = phDnldNfc_LoadRecoveryFW (PLATFORM_LIB_PATH, &pImageInfo, &ImageInfoLen);
954+
else
955+
#endif
956+
wStatus = phDnldNfc_LoadFW (PLATFORM_LIB_PATH, &pImageInfo, &ImageInfoLen);
944957

945958
if((pImageInfo == NULL) || (ImageInfoLen == 0))
946959
{
@@ -997,8 +1010,12 @@ NFCSTATUS phDnldNfc_LoadPKInfo(void)
9971010
phDnldNfc_SetHwDevHandle();
9981011

9991012
/* load the PKU image library */
1000-
wStatus = phDnldNfc_LoadFW(PKU_LIB_PATH, &pImageInfo, &ImageInfoLen);
1001-
1013+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
1014+
if (gRecFWDwnld == TRUE)
1015+
wStatus = phDnldNfc_LoadRecoveryFW (PKU_LIB_PATH, &pImageInfo, &ImageInfoLen);
1016+
else
1017+
#endif
1018+
wStatus = phDnldNfc_LoadFW (PKU_LIB_PATH, &pImageInfo, &ImageInfoLen);
10021019
if((pImageInfo == NULL) || (ImageInfoLen == 0))
10031020
{
10041021
NXPLOG_FWDNLD_E("Image extraction Failed - invalid imginfo or imginfolen!!");
@@ -1167,6 +1184,75 @@ NFCSTATUS phDnldNfc_UnloadFW(void)
11671184
return wStatus;
11681185
}
11691186

1187+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
1188+
/*******************************************************************************
1189+
**
1190+
** Function phDnldNfc_LoadRecoveryFW
1191+
**
1192+
** Description Load the dummy firmware version form firmware lib for recovery
1193+
** This will change the FW version of the NFCC firmware
1194+
** and enable flashing of firmware of same version.
1195+
**
1196+
** Parameters pathName - Firmware image path
1197+
** pImgInfo - Firmware image handle
1198+
** pImgInfoLen - Firmware image length
1199+
**
1200+
** Returns NFCSTATUS
1201+
**
1202+
*******************************************************************************/
1203+
NFCSTATUS phDnldNfc_LoadRecoveryFW (const char* pathName, uint8_t **pImgInfo, uint16_t* pImgInfoLen)
1204+
{
1205+
void* pImageInfo = NULL;
1206+
void* pImageInfoLen = NULL;
1207+
1208+
/* check for path name */
1209+
if (pathName == NULL)
1210+
{
1211+
pathName = "/system/vendor/firmware/libpn548ad_fw.so";
1212+
}
1213+
1214+
/* check if the handle is not NULL then free the library */
1215+
if (pFwLibHandle != NULL)
1216+
{
1217+
phDnldNfc_UnloadFW ();
1218+
pFwLibHandle = NULL;
1219+
}
1220+
/* load the DLL file */
1221+
pFwLibHandle = dlopen (pathName, RTLD_LAZY);
1222+
NXPLOG_FWDNLD_D ("phDnldNfc_LoadRecoveryFW %s ", pathName);
1223+
1224+
/* if library load failed then handle will be NULL */
1225+
if (pFwLibHandle == NULL)
1226+
{
1227+
NXPLOG_FWDNLD_E("NULL handler : unable to load the library file, specify correct path");
1228+
return NFCSTATUS_FAILED;
1229+
}
1230+
1231+
dlerror (); /* Clear any existing error */
1232+
1233+
/* load the address of download image pointer and image size */
1234+
pImageInfo = (void*)dlsym (pFwLibHandle, "gphDnldNfc_DummyDlSeq");
1235+
1236+
if (dlerror() || (NULL == pImageInfo))
1237+
{
1238+
NXPLOG_FWDNLD_E ("Problem loading symbol : gphDnldNfc_DummyDlSeq");
1239+
return NFCSTATUS_FAILED;
1240+
}
1241+
1242+
(*pImgInfo) = (*(uint8_t**)pImageInfo);
1243+
pImageInfoLen = (void*)dlsym (pFwLibHandle, "gphDnldNfc_DlSeqDummyFwSz");
1244+
if (dlerror() ||(NULL == pImageInfoLen))
1245+
{
1246+
NXPLOG_FWDNLD_E ("Problem loading symbol : gphDnldNfc_DlSeqDummyFwSz");
1247+
return NFCSTATUS_FAILED;
1248+
}
1249+
1250+
(*pImgInfoLen) = (uint16_t)(*((uint16_t*)pImageInfoLen));
1251+
1252+
return NFCSTATUS_SUCCESS;
1253+
}
1254+
#endif
1255+
11701256
#ifdef EEPROM_Read_Mem_IMP
11711257
/*******************************************************************************
11721258
**

src/halimpl/pn54x/dnld/phDnldNfc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,8 @@ extern NFCSTATUS phDnldNfc_LoadRecInfo(void);
104104
extern NFCSTATUS phDnldNfc_LoadPKInfo(void);
105105
extern void phDnldNfc_CloseFwLibHandle(void);
106106
extern NFCSTATUS phDnldNfc_LoadFW(const char* pathName, uint8_t **pImgInfo, uint16_t* pImgInfoLen);
107+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
108+
extern NFCSTATUS phDnldNfc_LoadRecoveryFW (const char* pathName, uint8_t **pImgInfo, uint16_t* pImgInfoLen);
109+
#endif
107110
extern NFCSTATUS phDnldNfc_UnloadFW(void);
108111
#endif /* PHDNLDNFC_H */

src/halimpl/pn54x/dnld/phDnldNfc_Internal.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ static void phDnldNfc_ProcessSeqState(void *pContext, phTmlNfc_TransactInfo_t *p
275275
(pphTmlNfc_TransactCompletionCb_t)&phDnldNfc_ProcessSeqState,
276276
(void *)pDlCtxt);
277277

278+
/* set read status to pDlCtxt->wCmdSendStatus to enable callback */
279+
pDlCtxt->wCmdSendStatus = wStatus;
278280
break;
279281
}
280282
else
@@ -454,6 +456,8 @@ static void phDnldNfc_ProcessRWSeqState(void *pContext, phTmlNfc_TransactInfo_t
454456
(pphTmlNfc_TransactCompletionCb_t)&phDnldNfc_ProcessRWSeqState,
455457
(void *)pDlCtxt);
456458

459+
/* set read status to pDlCtxt->wCmdSendStatus to enable callback */
460+
pDlCtxt->wCmdSendStatus = wStatus;
457461
break;
458462
}
459463
else
@@ -1232,12 +1236,12 @@ static NFCSTATUS phDnldNfc_UpdateRsp(pphDnldNfc_DlContext_t pDlContext, phTmlN
12321236
}
12331237
else if(PH_DL_STATUS_FIRMWARE_VERSION_ERROR == (pInfo->pBuff[PHDNLDNFC_FRAMESTATUS_OFFSET]))
12341238
{
1235-
NXPLOG_FWDNLD_E("Firmware Already Up To Date!!");
1239+
NXPLOG_FWDNLD_E("FW version Error !!!could be either due to FW major version mismatch or Firmware Already Up To Date !!");
12361240
(pDlContext->tRWInfo.bFirstWrReq) = FALSE;
12371241
/* resetting wRemBytes to 0 to avoid any further write frames send */
12381242
(pDlContext->tRWInfo.wRemBytes) = 0;
12391243
(pDlContext->tRWInfo.wOffset) = 0;
1240-
wStatus = NFCSTATUS_SUCCESS;
1244+
wStatus = NFCSTATUS_FW_VERSION_ERROR;
12411245
}
12421246
else if(PH_DL_STATUS_PLL_ERROR == (pInfo->pBuff[PHDNLDNFC_FRAMESTATUS_OFFSET]))
12431247
{

src/halimpl/pn54x/dnld/phNxpNciHal_Dnld.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
/* External global variable to get FW version */
3636
extern uint16_t wFwVer;
3737
extern uint16_t wMwVer;
38+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
39+
extern uint8_t gRecFWDwnld;
40+
#endif
3841

3942
/* RF Configuration structure */
4043
typedef struct phLibNfc_IoctlSetRfConfig
@@ -179,6 +182,20 @@ static NFCSTATUS (*phNxpNciHal_dwnld_seqhandler[])(
179182
NULL
180183
};
181184

185+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
186+
/* Array of pointers to start dummy fw download seq */
187+
static NFCSTATUS (*phNxpNciHal_dummy_rec_dwnld_seqhandler[])(
188+
void* pContext, NFCSTATUS status, void* pInfo) = {
189+
phNxpNciHal_fw_dnld_normal,
190+
phNxpNciHal_fw_dnld_normal,
191+
phNxpNciHal_fw_dnld_get_sessn_state,
192+
phNxpNciHal_fw_dnld_get_version,
193+
phNxpNciHal_fw_dnld_log_read,
194+
phNxpNciHal_fw_dnld_write,
195+
NULL
196+
};
197+
#endif
198+
182199
/* Download Recovery Sequence */
183200
static NFCSTATUS (*phNxpNciHal_dwnld_rec_seqhandler[])(
184201
void* pContext, NFCSTATUS status, void* pInfo) = {
@@ -1671,6 +1688,12 @@ static NFCSTATUS phNxpNciHal_fw_dnld_complete(void* pContext,NFCSTATUS status,
16711688
(gphNxpNciHal_fw_IoctlCtx.bDnldInitiated) = FALSE;
16721689
/* Perform the Logging sequence */
16731690
wStatus = phNxpNciHal_fw_seq_handler(phNxpNciHal_dwnld_log_seqhandler);
1691+
if (NFCSTATUS_SUCCESS != gphNxpNciHal_fw_IoctlCtx.bLastStatus)
1692+
{
1693+
/* update the previous Download Write status to upper layer and not the status of Log command */
1694+
wStatus = gphNxpNciHal_fw_IoctlCtx.bLastStatus;
1695+
NXPLOG_FWDNLD_E ("phNxpNciHal_fw_dnld_complete: Last Download Write Status before Log command bLastStatus = 0x%x", gphNxpNciHal_fw_IoctlCtx.bLastStatus);
1696+
}
16741697
status = phNxpNciHal_fw_dnld_complete(pContext, wStatus, &pInfo);
16751698
if (NFCSTATUS_SUCCESS == status)
16761699
{
@@ -1680,7 +1703,6 @@ static NFCSTATUS phNxpNciHal_fw_dnld_complete(void* pContext,NFCSTATUS status,
16801703
{
16811704
NXPLOG_FWDNLD_E(" phNxpNciHal_fw_dnld_complete : FAILED");
16821705
}
1683-
16841706
}
16851707
else if(TRUE == (gphNxpNciHal_fw_IoctlCtx.bDnldRecovery))
16861708
{
@@ -1727,6 +1749,7 @@ static NFCSTATUS phNxpNciHal_fw_dnld_complete(void* pContext,NFCSTATUS status,
17271749
}
17281750
else
17291751
{
1752+
NXPLOG_FWDNLD_D ("phNxpNciHal_fw_dnld_complete: Download Status = 0x%x", status);
17301753
if(FALSE == (gphNxpNciHal_fw_IoctlCtx.bSkipSeq))
17311754
{
17321755
if(NFCSTATUS_SUCCESS == status)
@@ -1854,7 +1877,16 @@ NFCSTATUS phNxpNciHal_fw_download_seq(uint8_t bClkSrcVal, uint8_t bClkFreqVal)
18541877
if (NFCSTATUS_SUCCESS == phDnldNfc_InitImgInfo())
18551878
{
18561879
NXPLOG_FWDNLD_D("phDnldNfc_InitImgInfo:SUCCESS");
1857-
status = phNxpNciHal_fw_seq_handler(phNxpNciHal_dwnld_seqhandler);
1880+
#if(NFC_NXP_CHIP_TYPE == PN548C2)
1881+
if (gRecFWDwnld == TRUE)
1882+
{
1883+
status = phNxpNciHal_fw_seq_handler (phNxpNciHal_dummy_rec_dwnld_seqhandler);
1884+
}
1885+
else
1886+
#endif
1887+
{
1888+
status = phNxpNciHal_fw_seq_handler (phNxpNciHal_dwnld_seqhandler);
1889+
}
18581890
}
18591891
else
18601892
{

0 commit comments

Comments
 (0)