高通NFC移植

------------------------------------------------------------

Android-2.3.4----------------------------------------------------

------------------------------------------------------------

1,Z:\gingerbread\system\core\rootdir\init.rc

add the line:

setprop ro.nfc.port I2C

------------------------------

2,Z:\gingerbread\system\core\rootdir\ueventd.rc

add the line:

/dev/pn544                0777   root      root

------------------------------

3,Z:\gingerbread\build\target\product\core.mk

a. add the lines:

   libnfc \

   libnfc_jni \

   Nfc \

   Tag \

   //此行暂时不加,此功能未卡模拟NfcSecureElement \

in the PRODUCT_PACKAGES.

b. add the lines:

PRODUCT_COPY_FILES := \

   frameworks/base/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml

4,Z:\gingerbread\external\libnfc-nxp\inc\phNfcConfig.h

-#define DEFAULT_SESSION           "android7"

+#define DEFAULT_SESSION           "android8"

-#defineDEFAULT_NFCIP_TARGET_MODE_SUPPORT     0x0FU

+#defineDEFAULT_NFCIP_TARGET_MODE_SUPPORT      0x0EU

5,Z:\gingerbread\external\libnfc-nxp\Android.mk

Add:

#add to choose different project based onproduct config

LOCAL_CFLAGS += -DCONFIG_VENDOR_PRODUCT

LOCAL_CFLAGS += -DCONFIG_$(shell echo -n$(TARGET_HW_BOARD)| tr a-z A-Z)

ifneq ($(TARGET_HW_BOARD_VER),)

LOCAL_CFLAGS += -DCONFIG_$(shell echo -n$(TARGET_HW_BOARD_VER)| tr a-z A-Z)

else

LOCAL_CFLAGS += -DCONFIG_$(shell echo -n$(TARGET_HW_BOARD)| tr a-z A-Z)P1

endif

#zhangjl add for nfc

ifeq ($(TARGET_HW_BOARD),ua9600)

LOCAL_CFLAGS += -DNFC_CUSTOM_CONFIG_INCLUDE

# libpn544_fw.so: Copy pn544 firmwarelibrary to system/lib

PRODUCT_COPY_FILES +=$(LOCAL_PATH)/firmware/pn544/libpn544_fw.so:system/lib/libpn544_fw.so

else ifeq ($(TARGET_HW_BOARD),ca9600)

LOCAL_CFLAGS += -DNFC_CUSTOM_CONFIG_INCLUDE

# libpn544_fw.so: Copy pn544 firmwarelibrary to system/lib

PRODUCT_COPY_FILES +=$(LOCAL_PATH)/firmware/pn544/libpn544_fw.so:system/lib/libpn544_fw.so

else ifeq ($(TARGET_HW_BOARD),ua6308)

LOCAL_CFLAGS += -DNFC_CUSTOM_CONFIG_INCLUDE

# libpn544_fw.so: Copy pn544 firmwarelibrary to system/lib

PRODUCT_COPY_FILES +=$(LOCAL_PATH)/firmware/pn544/libpn544_fw.so:system/lib/libpn544_fw.so

endif

6,Add:Z:\gingerbread\external\libnfc-nxp\firmware\pn544\libpn544_fw.so

7,Z:\gingerbread\external\libnfc-nxp\inc\nfc_custom_config.h

//zhangjl modified for nfc 使用内部时钟

#if defined (CONFIG_PROJECT)

#define NXP_DEFAULT_INPUT_CLK           0x02U

#else

#define NXP_DEFAULT_INPUT_CLK           0x00U

#endif

------------------------------------------------------------

linux-2.6.36-android----------------------------------------------------

------------------------------------------------------------

Z:\gingerbread\kernel\arch\arm\mach-msm\board-ua9600.c

1. add theline:

#ifdefCONFIG_PN544_NFC_WPG

#include<linux/nfc/pn544_wpg.h>

#include <mach/irqs.h>

#endif

2. add thelines:

//zhangjl add for pn544

#ifdef CONFIG_PN544_NFC_WPG

static struct pn544_i2c_platform_datapn544_pdata = {

       .irq_gpio= 38,//NFC_IRQ,

       .ven_gpio= 33,//NFC_EN,

       .firm_gpio= 49,//NFC_FIRM,

};

static struct i2c_board_info i2c_nfc_devices[]__initdata = {

       {

              I2C_BOARD_INFO("pn544", 0x28),

              .irq = MSM_GPIO_TO_INT(38),//IRQ_EINT(38)

              .platform_data = &pn544_pdata,

       },          

};

#endif

3,

Add

#ifdef CONFIG_PN544_NFC_WPG

static void __init msm7x27_init_nfc(void)

{

       //zhangjladd for nfc

       gpio_tlmm_config(GPIO_CFG(49,0,

                                   GPIO_CFG_OUTPUT,GPIO_CFG_NO_PULL,

                                   GPIO_CFG_2MA),GPIO_CFG_ENABLE);

       gpio_tlmm_config(GPIO_CFG(33,0,

                                   GPIO_CFG_OUTPUT,GPIO_CFG_NO_PULL,

                                   GPIO_CFG_2MA),GPIO_CFG_ENABLE);

}

#endif

4,add

       #ifdefCONFIG_PN544_NFC_WPG

              msm7x27_init_nfc();

       #endif

5,add

#ifdef CONFIG_PN544_NFC_WPG

       i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,

                     i2c_nfc_devices,

                     ARRAY_SIZE(i2c_nfc_devices));

#endif

------------------------------

add the files below:

Z:\gingerbread\kernel\drivers\nfc\pn544_wpg.c

Z:\gingerbread\kernel\include\linux\nfc\pn544_wpg.h

Z:\gingerbread\kernel\drivers\nfc\Kconfig

Add:

#zhangjl add for wpg nfc 

config PN544_NFC_WPG

       tristate"WPG PN544 NFC driver"

       dependson I2C

       selectCRC_CCITT

       defaultn

       ---help---

         Say yes if you want WPG PN544 Near FieldCommunication driver.

         This is for i2c connected version. If unsure,say N here.

         To compile this driver as a module, choose mhere. The module will

         be called pn544.

Z:\gingerbread\kernel\drivers\nfc\Makefile

Add:

#zhangjl add for wpg nfc 

obj-$(CONFIG_PN544_NFC_WPG)           +=pn544_wpg.o

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//以下为卡模拟补丁,暂时不需要打

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

2.Z:\gingerbread\framework/base

patch-p1<1-Patch-to-add-Nfc-Secure-Element-APIs.patch

3.Z:\gingerbread\packages/apps/Nfc

patch-p1<1-Patch-to-update-Secure-Element-management-in-the-Nfc.patch

4.Z:\gingerbread\packages/apps

copy NfcSecureElement

猜你喜欢

转载自blog.csdn.net/junwua/article/details/81022609
NFC