• Home
  • Raw
  • Download

Lines Matching refs:nspi

30 static int __nci_spi_send(struct nci_spi *nspi, struct sk_buff *skb,  in __nci_spi_send()  argument
47 t.delay_usecs = nspi->xfer_udelay; in __nci_spi_send()
48 t.speed_hz = nspi->xfer_speed_hz; in __nci_spi_send()
53 return spi_sync(nspi->spi, &m); in __nci_spi_send()
56 int nci_spi_send(struct nci_spi *nspi, in nci_spi_send() argument
68 hdr[1] = nspi->acknowledge_mode; in nci_spi_send()
72 if (nspi->acknowledge_mode == NCI_SPI_CRC_ENABLED) { in nci_spi_send()
82 ret = __nci_spi_send(nspi, NULL, 1); in nci_spi_send()
94 ret = __nci_spi_send(nspi, skb, 0); in nci_spi_send()
95 if (ret != 0 || nspi->acknowledge_mode == NCI_SPI_CRC_DISABLED) in nci_spi_send()
98 reinit_completion(&nspi->req_completion); in nci_spi_send()
100 &nspi->req_completion, in nci_spi_send()
103 if (completion_rc <= 0 || nspi->req_result == ACKNOWLEDGE_NACK) in nci_spi_send()
127 struct nci_spi *nspi; in nci_spi_allocate_spi() local
129 nspi = devm_kzalloc(&spi->dev, sizeof(struct nci_spi), GFP_KERNEL); in nci_spi_allocate_spi()
130 if (!nspi) in nci_spi_allocate_spi()
133 nspi->acknowledge_mode = acknowledge_mode; in nci_spi_allocate_spi()
134 nspi->xfer_udelay = delay; in nci_spi_allocate_spi()
136 nspi->xfer_speed_hz = 0; in nci_spi_allocate_spi()
137 nspi->spi = spi; in nci_spi_allocate_spi()
138 nspi->ndev = ndev; in nci_spi_allocate_spi()
139 init_completion(&nspi->req_completion); in nci_spi_allocate_spi()
141 return nspi; in nci_spi_allocate_spi()
145 static int send_acknowledge(struct nci_spi *nspi, u8 acknowledge) in send_acknowledge() argument
152 skb = nci_skb_alloc(nspi->ndev, 0, GFP_KERNEL); in send_acknowledge()
167 ret = __nci_spi_send(nspi, skb, 0); in send_acknowledge()
174 static struct sk_buff *__nci_spi_read(struct nci_spi *nspi) in __nci_spi_read() argument
187 req[1] = nspi->acknowledge_mode; in __nci_spi_read()
191 tx.speed_hz = nspi->xfer_speed_hz; in __nci_spi_read()
198 rx.speed_hz = nspi->xfer_speed_hz; in __nci_spi_read()
201 ret = spi_sync(nspi->spi, &m); in __nci_spi_read()
205 if (nspi->acknowledge_mode == NCI_SPI_CRC_ENABLED) in __nci_spi_read()
211 skb = nci_skb_alloc(nspi->ndev, rx_len, GFP_KERNEL); in __nci_spi_read()
221 rx.delay_usecs = nspi->xfer_udelay; in __nci_spi_read()
222 rx.speed_hz = nspi->xfer_speed_hz; in __nci_spi_read()
225 ret = spi_sync(nspi->spi, &m); in __nci_spi_read()
229 if (nspi->acknowledge_mode == NCI_SPI_CRC_ENABLED) { in __nci_spi_read()
279 struct sk_buff *nci_spi_read(struct nci_spi *nspi) in nci_spi_read() argument
284 skb = __nci_spi_read(nspi); in nci_spi_read()
288 if (nspi->acknowledge_mode == NCI_SPI_CRC_ENABLED) { in nci_spi_read()
290 send_acknowledge(nspi, ACKNOWLEDGE_NACK); in nci_spi_read()
297 nspi->req_result = nci_spi_get_ack(skb); in nci_spi_read()
298 if (nspi->req_result) in nci_spi_read()
299 complete(&nspi->req_completion); in nci_spi_read()
311 if (nspi->acknowledge_mode == NCI_SPI_CRC_ENABLED) in nci_spi_read()
312 send_acknowledge(nspi, ACKNOWLEDGE_ACK); in nci_spi_read()