diff options
author | Mark A. Greer <mgreer@animalcreek.com> | 2014-08-07 20:41:43 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-08-31 18:06:55 -0400 |
commit | 772079eb77587e0242752fa67685a8132d899f79 (patch) | |
tree | 95a2cf8ec54431093321b6f3f3e0ec5381007f96 /drivers/nfc | |
parent | c2b33de06d23e66f9df34f515704cd3bfa8dd260 (diff) |
NFC: trf7970a: Move IRQ Status Read quirk to device tree
The quirk indicating whether the trf7970a has
the "IRQ Status Read" erratum or not is currently
implemented using the 'driver_data' member of the
'spi_device_id' structure. That requires the
driver to be modified to turn the quirk off when
a version of the trf7970a that doesn't have the
erratum is being used. To fix that, create a
new device tree property called
'irq-status-read-quirk' that indicates that the
trf7970a being used has the erratum.
While at it, rename 'TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA'
to 'TRF7970A_QUIRK_IRQ_STATUS_READ' to make it
less of an eyesore.
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/trf7970a.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index 5355d0e4c045..3cc7001d7d2f 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c | |||
@@ -132,7 +132,7 @@ | |||
132 | /* Erratum: When reading IRQ Status register on trf7970a, we must issue a | 132 | /* Erratum: When reading IRQ Status register on trf7970a, we must issue a |
133 | * read continuous command for IRQ Status and Collision Position registers. | 133 | * read continuous command for IRQ Status and Collision Position registers. |
134 | */ | 134 | */ |
135 | #define TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA BIT(0) | 135 | #define TRF7970A_QUIRK_IRQ_STATUS_READ BIT(0) |
136 | 136 | ||
137 | /* Direct commands */ | 137 | /* Direct commands */ |
138 | #define TRF7970A_CMD_IDLE 0x00 | 138 | #define TRF7970A_CMD_IDLE 0x00 |
@@ -424,7 +424,7 @@ static int trf7970a_read_irqstatus(struct trf7970a *trf, u8 *status) | |||
424 | 424 | ||
425 | addr = TRF7970A_IRQ_STATUS | TRF7970A_CMD_BIT_RW; | 425 | addr = TRF7970A_IRQ_STATUS | TRF7970A_CMD_BIT_RW; |
426 | 426 | ||
427 | if (trf->quirks & TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA) { | 427 | if (trf->quirks & TRF7970A_QUIRK_IRQ_STATUS_READ) { |
428 | addr |= TRF7970A_CMD_BIT_CONTINUOUS; | 428 | addr |= TRF7970A_CMD_BIT_CONTINUOUS; |
429 | ret = spi_write_then_read(trf->spi, &addr, 1, buf, 2); | 429 | ret = spi_write_then_read(trf->spi, &addr, 1, buf, 2); |
430 | } else { | 430 | } else { |
@@ -1260,7 +1260,6 @@ static int trf7970a_get_vin_voltage_override(struct device_node *np, | |||
1260 | static int trf7970a_probe(struct spi_device *spi) | 1260 | static int trf7970a_probe(struct spi_device *spi) |
1261 | { | 1261 | { |
1262 | struct device_node *np = spi->dev.of_node; | 1262 | struct device_node *np = spi->dev.of_node; |
1263 | const struct spi_device_id *id = spi_get_device_id(spi); | ||
1264 | struct trf7970a *trf; | 1263 | struct trf7970a *trf; |
1265 | int uvolts, autosuspend_delay, ret; | 1264 | int uvolts, autosuspend_delay, ret; |
1266 | 1265 | ||
@@ -1276,11 +1275,13 @@ static int trf7970a_probe(struct spi_device *spi) | |||
1276 | trf->state = TRF7970A_ST_OFF; | 1275 | trf->state = TRF7970A_ST_OFF; |
1277 | trf->dev = &spi->dev; | 1276 | trf->dev = &spi->dev; |
1278 | trf->spi = spi; | 1277 | trf->spi = spi; |
1279 | trf->quirks = id->driver_data; | ||
1280 | 1278 | ||
1281 | spi->mode = SPI_MODE_1; | 1279 | spi->mode = SPI_MODE_1; |
1282 | spi->bits_per_word = 8; | 1280 | spi->bits_per_word = 8; |
1283 | 1281 | ||
1282 | if (of_property_read_bool(np, "irq-status-read-quirk")) | ||
1283 | trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ; | ||
1284 | |||
1284 | /* There are two enable pins - both must be present */ | 1285 | /* There are two enable pins - both must be present */ |
1285 | trf->en_gpio = of_get_named_gpio(np, "ti,enable-gpios", 0); | 1286 | trf->en_gpio = of_get_named_gpio(np, "ti,enable-gpios", 0); |
1286 | if (!gpio_is_valid(trf->en_gpio)) { | 1287 | if (!gpio_is_valid(trf->en_gpio)) { |
@@ -1478,7 +1479,7 @@ static const struct dev_pm_ops trf7970a_pm_ops = { | |||
1478 | }; | 1479 | }; |
1479 | 1480 | ||
1480 | static const struct spi_device_id trf7970a_id_table[] = { | 1481 | static const struct spi_device_id trf7970a_id_table[] = { |
1481 | { "trf7970a", TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA }, | 1482 | { "trf7970a", 0 }, |
1482 | { } | 1483 | { } |
1483 | }; | 1484 | }; |
1484 | MODULE_DEVICE_TABLE(spi, trf7970a_id_table); | 1485 | MODULE_DEVICE_TABLE(spi, trf7970a_id_table); |