[T-Mobile Samsung Galaxy S II SGH-T989] mrcrassic:
The main problem behind NFC not working seems to be when it tries to download firmware info from the chip. It fails:

D/NFC JNI ( 9792): Start Initialization
W/NFC_i2c ( 9792): sleeping a little longer...
D/NFC JNI ( 9792): Download new Firmware
W/NFC JNI ( 9792): Firmware update FAILED
D/NFC JNI ( 9792): Download new Firmware
D/dalvikvm( 879): GC_EXPLICIT freed 50K, 52% free 2751K/5639
paused 22ms
W/NFC_i2c ( 9792): sleeping a little longer...
W/NFC JNI ( 9792): Firmware update FAILED
D/NFC JNI ( 9792): Download new Firmware
W/NFC JNI ( 9792): Firmware update FAILED
E/NFC JNI ( 9792): Unable to update firmware, giving up
D/NFC JNI ( 9792): Terminating client thread...
W/NfcService( 9792): Error enabling NFC
W/NfcEnabler( 1415): Error setting NFC enabled state to true

Interestingly enough, it's trying to do this because it's failing to initialize the device in an expected way:

TRACE("phLibNfc_Mgt_Initialize()");
REENTRANCE_LOCK();
status = phLibNfc_Mgt_Initialize(gHWRef, nfc_jni_init_callback, (void *)&cb_data);

...

/* Initialization Status */
if(cb_data.status != NFCSTATUS_SUCCESS)
{
update = FALSE;
goto force_download;
}

(I think this is where the code hits since nothing appears in logcat before trying to force a download like the other scenarios would produce)

Let's dig a little deeper into this...

NFCSTATUS phLibNfc_Mgt_Initialize(void *pDriverHandle,
pphLibNfc_RspCb_t pInitCb,
void *pContext)
{
NFCSTATUS Status = NFCSTATUS_SUCCESS;
...

This is where more work is needed. It's failing to initialise the chip for some reason (hence why a github or similar would be nice :) )

I'm going to try and get a log from the backup I did when I had stock to see if it also forces a download there. I'm going to assume that Samsung did not change the core NFC libraries.

The relevant bits of the forced download:

LOGD("Download new Firmware");
REENTRANCE_LOCK();
status = phLibNfc_Mgt_IoCtl(gHWRef,NFC_FW_DOWNLOAD, &gInputParam, &gOutputParam, nfc_jni_ioctl_callback, (void *)&cb_data);

It then goes to NFC library to init the download, which then relays to actual chip:

case NFC_FW_DOWNLOAD:
{/* Set power status */
phLibNfc_Ioctl_Cntx.psHwReference = phOsalNfc_GetMemory((uint32_t)sizeof(phHal_sHwReference_t));
if(phLibNfc_Ioctl_Cntx.psHwReference == NULL)
return NFCSTATUS_FAILED;
(void)memset(phLibNfc_Ioctl_Cntx.psHwReference,0,sizeof(phHal_sHwReference_t));
phLibNfc_Ioctl_Cntx.psHwReference->p_board_driver = pDalHandle;

StatusCode = phHal4Nfc_Ioctl( phLibNfc_Ioctl_Cntx.psHwReference,
NFC_FW_DOWNLOAD,
pInParam,
pOutParam,
phLibNfc_Ioctl_Mgmt_CB,
&phLibNfc_Ioctl_Cntx );

Refs:

[link=http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/]Android 4.0 Source[/link]

[link=https://github.com/CyanogenMod]Cyanogenmod 7.2 Source[/link]

---------- Post added at 07:15 AM ---------- Previous post was at 07:05 AM ----------

These are the properties the NFC chip need to be set to for it to work (from Samsung official ROM):

D/NFC JNI ( 417): > Set LLCP LTO to 150

D/NFC JNI ( 417): > Set LLCP MIU to 128

D/NFC JNI ( 417): > Set LLCP WKS to 1

D/NFC JNI ( 417): > Set LLCP OPT to 0

D/NFC JNI ( 417): > Set NFC DISCOVERY A to 1

D/NFC JNI ( 417): > Set NFC DISCOVERY B to 1

D/NFC JNI ( 417): > Set NFC DISCOVERY F to 1

D/NFC JNI ( 417): > Set NFC DISCOVERY 15693 to 1

D/NFC JNI ( 417): > Set NFC DISCOVERY NFCIP to 1

The mystery, of course, is in retrieving the method for actually doing this :)

---------- Post added at 07:41 AM ---------- Previous post was at 07:15 AM ----------

GO STUPID

private void applyProperties() {
mManager.doSetProperties(PROPERTY_LLCP_LTO, mPrefs.getInt(PREF_LLCP_LTO, LLCP_LTO_DEFAULT));
mManager.doSetProperties(PROPERTY_LLCP_MIU, mPrefs.getInt(PREF_LLCP_MIU, LLCP_MIU_DEFAULT));
mManager.doSetProperties(PROPERTY_LLCP_WKS, mPrefs.getInt(PREF_LLCP_WKS, LLCP_WKS_DEFAULT));
mManager.doSetProperties(PROPERTY_LLCP_OPT, mPrefs.getInt(PREF_LLCP_OPT, LLCP_OPT_DEFAULT));
mManager.doSetProperties(PROPERTY_NFC_DISCOVERY_A,
mPrefs.getBoolean(PREF_DISCOVERY_A, DISCOVERY_A_DEFAULT) ? 1 : 0);
mManager.doSetProperties(PROPERTY_NFC_DISCOVERY_B,
mPrefs.getBoolean(PREF_DISCOVERY_B, DISCOVERY_B_DEFAULT) ? 1 : 0);
mManager.doSetProperties(PROPERTY_NFC_DISCOVERY_F,
mPrefs.getBoolean(PREF_DISCOVERY_F, DISCOVERY_F_DEFAULT) ? 1 : 0);
mManager.doSetProperties(PROPERTY_NFC_DISCOVERY_15693,
mPrefs.getBoolean(PREF_DISCOVERY_15693, DISCOVERY_15693_DEFAULT) ? 1 : 0);
mManager.doSetProperties(PROPERTY_NFC_DISCOVERY_NFCIP,
mPrefs.getBoolean(PREF_DISCOVERY_NFCIP, DISCOVERY_NFCIP_DEFAULT) ? 1 : 0);
}

You will need to set these in Nfc.apk, but they

might

be settable from a conf file. You can also hardcode these into NfcManager in core but these might be individual device specific.

---------- Post added at 08:00 AM ---------- Previous post was at 07:41 AM ----------

GPS works excellently. Several locks in less than 10 seconds from my window.