summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-08-07 17:41:45 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-01 00:06:55 +0200
commit95064bd95a822659f4a606b485aba5009d70fc88 (patch)
tree10954f10cafc7d9c3c307cffb54cb7b443dbdf7a
parentd953ada493711363d5b7f2151100c242923fc56b (diff)
NFC: trf7970a: Add quirk to keep EN2 low
A bug has been discovered in the trf7970a where it will generate an RF field even in passive target mode when EN2 is asserted. To work around this, add support for the 'en2-rf-quirk' device tree property which indicates that EN2 must remain low. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/trf7970a.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 3cc7001d7d2f..870867d645e0 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -36,7 +36,13 @@
* The trf7970a is very timing sensitive and the VIN, EN2, and EN
* pins must asserted in that order and with specific delays in between.
* The delays used in the driver were provided by TI and have been
- * confirmed to work with this driver.
+ * confirmed to work with this driver. There is a bug with the current
+ * version of the trf7970a that requires that EN2 remain low no matter
+ * what. If it goes high, it will generate an RF field even when in
+ * passive target mode. TI has indicated that the chip will work okay
+ * when EN2 is left low. The 'en2-rf-quirk' device tree property
+ * indicates that trf7970a currently being used has the erratum and
+ * that EN2 must be kept low.
*
* Timeouts are implemented using the delayed workqueue kernel facility.
* Timeouts are required so things don't hang when there is no response
@@ -133,6 +139,7 @@
* read continuous command for IRQ Status and Collision Position registers.
*/
#define TRF7970A_QUIRK_IRQ_STATUS_READ BIT(0)
+#define TRF7970A_QUIRK_EN2_MUST_STAY_LOW BIT(1)
/* Direct commands */
#define TRF7970A_CMD_IDLE 0x00
@@ -1309,6 +1316,9 @@ static int trf7970a_probe(struct spi_device *spi)
return ret;
}
+ if (of_property_read_bool(np, "en2-rf-quirk"))
+ trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
+
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
trf7970a_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"trf7970a", trf);
@@ -1455,8 +1465,11 @@ static int trf7970a_pm_runtime_resume(struct device *dev)
usleep_range(5000, 6000);
- gpio_set_value(trf->en2_gpio, 1);
- usleep_range(1000, 2000);
+ if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
+ gpio_set_value(trf->en2_gpio, 1);
+ usleep_range(1000, 2000);
+ }
+
gpio_set_value(trf->en_gpio, 1);
usleep_range(20000, 21000);