io/spi: add CSChange config option

Some SPI devices use a half-duplex request/response model where the user
submits a request and then continues reading until a full response is
received. This requires multiple Tx calls, but also requires that the
device's chipselect stays enabled until the full response has been read.

The linux spidev interface has a flag cs_change which, when set to true,
causes the device's chipselect to stay enabled after the data has been
written. The SPI devfs driver payload contains a field for this option,
but it is not currently used.

This change exposes that parameter by adding a CSChange option to the
SPI driver's configuration options and a SetCSChange function to the
spi.Device. The following flow then becomes possible:

* call SetCSChange(true) so the chipselect stays enabled after Tx calls
* call Tx() to write the request data
* call Tx() repeatedly to continue reading until full response data has
  been received
* call SetCSChange(false) so the chipselect gets disabled after Tx calls
* call Tx() one more time to release the device

Fixes #16239

Change-Id: Ide41f706a2605d483e160f861082d8f7e1796e82
Reviewed-on: https://go-review.googlesource.com/24910
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
3 files changed