drivers: bluetooth: hci_ambiq: add necessary SPI CS control
Before sending packet to controller the host needs to poll the status of controller to know it's ready, or before reading packets from controller the host needs to get the payload size of coming packets by sending specific command and putting the status or size to the rx buffer, the CS should be held at this moment to continue to send or receive packets. This change is needed for the based SPI driver update. Signed-off-by: Aaron Ye <aye@ambiq.com>
This commit is contained in:
parent
524ea22952
commit
30c41e9559
1 changed files with 12 additions and 0 deletions
|
@ -85,6 +85,18 @@ static inline int bt_spi_transceive(void *tx, uint32_t tx_len, void *rx, uint32_
|
|||
spi_tx_buf.len = (size_t)tx_len;
|
||||
spi_rx_buf.buf = rx;
|
||||
spi_rx_buf.len = (size_t)rx_len;
|
||||
|
||||
/* Before sending packet to controller the host needs to poll the status of
|
||||
* controller to know it's ready, or before reading packets from controller
|
||||
* the host needs to get the payload size of coming packets by sending specific
|
||||
* command and putting the status or size to the rx buffer, the CS should be
|
||||
* held at this moment to continue to send or receive packets.
|
||||
*/
|
||||
if (tx_len && rx_len) {
|
||||
spi_cfg.operation |= SPI_HOLD_ON_CS;
|
||||
} else {
|
||||
spi_cfg.operation &= ~SPI_HOLD_ON_CS;
|
||||
}
|
||||
return spi_transceive(spi_dev, &spi_cfg, &spi_tx, &spi_rx);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue