aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorVincent Cuissard <cuissard@marvell.com>2015-10-26 05:27:43 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2015-10-26 23:23:34 -0400
commit2bd832459a0827b8dcf13b345380b66f92089d74 (patch)
tree4394c323d19ae4979a91a73aa780c57d90e09f1c /net/nfc
parentfcd9d046fd8998cc984f2ff80e76f246ebca15b6 (diff)
NFC: NCI: allow spi driver to choose transfer clock
In some cases low level drivers might want to update the SPI transfer clock (e.g. during firmware download). This patch adds this support. Without any modification the driver will use the default SPI clock (from pdata or device tree). Signed-off-by: Vincent Cuissard <cuissard@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/nci/spi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c
index 25153d0e33cf..d904cd2f1442 100644
--- a/net/nfc/nci/spi.c
+++ b/net/nfc/nci/spi.c
@@ -58,6 +58,7 @@ static int __nci_spi_send(struct nci_spi *nspi, struct sk_buff *skb,
58 } 58 }
59 t.cs_change = cs_change; 59 t.cs_change = cs_change;
60 t.delay_usecs = nspi->xfer_udelay; 60 t.delay_usecs = nspi->xfer_udelay;
61 t.speed_hz = nspi->xfer_speed_hz;
61 62
62 spi_message_init(&m); 63 spi_message_init(&m);
63 spi_message_add_tail(&t, &m); 64 spi_message_add_tail(&t, &m);
@@ -144,7 +145,8 @@ struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi,
144 145
145 nspi->acknowledge_mode = acknowledge_mode; 146 nspi->acknowledge_mode = acknowledge_mode;
146 nspi->xfer_udelay = delay; 147 nspi->xfer_udelay = delay;
147 148 /* Use controller max SPI speed by default */
149 nspi->xfer_speed_hz = 0;
148 nspi->spi = spi; 150 nspi->spi = spi;
149 nspi->ndev = ndev; 151 nspi->ndev = ndev;
150 init_completion(&nspi->req_completion); 152 init_completion(&nspi->req_completion);
@@ -197,12 +199,14 @@ static struct sk_buff *__nci_spi_read(struct nci_spi *nspi)
197 tx.tx_buf = req; 199 tx.tx_buf = req;
198 tx.len = 2; 200 tx.len = 2;
199 tx.cs_change = 0; 201 tx.cs_change = 0;
202 tx.speed_hz = nspi->xfer_speed_hz;
200 spi_message_add_tail(&tx, &m); 203 spi_message_add_tail(&tx, &m);
201 204
202 memset(&rx, 0, sizeof(struct spi_transfer)); 205 memset(&rx, 0, sizeof(struct spi_transfer));
203 rx.rx_buf = resp_hdr; 206 rx.rx_buf = resp_hdr;
204 rx.len = 2; 207 rx.len = 2;
205 rx.cs_change = 1; 208 rx.cs_change = 1;
209 rx.speed_hz = nspi->xfer_speed_hz;
206 spi_message_add_tail(&rx, &m); 210 spi_message_add_tail(&rx, &m);
207 211
208 ret = spi_sync(nspi->spi, &m); 212 ret = spi_sync(nspi->spi, &m);
@@ -226,6 +230,7 @@ static struct sk_buff *__nci_spi_read(struct nci_spi *nspi)
226 rx.len = rx_len; 230 rx.len = rx_len;
227 rx.cs_change = 0; 231 rx.cs_change = 0;
228 rx.delay_usecs = nspi->xfer_udelay; 232 rx.delay_usecs = nspi->xfer_udelay;
233 rx.speed_hz = nspi->xfer_speed_hz;
229 spi_message_add_tail(&rx, &m); 234 spi_message_add_tail(&rx, &m);
230 235
231 ret = spi_sync(nspi->spi, &m); 236 ret = spi_sync(nspi->spi, &m);