diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-29 19:48:46 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-06-04 15:34:32 -0400 |
commit | 51d9e803b906ea8ef995980d5367ab66ff79305a (patch) | |
tree | ba43cb0d22074d89b825d31fb88afd1966ee8dcc /drivers/nfc/pn533.c | |
parent | d7f3345d3af568394080890ca3136c4ea1021cba (diff) |
NFC: Add type A and type F parameters for pn533 target mode
Without those settings several devices will not activate pn533 as a target.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r-- | drivers/nfc/pn533.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 806ab3da6414..6e4b228c7e6f 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -1126,6 +1126,13 @@ static int pn533_init_target_frame(struct pn533_frame *frame, | |||
1126 | { | 1126 | { |
1127 | struct pn533_cmd_init_target *cmd; | 1127 | struct pn533_cmd_init_target *cmd; |
1128 | size_t cmd_len; | 1128 | size_t cmd_len; |
1129 | u8 felica_params[18] = {0x1, 0xfe, /* DEP */ | ||
1130 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* random */ | ||
1131 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, | ||
1132 | 0xff, 0xff}; /* System code */ | ||
1133 | u8 mifare_params[6] = {0x1, 0x1, /* SENS_RES */ | ||
1134 | 0x0, 0x0, 0x0, | ||
1135 | 0x40}; /* SEL_RES for DEP */ | ||
1129 | 1136 | ||
1130 | cmd_len = sizeof(struct pn533_cmd_init_target) + gb_len + 1; | 1137 | cmd_len = sizeof(struct pn533_cmd_init_target) + gb_len + 1; |
1131 | cmd = kzalloc(cmd_len, GFP_KERNEL); | 1138 | cmd = kzalloc(cmd_len, GFP_KERNEL); |
@@ -1136,17 +1143,33 @@ static int pn533_init_target_frame(struct pn533_frame *frame, | |||
1136 | 1143 | ||
1137 | /* DEP support only */ | 1144 | /* DEP support only */ |
1138 | cmd->mode |= PN533_INIT_TARGET_DEP; | 1145 | cmd->mode |= PN533_INIT_TARGET_DEP; |
1139 | get_random_bytes(cmd->nfcid3, 10); | 1146 | |
1147 | /* Felica params */ | ||
1148 | memcpy(cmd->felica, felica_params, 18); | ||
1149 | get_random_bytes(cmd->felica + 2, 6); | ||
1150 | |||
1151 | /* NFCID3 */ | ||
1152 | memset(cmd->nfcid3, 0, 10); | ||
1153 | memcpy(cmd->nfcid3, cmd->felica, 8); | ||
1154 | |||
1155 | /* MIFARE params */ | ||
1156 | memcpy(cmd->mifare, mifare_params, 6); | ||
1157 | |||
1158 | /* General bytes */ | ||
1140 | cmd->gb_len = gb_len; | 1159 | cmd->gb_len = gb_len; |
1141 | memcpy(cmd->gb, gb, gb_len); | 1160 | memcpy(cmd->gb, gb, gb_len); |
1161 | |||
1142 | /* Len Tk */ | 1162 | /* Len Tk */ |
1143 | cmd->gb[gb_len] = 0; | 1163 | cmd->gb[gb_len] = 0; |
1144 | 1164 | ||
1145 | memcpy(PN533_FRAME_CMD_PARAMS_PTR(frame), cmd, cmd_len); | 1165 | memcpy(PN533_FRAME_CMD_PARAMS_PTR(frame), cmd, cmd_len); |
1166 | |||
1146 | frame->datalen += cmd_len; | 1167 | frame->datalen += cmd_len; |
1147 | 1168 | ||
1148 | pn533_tx_frame_finish(frame); | 1169 | pn533_tx_frame_finish(frame); |
1149 | 1170 | ||
1171 | kfree(cmd); | ||
1172 | |||
1150 | return 0; | 1173 | return 0; |
1151 | } | 1174 | } |
1152 | 1175 | ||