mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 00:34:10 +08:00
NFC: digital: Set rf tech and crc functions when receiving a PSL_REQ
This patch sets the correct rf tech value and crc functions in target mode when receiving a PSL_REQ, as done when receiving an ATR_REQ. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
48e1044515
commit
b711ad524b
@ -380,6 +380,33 @@ int digital_in_send_dep_req(struct nfc_digital_dev *ddev,
|
|||||||
data_exch);
|
data_exch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void digital_tg_set_rf_tech(struct nfc_digital_dev *ddev, u8 rf_tech)
|
||||||
|
{
|
||||||
|
ddev->curr_rf_tech = rf_tech;
|
||||||
|
|
||||||
|
ddev->skb_add_crc = digital_skb_add_crc_none;
|
||||||
|
ddev->skb_check_crc = digital_skb_check_crc_none;
|
||||||
|
|
||||||
|
if (DIGITAL_DRV_CAPS_TG_CRC(ddev))
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (ddev->curr_rf_tech) {
|
||||||
|
case NFC_DIGITAL_RF_TECH_106A:
|
||||||
|
ddev->skb_add_crc = digital_skb_add_crc_a;
|
||||||
|
ddev->skb_check_crc = digital_skb_check_crc_a;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NFC_DIGITAL_RF_TECH_212F:
|
||||||
|
case NFC_DIGITAL_RF_TECH_424F:
|
||||||
|
ddev->skb_add_crc = digital_skb_add_crc_f;
|
||||||
|
ddev->skb_check_crc = digital_skb_check_crc_f;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
|
static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
|
||||||
struct sk_buff *resp)
|
struct sk_buff *resp)
|
||||||
{
|
{
|
||||||
@ -475,6 +502,8 @@ static void digital_tg_send_psl_res_complete(struct nfc_digital_dev *ddev,
|
|||||||
if (IS_ERR(resp))
|
if (IS_ERR(resp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
digital_tg_set_rf_tech(ddev, rf_tech);
|
||||||
|
|
||||||
digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech);
|
digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech);
|
||||||
|
|
||||||
digital_tg_listen(ddev, 1500, digital_tg_recv_dep_req, NULL);
|
digital_tg_listen(ddev, 1500, digital_tg_recv_dep_req, NULL);
|
||||||
@ -659,16 +688,10 @@ void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg,
|
|||||||
|
|
||||||
if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB) {
|
if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB) {
|
||||||
min_size = DIGITAL_ATR_REQ_MIN_SIZE + 2;
|
min_size = DIGITAL_ATR_REQ_MIN_SIZE + 2;
|
||||||
|
digital_tg_set_rf_tech(ddev, NFC_DIGITAL_RF_TECH_106A);
|
||||||
ddev->curr_rf_tech = NFC_DIGITAL_RF_TECH_106A;
|
|
||||||
ddev->skb_add_crc = digital_skb_add_crc_a;
|
|
||||||
ddev->skb_check_crc = digital_skb_check_crc_a;
|
|
||||||
} else {
|
} else {
|
||||||
min_size = DIGITAL_ATR_REQ_MIN_SIZE + 1;
|
min_size = DIGITAL_ATR_REQ_MIN_SIZE + 1;
|
||||||
|
digital_tg_set_rf_tech(ddev, NFC_DIGITAL_RF_TECH_212F);
|
||||||
ddev->curr_rf_tech = NFC_DIGITAL_RF_TECH_212F;
|
|
||||||
ddev->skb_add_crc = digital_skb_add_crc_f;
|
|
||||||
ddev->skb_check_crc = digital_skb_check_crc_f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp->len < min_size) {
|
if (resp->len < min_size) {
|
||||||
@ -676,11 +699,6 @@ void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DIGITAL_DRV_CAPS_TG_CRC(ddev)) {
|
|
||||||
ddev->skb_add_crc = digital_skb_add_crc_none;
|
|
||||||
ddev->skb_check_crc = digital_skb_check_crc_none;
|
|
||||||
}
|
|
||||||
|
|
||||||
ddev->curr_protocol = NFC_PROTO_NFC_DEP_MASK;
|
ddev->curr_protocol = NFC_PROTO_NFC_DEP_MASK;
|
||||||
|
|
||||||
rc = ddev->skb_check_crc(resp);
|
rc = ddev->skb_check_crc(resp);
|
||||||
|
Loading…
Reference in New Issue
Block a user