summaryrefslogtreecommitdiff
path: root/drivers/nfc/trf7970a.c
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-02 15:12:24 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 23:13:43 +0200
commit4e64eff837fb682dfb2a1188fb036d75ec57375c (patch)
treed28e1807b9f0c7a694975b7464574fbaecfc5a57 /drivers/nfc/trf7970a.c
parenta08e54549e743ea3704da939f92caf3eaa8471d3 (diff)
NFC: trf7970a: Add RF technology specific guard times
When turning on the RF field, the driver must wait an RF-technology-specific amount of time (known as the guard time) before modulating the field. Currently, the driver waits 5 ms but that is too short for NFCF and too long for ISO/IEC 15693. Fix this by determining the guard time when the RF technology is set and delaying that amount of time when turning on the RF field. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/trf7970a.c')
-rw-r--r--drivers/nfc/trf7970a.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index ce9686c44350..22485e703849 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -134,6 +134,12 @@
#define TRF7970A_WAIT_FOR_FIFO_DRAIN_TIMEOUT 3
#define TRF7970A_WAIT_TO_ISSUE_ISO15693_EOF 20
+/* Guard times for various RF technologies (in us) */
+#define TRF7970A_GUARD_TIME_NFCA 5000
+#define TRF7970A_GUARD_TIME_NFCB 5000
+#define TRF7970A_GUARD_TIME_NFCF 20000
+#define TRF7970A_GUARD_TIME_15693 1000
+
/* Quirks */
/* Erratum: When reading IRQ Status register on trf7970a, we must issue a
* read continuous command for IRQ Status and Collision Position registers.
@@ -351,6 +357,7 @@ struct trf7970a {
u8 iso_ctrl_tech;
u8 modulator_sys_clk_ctrl;
u8 special_fcn_reg1;
+ unsigned int guard_time;
int technology;
int framing;
u8 tx_cmd;
@@ -887,22 +894,27 @@ static int trf7970a_config_rf_tech(struct trf7970a *trf, int tech)
case NFC_DIGITAL_RF_TECH_106A:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_14443A_106;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK;
+ trf->guard_time = TRF7970A_GUARD_TIME_NFCA;
break;
case NFC_DIGITAL_RF_TECH_106B:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_14443B_106;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
+ trf->guard_time = TRF7970A_GUARD_TIME_NFCB;
break;
case NFC_DIGITAL_RF_TECH_212F:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_FELICA_212;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
+ trf->guard_time = TRF7970A_GUARD_TIME_NFCF;
break;
case NFC_DIGITAL_RF_TECH_424F:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_FELICA_424;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
+ trf->guard_time = TRF7970A_GUARD_TIME_NFCF;
break;
case NFC_DIGITAL_RF_TECH_ISO15693:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_15693_SGL_1OF4_2648;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK;
+ trf->guard_time = TRF7970A_GUARD_TIME_15693;
break;
default:
dev_dbg(trf->dev, "Unsupported rf technology: %d\n", tech);
@@ -971,7 +983,7 @@ static int trf7970a_config_framing(struct trf7970a *trf, int framing)
trf->chip_status_ctrl |= TRF7970A_CHIP_STATUS_RF_ON;
- usleep_range(5000, 6000);
+ usleep_range(trf->guard_time, trf->guard_time + 1000);
}
return 0;